A comprehensive real-time trading bot for Binance USDT-M Futures with advanced order types, technical indicators, and market sentiment analysis. Built with Python and Streamlit for an intuitive web interface.
- Live Market Data: Real-time price feeds and WebSocket streaming
- Multiple Order Types: Market, Limit, Stop-Limit, OCO, TWAP, and Grid trading
- Technical Analysis: 20+ indicators including RSI, MACD, Bollinger Bands, and moving averages
- Risk Management: Position tracking, portfolio management, and automated risk controls
- Historical Data Analysis: Analysis of 211,000+ historical trading records
- Market Sentiment: Fear & Greed Index integration with 2,600+ sentiment records
- Pattern Recognition: Automated trading pattern detection and analysis
- Performance Metrics: Comprehensive trading statistics and profitability analysis
- Interactive Dashboard: Streamlit-based web interface with real-time charts
- Multi-Tab Navigation: Organized interface for trading, analysis, and monitoring
- Live Charts: Candlestick charts with overlaid technical indicators
- Responsive Design: Mobile-friendly interface for trading on the go
- Python 3.8 or higher
- Binance Futures API credentials
- Active internet connection for real-time data
-
Clone the repository
git clone https://github.com/devansh0703/BinanceTradeBot.git cd BinanceTradeBot -
Install dependencies
pip install -r requirements.txt
-
Configure API credentials
# Set environment variables export BINANCE_API_KEY="your_api_key_here" export BINANCE_SECRET_KEY="your_secret_key_here"
-
Run the application
streamlit run app.py --server.port 5000
-
Access the dashboard Open your browser and navigate to
http://localhost:5000
| Variable | Description | Required |
|---|---|---|
BINANCE_API_KEY |
Your Binance API key | Yes |
BINANCE_SECRET_KEY |
Your Binance secret key | Yes |
-
Create Binance Account
- Sign up at Binance
- Complete identity verification
-
Generate API Keys
- Go to API Management in your account settings
- Create a new API key with Futures trading permissions
- Enable IP restrictions for security
-
Testnet (Recommended for Testing)
- Use Binance Testnet for safe testing
- The bot automatically detects testnet credentials
- Market Orders: Immediate execution at current market price
- Limit Orders: Execute at specific price levels
- Stop-Limit Orders: Conditional orders triggered at stop price
- OCO (One-Cancels-Other): Simultaneous take-profit and stop-loss orders
- TWAP (Time-Weighted Average Price): Split large orders over time
- Grid Trading: Automated buy-low/sell-high within price ranges
- Simple Moving Average (SMA)
- Exponential Moving Average (EMA)
- Weighted Moving Average (WMA)
- MACD (Moving Average Convergence Divergence)
- RSI (Relative Strength Index)
- Stochastic Oscillator
- Williams %R
- Rate of Change (ROC)
- Bollinger Bands
- Average True Range (ATR)
- Keltner Channels
- Standard Deviation
- On-Balance Volume (OBV)
- Volume Weighted Average Price (VWAP)
- Accumulation/Distribution Line
- Money Flow Index (MFI)
BinanceTradeBot/
βββ app.py # Main Streamlit application
βββ src/ # Source code modules
β βββ binance_client.py # Binance API client
β βββ websocket_client.py # WebSocket streaming client
β βββ technical_indicators.py # Technical analysis engine
β βββ data_processor.py # Historical data processor
β βββ validator.py # Input validation
β βββ logger.py # Logging system
β βββ advanced/ # Advanced order handlers
β βββ market.py # Market orders
β βββ limit.py # Limit orders
β βββ stop_limit.py # Stop-limit orders
β βββ oco.py # OCO orders
β βββ twap.py # TWAP orders
β βββ grid_orders.py # Grid trading
βββ attached_assets/ # Historical data files
β βββ historical_data_*.csv # 211K+ trading records
β βββ fear_greed_index_*.csv # 2.6K+ sentiment records
βββ screenshots/ # Application screenshots
βββ README.md # Project documentation
βββ requirements.txt # Python dependencies
- 211,000+ Records: Comprehensive trading history analysis
- Multi-Asset Coverage: BTC, ETH, ADA, SOL, DOT, and more
- Performance Metrics: Win rate, profit/loss ratios, trade sizing
- Pattern Recognition: Automated detection of profitable patterns
- Fear & Greed Index: 2,600+ historical sentiment records
- Market Psychology: Correlation between sentiment and price movements
- Trend Analysis: Long-term sentiment trends and market cycles
- Predictive Insights: Sentiment-based trading signals
- Testnet Integration: Safe testing environment
- Position Limits: Configurable maximum position sizes
- Stop-Loss Protection: Automatic loss limitation
- Input Validation: Comprehensive parameter checking
- Start with Testnet: Always test strategies before live trading
- Risk Per Trade: Never risk more than 1-2% per trade
- Diversification: Spread risk across multiple assets
- Regular Monitoring: Keep track of open positions
- Stop-Loss Orders: Always use protective stops
Error: API request failed
Solution: Check API credentials and internet connection
Error: WebSocket connection timeout
Solution: Verify network connectivity and firewall settings
Error: Price less than min price
Solution: Check minimum price increments for the symbol
Error: Failed to load historical data
Solution: Ensure CSV files are in attached_assets/ directory
Enable detailed logging by setting the log level:
import logging
logging.basicConfig(level=logging.DEBUG)- Request Weight: 1200 per minute
- Orders: 300 per 10 seconds
- Raw Requests: 6000 per 5 minutes
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new features
- Submit a pull request
- Follow PEP 8 guidelines
- Use meaningful variable names
- Add docstrings to functions
- Include error handling
# Run tests
python -m pytest tests/
# Check code coverage
python -m pytest --cov=src tests/This project is licensed under the MIT License - see the LICENSE file for details.
Important Notice: This software is for educational and research purposes only. Trading cryptocurrencies involves substantial risk of loss and is not suitable for all investors. The authors and contributors are not responsible for any financial losses incurred through the use of this software.
- High Volatility: Cryptocurrency markets are extremely volatile
- Technical Risk: Software bugs may cause unexpected behavior
- Market Risk: Past performance does not guarantee future results
- Regulatory Risk: Cryptocurrency regulations may change
- Only trade with funds you can afford to lose
- Thoroughly test all strategies in testnet environment
- Understand the risks before live trading
- Consider consulting with a financial advisor
- Issues: Report bugs on GitHub Issues
- Discussions: Join conversations in GitHub Discussions
- Documentation: Check this README and code comments
- GitHub: @devansh0703
- Repository: BinanceTradeBot
- Binance: For providing comprehensive API documentation
- Streamlit: For the excellent web framework
- Plotly: For interactive charting capabilities
- Python Community: For the amazing ecosystem of libraries
Built with β€οΈ for the trading community
Last updated: July 2025





