Binance-Futures-Trading-Bot icon indicating copy to clipboard operation
Binance-Futures-Trading-Bot copied to clipboard

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

trafficstars

Binance-Futures-Trading-Bot Tweet

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

Join My public Discord Server & Follow The Twitter

  • Create a Binance Account (This link uses my referral which gives you 5% kickback on trades & would be greatly appreciated)
  • Want me to host a Bot for you on AWS, I have a monthly tier available for this join & I'll get in touch to get you set up 😃
  • Write your own functions to implement your TA strategies.
  • Comes with some pre-coded strategies found in TradingStrats.py
  • If you enjoy the repo please share it around to friends & tweet about it using the tweet button above 😃
    or Buy me a Coffee
  • Want Coding Assistance, Custom Strategies & Custom Features? Sponsor Me (private repo coming soon)
  • One time payment for custom strategies available also.
  • Works best with Python 3.8.10 on Linux.
  • On Windows you may run into issues, using the docker file / reducing the number of coins you are trading might help
  • 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.

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
  • Set up windows to sync time once a day if you don't do this binance will eventually reject orders with a timestamp error.

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

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.
  • TP_choice and 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:
docker build --tag Live_Bot
docker run -it Live_Bot

GUI for Backtesting and Live Trading (locally)

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.

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 & TP/SL functions Manual

YouTube Channels with Strategy Ideas:

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


TO-DO List:

Trello Board

Latest Changes (if any):

  • Added a GUI just run app.py (23/07/22)
  • Improved Backtester speed (23/07/22)

Contact me Tweet

  • If you have any queries about anything, or need me to explain any blocks of code please reach out to me on Discord.
  • If you have any suggestions or requests please reach out to me as well.
    Join My public Discord Server & Follow The Twitter
  • Want me to host a Bot for you on AWS, I have a monthly tier available for this join & I'll get in touch to get you set up 😃