Technical-analysis–driven crypto trading bot for Binance Futures.
- Operating System: Windows 7/8/10/11
- Python: 3.7 or higher
- Internet Connection: Required for API communication
- Time Sync: Critical for live trading on Windows
Configure Windows to sync time daily, or Binance may reject orders due to timestamp drift.
- Go to Start and type "Task Scheduler"
- Create a new task to sync time periodically
- Set to run
w32tm /resyncdaily
Windows and Linux instructions follow; for macOS, please use the DMG file.
Ensure Git & Python are on the computer.
Get Git: https://git-scm.com/install/windows
Get Python: https://www.python.org/ftp/python/3.13.12/python-3.13.12-amd64.exe
Run GIT CMD.
git clone https://github.com/thomasdutraa07/Trading-Bot-for-Binance-Future.git
cd Trading-Bot-for-Binance-Futurepy -m pip install -r requirements.txtThis will install all required packages:
python-binance- Binance API wrappercolorlog- Colored logging outputpandas- Data analysista- Technical analysis library- Other dependencies
- Create a Binance account at https://binance.com
- Go to API Management in account settings
- Click Create API
- Enable the following permissions:
- Read
- Trade
- Futures
- Withdrawals (optional)
- Save your
API KeyandSecret Key
Edit LiveTradingConfig.py with your settings:
# Binance API credentials
api_key = 'your_api_key_here'
api_secret = 'your_secret_key_here'
# Trading parameters
leverage = 10
order_size = 20 # in USDT
max_number_of_positions = 1
# Strategy selection
trading_strategy = 'tripleEMAStochasticRSIATR'
# Symbols to trade
trade_all_symbols = False
symbols_to_trade = ['BTCUSDT', 'ETHUSDT']py LiveTrading.pyThe bot will start monitoring the market and executing trades based on your configured strategy.
max_number_of_positions
- Set to
1for single-position trading - Increase to trade multiple symbols simultaneously
leverage
- Adjust leverage multiplier (e.g., 5, 10, 20)
- Higher leverage = higher risk
order_size
- Position size in USDT
- Start small while testing strategies
symbols_to_trade
- List of trading pairs:
['BTCUSDT', 'ETHUSDT', 'BNBUSDT'] - Set
trade_all_symbols = Trueto trade all available symbols
Enable trailing stop to lock in profits:
use_trailing_stop = True
trailing_stop_callback = 0.5 # 0.5% callback- Minimum value:
0.001(0.1%) - Maximum value:
5(5%) - Trailing stop activates when take-profit margin is reached
TP_SL_choice options:
'USDT'- Fixed USDT amount'%'- Percentage of position'x (ATR)'- Multiple of Average True Range'x (Swing High/Low) level 1/2/3'- Based on swing points'x (Swing Close) level 1/2/3'- Based on close prices
Multipliers:
SL_mult- Stop loss multiplierTP_mult- Take profit multiplier
Example:
TP_SL_choice = 'USDT'
SL_mult = 1 # Stop loss at -$1
TP_mult = 2 # Take profit at +$2StochRSIMACDtripleEMAStochasticRSIATRtripleEMAbreakoutstochBBgoldenCrosscandle_wickfibMACDEMA_crossheikin_ashi_ema2heikin_ashi_ema
Select strategy in LiveTradingConfig.py:
trading_strategy = 'tripleEMAStochasticRSIATR'interval - Trading timeframe:
1m, 3m, 5m, 15m, 30m- Short-term1h, 2h, 4h- Medium-term6h, 8h, 12h, 1d- Long-term
Add your strategy function to TradingStrats.py:
def my_custom_strategy(df, current_price):
# Your strategy logic here
# Calculate entry signals
if buy_condition:
direction = 'LONG'
elif sell_condition:
direction = 'SHORT'
else:
direction = None
# Calculate SL and TP
stop_loss = current_price * 0.98
take_profit = current_price * 1.02
return direction, stop_loss, take_profitReference your strategy in Bot_Class.Bot.make_decision().
Your strategy must return:
Trade_Direction- 'LONG', 'SHORT', or Nonestop_loss_val- Stop loss pricetake_profit_val- Take profit price
"Timestamp for this request was 1000ms ahead"
- Sync Windows time as described above
- Check system clock accuracy
"API key does not have permission"
- Enable Futures permission in API settings
- Recreate API key with correct permissions
Bot not opening positions
- Verify sufficient balance in Futures wallet
- Check strategy signals are generating
- Review logs in console output
Orders rejected
- Check minimum order size for symbol
- Verify leverage settings are allowed
- Ensure balance covers margin requirements
- Futures trading is highly leveraged and risky
- Always use stop losses
- Start with small position sizes
- Test strategies thoroughly before live trading
- Never invest more than you can afford to lose
- Repository: https://github.com/thomasdutraa07/Trading-Bot-for-Binance-Future
- Issues: https://github.com/thomasdutraa07/Trading-Bot-for-Binance-Future/issues
If you find this useful, please star the repository!