This software uses Puppeteer, a web scraper for Node.js, to get the signal sent by TradingView’s Technical Analysis Widget for Cryptocurrencies.
You can use it, as of now, for three actions :
-
Printing in the console the current price of a pair (the default source of the price is Binance) alongside the signal given by TradingView
-
Creating a JSON file and writing on it :
- The signal sent for a given pair
- The current price of that pair
- The UNIX time of the calculation
- The given pair
- The given interval
-
Analyzing the estimated profit from a JSON file generated by the above method, based on the following strategy :
- If the signal is “STRONG BUY”, we long the pair x2
- If the signal is “BUY”, we long the pair x1
- If the signal is “NEUTRAL”, we exit the market
- If the signal is “SELL”, we short the pair x1
- If the signal is “STRONG SELL”, we short the pair x2
This method can also be used calculating the invert strategy (shorting x2 if “STRONG BUY” and so on).
First, install the node_modules
npm install
Then, compile the TypeScript code (it will automatically create a build folder) :
tsc
Finally, you can run three different actions listed above as follows :
-
To log the signal and the price of a given pair, run :
node build simulate --pair=BTCUSDT --interval=1m
-
To write the simulation data in a JSON file, run :
node build write --pair=BTCUSDT --interval=1m --delay=10
-
To analyze the estimated profit from a JSON file, run :
node build analyze --path=../output/file.jsonc --inverted=false
Option |
Description |
Used in |
Allowed values |
Default |
---|---|---|---|---|
—pair |
Specifies the cryptocurrencies pair to use in the program. Example : BTCUSDT, ETHDAI… |
simulate write |
Any valid pair on Binance (other exchanges will be suppported in the future) |
/ |
—interval |
TradingView’s time interval for analysis (1 minute term, 1 day term, 1 month term…) |
simulate write |
1m (1 minute) 5m (5 minutes) 15m (15 minutes) 30m (30 minutes) 1h (1 hour) 2h (2 hours) 4h (4 hours) 1D (1 day) 1W (1 week) 1M (1 month) |
1m |
—delay |
The delay in seconds between each fetch (& write)of data from TradingView and the exchange, when writing in a JSON file |
write |
Any number (integer or float) >However, there is little to no interest setting this parameter to lower than 1 (may cause performance & network issues depending on your machine) and higher than 600 (irrelevant data) |
10 |
—path |
The (relative or absolute) path of a JSON file that will be analyzed |
analyze |
Any valid path string to a .json or .jsonc file |
/ |
—inverted |
Boolean, if true, will invert the calculation method and result in an inverted profit calculation as mentioned in the first paragraph |
analyze |
true or false >Any value different than --inverted or --inverted=true will be considered as false |
false |
Alternatively, if you are developing new features on this project aiming for a pull request (much appreciated), you can open two different terminals at the root of its directory and run :
tsc -w # Automatically compile TypeScript into JavaScript on file save
nodemon build # Enter your CLI arguments right here (nodemon will execute node and automatically refresh the execution on file change)
If you don’t have nodemon installed on your computer, you can use :
npm install -g nodemon # Installing nodemon globally (-g) is much recommended knowing that is is only used for development purposes, never on production
You can clone this repo and open pull requests if you want to contribute. Any contribution will be greatly appreciated
You can find me on :