A Crypto Trading Bot on Binance trading BTCUSDT and ETHUSDT using RSI in 25 Lines of Code
Note Python Version 3.7+ is supported
- First install Blankly using
pip
. Blankly is hosted on PyPi.
$ pip install blankly
- Ensure that you have your Binance API Keys connected, check here for more deatils
- Run the python file
$ python bot.py
- Woila! You have a working Binance Crypto Trading Bot that trades BTCUSDT and ETHUSDT
Blankly Metrics:
Compound Annual Growth Rate (%): 1.0%
Cumulative Returns (%): 2.0%
Max Drawdown (%): 38.0%
Variance (%): 4.36%
Sortino Ratio: 0.18
Sharpe Ratio: 0.19
Calmar Ratio: 0.16
Volatility: 0.02
Value-at-Risk: 305.38
Conditional Value-at-Risk: 20.38
Risk Free Return Rate: 0.0
Resampled Time: 86400.0
This uses the blankly package to build a trading strategy in just 25 lines of code.
We are able to utilize the Blankly.Strategy
object to easily add our rsi_price_event(price, symbol, state)
function that handles our core RSI logic that trades when RSI is less than 30 and sells when it is greater than 70.
RSI or relative strength index is an oscillator that measures the strength of a trend (i.e. when a trend is gaining momentum or losing steam). As it oscillates, it tells us when specific upwards or downward trends are most likely to stop and reverse. This is typically found when an asset is oversold (less than 30) or overbought (greater than 70) and can be used as an indicator, in conjunction with many other metrics to produce a meaningful output.
What is RSI? - Investopedia Implementation of RSI
Fork this repository, and start adding in some more indicators to test combinations
Take this strategy live by changing it to s.start()