/Binance-Futures-Bot

A Technical Analysis Bot that trades leveraged USDT futures markets on Binance.

Primary LanguagePython

Binance-Futures-Trading-Bot Tweet

Technical Analysis driven Crypto Trading bot on Binance Futures 📈 ₿ 🚀 Tweet

Join My public Discord Server & Follow The Twitter

  • Comes with 11 pre-built strategies found in TradingStrats.py
  • See Documentation below to implement your TA strategies.
  • If you enjoy the repo please share it around to friends & tweet about it using the tweet button above 😃
    or Buy me a Coffee
  • Utilizes python-Binance Client to execute orders and pull data from Binance
  • Utilizes ta library for Technical indicators
  • Set up windows to sync time once a day if you don't do this binance will eventually reject orders with a timestamp error.

Creating Custom Strategies:

Strategies are implemented in Bot_Class as functions in Make_decision()

  • Make_decision() must return Trade_Direction, stop_loss_val, take_profit_val for the strategy to work properly
  • You might draw inspiration for a strategy from one of the samples in TradingStrats.py
    Create Custom Strategies
    [Create Custom TP/SL functions](files/Custom TP_SL functions.pdf)

Binance Setup

  • Create a Binance Account (This link uses my referral which gives you 5% kickback on trades & would be greatly appreciated)
  • Enable Two-factor Authentication in the security section to keep your crypto safe.
  • Create a new API key under the API Management section.
  • [✓] Read Info [✓] Enable Trading [✓] Enable Futures [X] Enable Withdrawals
  • Whitelist your IP address to further secure your account, and so that your API keys don't expire after 3 months.
  • Fill in your api keys into api_secret and api_key in Config_File.py

For running Bot with cloud provider, Run directly from Live_Bot.py as you can't use the GUI through ssh

Run strategies at your own risk I am not responsible for your trading decisions, futures are risky and proper risk management should be adhered to at all times, always have a stoploss

python3 Live_Bot.py
  • Settings are in Config_File.py
  • Trade a single position at a time by setting Number_Of_Trades = 1, to trade multiple coins just increment this value.
  • Choose the Interval you want to trade and the buffer of candlesticks your strategy will need this will be dependent on indicators you need to ensure you have a sufficient buffer, or you will get errors.
  • leverage and order_Size should be changed according to your preference
  • symbol[] is a list of the symbols you wish to trade, If you wish to trade all symbols set Trade_All_Coins = True.
  • Trailing stop: set use_trailing_stop = 1 and change trailing_stop_percent to suit your strategy to use the trailing stop (Min val .001 i.e .1%, Max 5 i.e. 5%). The trailing stop will be placed when the take profit value margin of increase/decrease is reached from your strategy.
  • To close a trade based off a condition check_close_pos() must return a close_pos flag.
  • strategy is the name of the strategy you want to use, see below for adding your own custom strategies.
  • There are 11 default strategies to choose from: StochRSIMACD, tripleEMAStochasticRSIATR, tripleEMA, breakout, stochBB, goldenCross, candle_wick, fibMACD, EMA_cross, heikin_ashi_ema2 & heikin_ashi_ema
  • TP_SL_choice correspond to the type of SL/TP seen in the dropdowns in the GUI see below for adding custom ones.
  • SL_mult and TP_mult correspond to the numbers preceding the TP and SL choice dropdowns.

Docker container creation (Recommended for anyone having issues running the bot):

  • Navigate to the project directory in your terminal window
  • Run the following Command this will create a docker image with the current state of your Config.py and choice of strategy in Bot_Class.py:

Sample docker commands that I use, note yours may be different (sudo may not be needed for you, I am on Linux):

sudo docker build --tag live_bot .
sudo docker run -it live_bot

GUI for Backtesting and Live Trading

Just Run app.py to get the GUI

python3 app.py

  • Backtests are displayed in the terminal while running, the results are then saved to a csv file in the current directory along with a graph image.


YouTube Channels with Strategy Ideas:

Silicon Trader | Trade Pro | Strategy Testing | Trading Journal | The Moving Average


TO-DO List:

Trello Board


Contact me Tweet