An interactive trading application for Binance USDT-M Futures with live chart visualization and Flask API backend.
- Market Orders: Execute immediately at the best available price
- Limit Orders: Execute at a specified price or better
- Stop-Limit Orders: Trigger a limit order when a stop price is hit
- OCO (One-Cancels-the-Other): Place take-profit and stop-loss simultaneously
- TWAP (Time-Weighted Average Price): Split large orders into smaller chunks over time
- Grid Orders: Automated buy-low/sell-high within a price range
- Live candlestick charts with TradingView-style visualization
- Real-time order book display
- WebSocket price updates
- Comprehensive validation and logging
- Dark theme optimized for trading
├── app.py # Flask API server
├── src/
│ ├── config.py # Configuration settings
│ ├── logger.py # Structured logging
│ ├── validator.py # Input validation
│ ├── market_orders.py # Market order logic
│ ├── limit_orders.py # Limit order logic
│ └── advanced/
│ ├── stop_limit.py # Stop-limit order logic
│ ├── oco.py # OCO order logic
│ ├── twap.py # TWAP strategy
│ └── grid.py # Grid trading strategy
├── client/ # React frontend
├── bot.log # Logs (API calls, errors, executions)
└── README.md # This file
- Python 3.11+
- Node.js 20+
- Binance API credentials (optional for simulation mode)
Set the following environment variables (optional - app works in simulation mode without them):
BINANCE_API_KEY=your_api_key
BINANCE_API_SECRET=your_api_secret
BINANCE_TESTNET=true # Use testnet (recommended for testing)
- Install Python dependencies:
pip install flask flask-cors flask-socketio python-binance requests python-dotenv gunicorn eventlet- Install frontend dependencies:
cd client
npm install- Start the Flask backend:
python app.py- Start the React frontend (in development):
cd client
npm run devThe application will be available at http://localhost:5000
GET /api/symbols- List supported trading symbolsGET /api/prices- Get current prices for all symbolsGET /api/price/<symbol>- Get price for specific symbolGET /api/klines/<symbol>- Get candlestick dataGET /api/orderbook/<symbol>- Get order book data
POST /api/orders/market- Place market orderPOST /api/orders/limit- Place limit orderPOST /api/orders/stop-limit- Place stop-limit orderPOST /api/orders/oco- Place OCO orderPOST /api/orders/twap- Place TWAP orderPOST /api/orders/grid- Create grid trading strategyGET /api/orders/pending- Get all pending ordersDELETE /api/orders/<order_id>- Cancel order
All actions are logged to bot.log with structured format including:
- Timestamps
- Order placements
- API calls
- Validation results
- Error traces
- BTCUSDT, ETHUSDT, BNBUSDT, XRPUSDT, ADAUSDT
- DOGEUSDT, SOLUSDT, DOTUSDT, MATICUSDT, LTCUSDT
- The application runs in simulation mode without Binance API credentials
- Use Binance Testnet for safe testing with real API
- All orders are validated before placement
- Comprehensive error handling and logging