Skip to content

Akriti321/Trade

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trading Bot

A production-quality Python project for placing Binance Futures Testnet orders.

Project Overview

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.

Features

  • Place MARKET and LIMIT orders
  • Support BUY and SELL orders
  • 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

Folder Structure

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

Installation

  1. Clone or copy the repository to your local machine.
  2. Create a Python 3.11+ virtual environment:
python -m venv .venv
  1. Activate the virtual environment:
  • Windows PowerShell:
.\.venv\Scripts\Activate.ps1
  • Windows CMD:
.\.venv\Scripts\activate.bat
  1. Install dependencies:
pip install -r requirements.txt

Configuration

  1. Copy .env.example to .env
  2. Add your Binance Testnet credentials:
BINANCE_API_KEY=your_testnet_api_key_here
BINANCE_SECRET_KEY=your_testnet_secret_key_here

Running the CLI

Market Order

python cli.py --symbol BTCUSDT --side BUY --type MARKET --quantity 0.001

Limit Order

python cli.py --symbol BTCUSDT --side SELL --type LIMIT --quantity 0.001 --price 115000

Screenshots

Placeholder for screenshots and example output.

Assumptions

  • Binance Futures Testnet credentials are configured in a local .env file.
  • Users execute the CLI from the project root.
  • Quantity and price values are provided as numeric strings.

Future Improvements

  • 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

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages