Automatically mirrors trades from Gate.io's top leaderboard traders directly to your Binance Futures account in real time.
CopyBot monitors a Gate.io copy trading leaderboard trader via WebSocket and replays every trade signal (open/close/size/direction) on your own Binance Futures account — in demo or live mode.
You pick a trader ID from the Gate.io leaderboard. CopyBot handles the rest.
- Real-time signal detection via Gate.io WebSocket stream
- Proportional position sizing — scales the trader's size to your account balance
- Demo mode — full dry-run with fake money, no real orders placed
- Live mode — executes real Binance Futures orders
- Hot-swap traders — switch lead trader mid-session without restarting
- Performance stats — live P&L, win rate, trade count on demand
- Auto browser login — handles Gate.io session auth automatically; CAPTCHA only required once
- Graceful shutdown — closes open positions and exits cleanly
| Layer | Technology |
|---|---|
| Exchange connectivity | CCXT (Binance Futures) |
| Signal feed | Gate.io WebSocket (real-time leaderboard stream) |
| Session auth | Playwright + playwright-stealth |
| Async runtime | Python asyncio + aiohttp |
| Config management | python-dotenv |
Gate.io Leaderboard
│
▼
[gateio_auth.py] Browser login → session cookie
│
▼
[gateio_ws.py] WebSocket listener → raw trade events
│
▼
[trader_monitor.py] Filter signals for target trader ID
│
▼
[signal_engine.py] Parse signal → calculate position size
│
▼
[binance_client.py] Execute order on Binance Futures
│
▼
[bot.py / logger.py] Orchestration, stats, graceful shutdown
- Python 3.10+
- A Binance account with Futures enabled and API keys generated
- A Gate.io account (free — used only to access the public leaderboard)
1. Clone the repo
git clone https://github.com/YOUR_USERNAME/copybot-gateio-binance.git
cd copybot-gateio-binance2. Create a virtual environment and install dependencies
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # Mac/Linux
pip install -r requirements.txt
python -m playwright install chromium3. Configure your credentials
# Copy the example env file
copy .env.example config\.env # Windows
# cp .env.example config/.env # Mac/LinuxOpen config/.env and fill in:
BINANCE_API_KEY=your_binance_api_key
BINANCE_API_SECRET=your_binance_api_secret
GATEIO_EMAIL=your_gateio_email
GATEIO_PASSWORD=your_gateio_passwordNever commit your
.envfile. It is listed in.gitignoreand will not be tracked by git.
# Demo mode — no real money, recommended for testing first
python main.py --trader 1851 --mode demo
# Live mode — real Binance Futures orders
python main.py --trader 1851 --mode liveReplace 1851 with any trader ID from the Gate.io Copy Trading leaderboard.
On first launch, a browser window opens automatically, logs into Gate.io, and saves your session. You may need to solve a CAPTCHA once. After that, the bot runs fully headlessly for 23 hours before the session expires.
| Command | Action |
|---|---|
trader <id> |
Switch to a different lead trader instantly |
stats |
Show full performance report (P&L, win rate, trades) |
stop |
Graceful shutdown — closes open positions cleanly |
copybot/
├── main.py # Entry point — CLI args, startup
├── core/
│ ├── bot.py # Main orchestrator loop
│ ├── signal_engine.py # Signal parsing & position sizing logic
│ └── logger.py # Structured logging
├── exchange/
│ ├── binance_client.py # Binance Futures order execution (CCXT)
│ ├── gateio_ws.py # Gate.io WebSocket listener
│ ├── gateio_auth.py # Playwright browser login & session mgmt
│ └── trader_monitor.py # Filters & routes signals by trader ID
├── config/
│ ├── settings.py # Config loader (reads from .env)
│ └── .env.example # Template — copy to .env and fill in keys
├── tests/ # Test scripts for each module
├── logs/ # Auto-created; log files excluded from git
├── requirements.txt
└── .gitignore
- Uses Gate.io's public leaderboard WebSocket endpoint, which is not part of their official documented API. The bot may require updates if Gate.io changes their site structure.
- This project is for educational and personal automation purposes. Always review Gate.io's Terms of Service before use.
- Start with demo mode. Verify signals are being mirrored correctly before switching to live.
This software is provided for educational purposes only. Crypto futures trading carries significant financial risk. This project does not constitute financial advice. You are solely responsible for any trades placed by this bot on your account. Always test in demo mode first and never risk money you cannot afford to lose.
Haifa Khan Afridi 📧 haifaafridi8@gmail.com
MIT License — see https://github.com/haifaafridi/copybot-gateio-binance/blob/main/LICENSE for details.