/Binance-Futures-Trading-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 📈 ₿ 🚀

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. (currently working on new documentation)
  • If you enjoy the repo please share it around to friends & tweet about it using the tweet button above 😃
    or Buy me a Coffee

This Bot currently only works on windows OS, in future I hope to support linux but I don't have the time right now


This Bot utilizes:

  • python-Binance Client to execute orders and pull data from Binance
  • ta library for Technical indicators
  • plotly for generating interactive Trade graphs.
  • tabulate for logging trades in a table format
  • colorlog for adding colour to logs

Important for live trading on windows:

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 TradingStrats.py as functions and then referenced in Bot_Class.Bot.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
    Docs are being updated currently for the new bot
    Create Custom Strategies
    Create Custom TP/SL functions

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
  • Fill in your api keys into api_secret and api_key in live_trading_config.py

Running the live trading bot

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_trading.py

Settings are in live_trading_config.py

  • Trade a single position at a time by setting max_number_of_positions = 1, to trade multiple coins just increment this value.
  • leverage and order_size should be changed according to your preference
  • symbols_to_trade[] is a list of the symbols you wish to trade, If you wish to trade all symbols set trade_all_symbols = True.
  • Trailing stop: set use_trailing_stop = True and change trailing_stop_callback 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. (Not functioning currently, this needs updated for new bot)
  • trading_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 is the type of take profit and stop loss you want to use valid choices are: USDT, %, x (ATR), x (Swing High/Low) level 1, x (Swing High/Low) level 2, x (Swing High/Low) level 3, x (Swing Close) level 1, x (Swing Close) level 2, x (Swing Close) level 3
  • SL_mult and TP_mult are multipliers for the TP_SL_choice
    Example:
    TP_SL_choice = 'USDT'
    SL_mult = 1
    TP_mult = 2
    This configuration will set TP and SL values at $1 loss and $2 gain respectively
  • Choose the interval you want to trade, valid intervals are: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d.

YouTube Channels with Strategy Ideas:

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


TO-DO List:

Trello Board


Contact me Tweet

  • Prioritise your Trello ticket with a one time payment
  • Get Custom Strategies made to your specifications by reaching out to me on discord for a quote price.
  • 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