Skip to content

smitkunpara/trading_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Binance Futures Trading Bot

Python CLI for Binance Futures Testnet with support for Market, Limit, and Algo orders (Stop, Take Profit, Trailing Stop).

Features

  • ✅ Market & Limit orders
  • ✅ Algo orders (Stop Market, Take Profit, Trailing Stop)
  • ✅ Position management
  • ✅ Order management
  • ✅ Account information

Setup

1. Install uv

# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

2. Install Dependencies

cd trading_bot
uv sync

3. Configure API Keys

cp .env.example .env
# Edit .env with  Binance API credentials

Quick Start

Check Price:

uv run python cli.py --symbol BTCUSDT

Market Order:

uv run python cli.py --symbol BTCUSDT --side BUY --type MARKET --quantity 0.002

Limit Order:

uv run python cli.py --symbol BTCUSDT --side SELL --type LIMIT --quantity 0.002 --price 95000

Stop Market:

uv run python cli.py --symbol BTCUSDT --side SELL --type STOP_MARKET --quantity 0.002 --trigger-price 85000

Trailing Stop:

uv run python cli.py --symbol BTCUSDT --side SELL --type TRAILING_STOP_MARKET --quantity 0.002 --callback-rate 1.5

View Positions:

uv run python cli.py --positions

For more examples, see demo/EXAMPLES.md | Watch Demo Video

CLI Arguments

Argument Description
--symbol Trading pair (e.g., BTCUSDT)
--side BUY or SELL
--type Order type: MARKET, LIMIT, STOP_MARKET, TAKE_PROFIT_MARKET, STOP, TAKE_PROFIT, TRAILING_STOP_MARKET
--quantity Order quantity
--price Limit price (for LIMIT, STOP, TAKE_PROFIT orders)
--trigger-price Trigger price for algo orders
--callback-rate Callback rate for TRAILING_STOP_MARKET (0.1-10%)
--activate-price Activation price for TRAILING_STOP_MARKET
--working-type CONTRACT_PRICE or MARK_PRICE (default: CONTRACT_PRICE)
--price-protect Enable price protection for algo orders
--orders List orders: open, close, or all
--cancel Cancel order by ID
--positions Show open positions
--close-position Close position for symbol
--account Show account information

Development

Install Dependencies:

uv sync --group dev

Run Tests:

uv run pytest

Tests are automated via GitHub Actions. See test results in the Actions tab.

About

A trading bot for Binance Futures Testnet

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages