A simplified Python application that places MARKET and LIMIT orders on the Binance Futures Testnet (USDT-M).
- Place Market and Limit orders (BUY/SELL).
- Validates user input via an enhanced CLI built with
typerandrich. - Separated bot logic (API client, validators, orders logic) and CLI layer.
- Comprehensive file logging (
trading_bot.log).
- Python 3.8+
- Binance Futures Testnet Account
- Clone/Download the repository
- Install dependencies:
pip install -r requirements.txt
- API Credentials Included:
- For ease of testing by the reviewers, a
.envfile containing valid Binance Futures Testnet API keys is already included in this repository. You do not need to configure anything else—the bot is ready to run immediately!
- For ease of testing by the reviewers, a
Use the cli.py script to place orders. The CLI provides a clear, formatted summary of your request and the API response.
To place a MARKET order (e.g., BUY 0.01 BTCUSDT):
python cli.py trade BTCUSDT BUY MARKET 0.01To place a LIMIT order, you must provide the --price (or -p) option. For example, to place a SELL LIMIT order for 0.01 BTCUSDT at $60,000:
python cli.py trade BTCUSDT SELL LIMIT 0.01 --price 60000- Uses Binance Futures Testnet base URL.
- Time in force for LIMIT orders is hardcoded to
GTC(Good Till Cancelled). - Output focuses on the requested specific fields (
orderId,status,executedQty,avgPrice).
bot/client.py: The Binance API wrapper for Testnet.bot/validators.py: Data validation rules.bot/orders.py: Order execution layer linking validators and client.bot/logging_config.py: File and console logging setup.cli.py: The command-line interface entry point.