A production-quality Python project for placing Binance Futures Testnet orders.
Trading Bot is a modular Python CLI application that submits market and limit orders to Binance USDT-M Futures Testnet. It is built for maintainability, testability, and clear separation of concerns.
- Place
MARKETandLIMITorders - Support
BUYandSELLorders - Validate CLI inputs
- Log request data, responses, and errors
- Use environment variables for API credentials via
python-dotenv - Friendly terminal output and robust error handling
trading_bot/
│
├── bot/
│ ├── __init__.py
│ ├── client.py
│ ├── orders.py
│ ├── validators.py
│ ├── logging_config.py
│ ├── config.py
│ └── exceptions.py
│
├── logs/
│ └── trading.log
│
├── cli.py
├── .env.example
├── README.md
├── requirements.txt
└── .gitignore
- Clone or copy the repository to your local machine.
- Create a Python 3.11+ virtual environment:
python -m venv .venv- Activate the virtual environment:
- Windows PowerShell:
.\.venv\Scripts\Activate.ps1- Windows CMD:
.\.venv\Scripts\activate.bat- Install dependencies:
pip install -r requirements.txt- Copy
.env.exampleto.env - Add your Binance Testnet credentials:
BINANCE_API_KEY=your_testnet_api_key_here
BINANCE_SECRET_KEY=your_testnet_secret_key_herepython cli.py --symbol BTCUSDT --side BUY --type MARKET --quantity 0.001python cli.py --symbol BTCUSDT --side SELL --type LIMIT --quantity 0.001 --price 115000Placeholder for screenshots and example output.
- Binance Futures Testnet credentials are configured in a local
.envfile. - Users execute the CLI from the project root.
- Quantity and price values are provided as numeric strings.
- Add unit tests for validation and order management
- Add support for stop-loss and take-profit orders
- Add instrument-specific precision handling
- Introduce retry logic for transient API failures
- Add more advanced logging and metrics