This project is a command-line interface (CLI) trading bot developed for the Binance USDT-M Futures market. It supports various order types for executing trades programmatically and features structured logging for all actions.
- Core Orders:
- Market Orders
- Limit Orders
- Advanced Orders:
- Stop-Limit Orders
- TWAP (Time-Weighted Average Price) Strategy
- Logging: All order placements, executions, and errors are logged to
bot.log.
your_name_binance_bot/
├── src/
│ ├── advanced/
│ │ ├── stop_limit.py
│ │ └── twap.py
│ ├── client.py
│ ├── limit_orders.py
│ ├── logger.py
│ └── market_orders.py
├── .env
├── .gitignore
├── bot.log
├── bot.py
├── README.md
├── report.pdf
└── requirements.txt
Follow these steps to set up and run the bot.
git clone https://github.com/ujjwaltwri/ujjwal-binance-bot
cd your_name-binance-bot# For macOS/Linux
python3 -m venv venv
source venv/bin/activate
# For Windows
python -m venv venv
.\venv\Scripts\activatepip install -r requirements.txtThe bot requires API keys from the Binance Testnet to function.
- Create a file named
.envin the project's root directory. - Add your Testnet API Key and Secret Key to the file like this:
# .env file
BINANCE_API_KEY='your_testnet_api_key_here'
BINANCE_API_SECRET='your_testnet_secret_key_here'
All commands are run from the project's root directory using bot.py.
python bot.py market [SYMBOL] [SIDE] [QUANTITY]
# Example:
python bot.py market BTCUSDT BUY 0.002python bot.py limit [SYMBOL] [SIDE] [QUANTITY] [PRICE]
# Example:
python bot.py limit BTCUSDT SELL 0.002 115000python bot.py stoplimit [SYMBOL] [SIDE] [QUANTITY] [PRICE] [STOP_PRICE]
# Example (Stop-Loss):
python bot.py stoplimit BTCUSDT SELL 0.002 99000 99500python bot.py twap [SYMBOL] [SIDE] [TOTAL_QUANTITY] [DURATION_MINUTES]
# Example:
python bot.py twap BTCUSDT BUY 0.006 3