Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HFT — Binance → Target Lead-Lag Futures Bot

Cross-exchange lead-lag trading system: Binance USD-M Futures as the lead book, target exchange (MEXC by default) as the lag book. Generates long/short signals when mid prices diverge beyond configured thresholds.

Default mode: paper trading. Live execution requires explicit multi-step arming.

Repository Layout

.
├── LICENSE                 MIT license
├── SECURITY.md             Secret handling and pre-push checklist
├── pyproject.toml          pytest configuration
├── trading_bot/            Main application
│   ├── .env.example        Copy to .env — never commit .env
│   ├── config.yaml.example Copy to config.yaml — never commit local config
│   ├── main.py             Entry point
│   ├── core/               Config, models, risk
│   ├── engine/             Signal, spread, execution engines
│   ├── exchanges/          WebSocket feeds and MEXC executors
│   ├── dashboard/          Local web UI
│   ├── storage/            SQLite tick recorder
│   ├── telegram/           Optional notifications
│   └── tests/              Unit tests
└── todo.md                 Strategy notes (optional reading)

Quick Start

Requirements: Python 3.11+

git clone git@github.com:sssaturX/hft.git
cd hft

python -m venv .venv
source .venv/bin/activate
pip install -r trading_bot/requirements.txt

cp trading_bot/.env.example trading_bot/.env
cp trading_bot/config.yaml.example trading_bot/config.yaml

python -m trading_bot.main

Dashboard: http://127.0.0.1:8080

Smoke test (30 seconds):

python -m trading_bot.main --duration-seconds 30

Configuration

File Purpose
trading_bot/config.yaml Symbols, filters, paper/live settings (local, gitignored)
trading_bot/.env Secrets and runtime mode overrides (local, gitignored)

See trading_bot/README.md for full documentation on signal filters, paper trading, and live MEXC arming.

Tests

pytest

No live exchange connectivity required.

What NOT to Push

The following are gitignored but may exist locally — do not force-add them:

  • trading_bot/.env — MEXC API keys, WEB tokens, Telegram tokens
  • trading_bot/config.yaml — your personal trading parameters
  • logs/, data/, exports/ — runtime artifacts
  • hft_project_no_db/ — local working copy
  • cross_exchange_paper/ — separate sub-project

Read SECURITY.md before your first push.

License

MIT — see LICENSE.

Disclaimer

This software is for educational and research purposes. Cryptocurrency futures trading involves substantial risk. The MEXC WEB-token execution path uses unofficial reverse-engineered endpoints. Authors are not responsible for financial losses, exchange bans, or API changes.

About

Open-source cross-exchange lead-lag futures bot. Streams Binance and MEXC order books, detects mid-price divergence, filters noise with dead zone / hysteresis / cooldown, runs paper trades, and exposes a local dashboard. Live MEXC execution is opt-in and fail-closed

Topics

Resources

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages