A modular, asynchronous Python trading bot for Binance Futures (USDT-M Testnet), built with a clean architecture, strong logging, and extensibility in mind.
This project provides a lightweight yet production-oriented foundation for building automated trading systems on Binance Futures. It emphasizes:
- Clear separation of concerns
- Async-first design
- Safe testing using Binance Testnet
- Scalable and maintainable code structure
- ⚡ Async Binance Futures client (USDT-M)
- 🧪 Testnet support (
https://testnet.binancefuture.com) - 📈 Market & Limit order execution
- 🖥️ CLI interface powered by
click - 📊 Structured logging with configurable levels
- ✅ Input validation for safer execution
- 🔒 Environment-based configuration (
.env) - 🧪 Dry-run mode for safe testing
bot/
├── __init__.py
├── client.py # Binance API wrapper (async, testnet-ready)
├── orders.py # Order execution logic
├── validators.py # Input validation
├── logging_config.py # Logging setup
├── cli.py # CLI entry point
├── README.md
└── requirements.txt
git clone <your-repo-url>
cd <your-project>python -m venv venv
# Linux / Mac
source venv/bin/activate
# Windows
venv\Scripts\activatepip install -r bot/requirements.txtCreate a .env file in the project root:
BINANCE_API_KEY=your_api_key_here
BINANCE_API_SECRET=your_api_secret_here
BINANCE_TESTNET=true
LOG_LEVEL=INFO
⚠️ Never commit your.envfile. Add it to.gitignore.
Run the CLI using module mode:
python -m bot.cli \
--side BUY \
--quantity 0.001API credentials will be automatically loaded from
.env.
python -m bot.cli \
--side BUY \
--quantity 0.001python -m bot.cli \
--side SELL \
--order-type limit \
--quantity 0.001 \
--price 65000