A Python-based cryptocurrency trading bot that automatically trades BTC/USDT futures on Binance using DEMA (Double Exponential Moving Average) strategy.
Note: you can trade other pairs besides BTC/USDT. Just change the ticker param.
- Real-time BTC price monitoring via WebSocket
- Automated trading based on DEMA crossover strategy
- Telegram notifications for trade entries and exits
- Position management with leverage
- Error handling and automatic reconnection
- Python 3.8+
- Binance Futures account
- Binance API keys (How to create Binance API keys)
- Telegram bot token and chat ID (How to create a Telegram Bot for FREE in Python - Bot Father)
- Clone the repository and navigate to the folder:
git clone https://github.com/thiagomunich/binance-trading-bot.git && cd binance-trading-bot
- Install required packages:
pip3 install -r requirements.txt
- Rename the
.env.examplefile to.envand fill in your credentials:
BINANCE_API_KEY="your-binance-api-key"
BINANCE_API_SECRET="your-binance-api-secret"
TELEGRAM_TOKEN="your-telegram-bot-token"
TELEGRAM_CHAT_ID="your-telegram-chat-id"
- Finally run the bot:
python3 Main.py
The bot operates using the following strategy:
- Monitors BTC/USDT price movements in real-time using 5-minute candles
- Calculates DEMA indicators for both high and low prices
- Opens long positions when:
- Candle closes below the low DEMA
- The cents of the low price are 0.00
- Opens short positions when:
- Candle closes above the high DEMA
- The cents of the high price are 0.00
- Closes positions when price crosses the opposite DEMA
- Uses 100x leverage for all trades
- Sends notifications via Telegram for all trade actions
This bot is fully working and tested but the trading strategy used here is for educational purposes only. Cryptocurrency trading involves substantial risk and may not be suitable for everyone. Never trade with money you cannot afford to lose.
I've created the simplest architecture possible, without too many files and folders, so you can easily check the code and make sure it's legit. Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.