A small command-line tool for placing and managing orders on the Binance Futures Testnet. Practice with fake money, with input validation, clear errors and full request logging.
Disclaimer: This is a learning project built out of curiosity. It has no trading strategy and is not financial advice. It targets the testnet by default. Don't use it with real funds.
- MARKET, LIMIT and STOP (stop-limit) orders, BUY or SELL
- Subcommands to check price, balance, open orders, order status, and to cancel orders
--dry-runto validate an order without sending it- Interactive mode for guided input
- Input validation with precise
Decimalhandling (no float rounding) - Credentials read from environment variables or
.env, never from source code - Rotating log file at
logs/bot.logwith every request, response and error - Unit tests and CI on Python 3.9, 3.11 and 3.12
git clone https://github.com/atharva-404/Crypto-Trading-Bot.git
cd Crypto-Trading-Bot
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -e .- Create an account at the Binance Futures Testnet and generate an API key and secret.
- Copy the example file and fill it in:
cp .env.example .env # Windows: copy .env.example .envBINANCE_API_KEY=your_testnet_api_key
BINANCE_API_SECRET=your_testnet_api_secret.env is git-ignored.
# Market order
python -m binance_bot place --symbol BTCUSDT --side BUY --type MARKET --quantity 0.01
# Limit order
python -m binance_bot place --symbol BTCUSDT --side SELL --type LIMIT --quantity 0.01 --price 70000
# Stop-limit order
python -m binance_bot place --symbol BTCUSDT --side SELL --type STOP --quantity 0.01 --price 59900 --stop-price 60000
# Validate only
python -m binance_bot place --symbol BTCUSDT --side BUY --type MARKET --quantity 0.01 --dry-run
# Other commands
python -m binance_bot price BTCUSDT
python -m binance_bot balance
python -m binance_bot orders --symbol BTCUSDT
python -m binance_bot status BTCUSDT 123456
python -m binance_bot cancel BTCUSDT 123456
python -m binance_bot interactiveAfter pip install -e . you can also use the shorter binance-bot command. Add -v to print log lines to the console.
binance_bot/
bot.py # FuturesBot: API wrapper
cli.py # argparse command-line interface
config.py # loads credentials from env / .env
logger.py # rotating file logger
validation.py # input validation
tests/ # pytest suite (no network needed)
pip install -e ".[dev]"
ruff check .
pytestIssues and pull requests are welcome. See CONTRIBUTING.md.