Command-line trading bot for Binance USDT-M Futures Testnet.
This project was built as part of a hiring assignment to demonstrate practical experience with Binance Futures APIs, order execution logic, and clean Python code structure. The focus is correctness, safety, and clear logging rather than strategy optimization.
- Class-based bot architecture (
BasicBot) - Order types:
- MARKET
- LIMIT
- STOP_LIMIT (stop + limit)
- BUY / SELL
- Strong input validation
- Robust logging to
logs/trading_bot.log - API keys loaded via environment variables (
.env)
- Python 3.10
- A Binance USDT-M Futures Testnet account + API keys: https://testnet.binancefuture.com/
python -m venv .venv
# Linux/Mac
source .venv/bin/activate
# Windows
.venv\\Scripts\\activatepip install -r requirements.txtCopy .env.example to .env and fill in your testnet keys:
cp .env.example .envpython bot.py --symbol BTCUSDT --side BUY --type MARKET --qty 0.003python bot.py --symbol BTCUSDT --side BUY --type LIMIT --qty 0.003 --price 65000python bot.py --symbol BTCUSDT --side BUY --type STOP_LIMIT --qty 0.003 --stop 70000 --price 69800- This bot is TESTNET ONLY and points to
https://testnet.binancefuture.com. - If you get precision errors (quantity/price step size), use the printed
exchangeInfohints in logs.
- File:
logs/trading_bot.log
.
├─ bot.py
├─ src/
│ ├─ bot.py
│ ├─ config.py
│ ├─ logger.py
│ ├─ validation.py
│ └─ __init__.py
├─ logs/
├─ requirements.txt
├─ .env.example
└─ README.md