EthanAlgoX/LLM-TradeBot
A multi-agent AI trading system using LLMs to optimize strategies and adapt to market conditions in real-time.
๐ค LLM-TradeBot
Intelligent Multi-Agent Quantitative Trading Bot based on the Adversarial Decision Framework (ADF). Achieves high win rates and low drawdown in automated futures trading through market regime detection, price position awareness, dynamic score calibration, and multi-layer physical auditing.
๐ Web App (Recommended)
Experience the bot immediately through our web interface:
๐ Live Dashboard
Dashboard Highlights
- LLM toggle stays off by default; turning it on prompts for an API key.
- Agent Chatroom shows per-cycle agent outputs and the final Decision Core action.
- Real-time Balance Curve uses a fixed initial balance and PnL-driven current balance.
- Agent Config lets you edit per-agent parameters and (if applicable) system prompts.
โจ Key Features
- ๐ต๏ธ Perception First: Unlike strict indicator-based systems, this framework prioritizes judging "IF we should trade" before deciding "HOW to trade".
- ๐ค Multi-Agent Collaboration: Core + optional agents with LLM and Local variants for flexible deployment.
- ๐๏ธ Agent Configuration: Enable/disable optional agents via Dashboard, environment variables, or config file for customized strategy.
- ๐ฌ Agent Chatroom: Chat-style multi-agent outputs per cycle, with Decision Core final decisioning.
- ๐งฉ Agent Config Tabs: Configure per-agent parameters and optional system prompts directly in the Dashboard.
- ๐ฐ AUTO1 Symbol Selection: Intelligent single-symbol selection based on momentum, volume, and technical indicators.
- ๐ง Multi-LLM Support: Seamlessly switch between DeepSeek, OpenAI, Claude, Qwen, and Gemini via Dashboard settings.
- ๐ Multi-Account Trading: Manage multiple exchange accounts with unified API abstraction (currently Binance, extensible).
- โก Async Concurrency: Currently fetches multi-timeframe data (5m/15m/1h) concurrently, ensuring data alignment at the snapshot moment.
- ๐ฅ๏ธ CLI Headless Mode: Run without Web UI for headless servers - rich terminal output with 93% less log verbosity.
- ๐งช๐ฐ Test/Live Mode Toggle: Quick switch between paper trading and live trading with visual confirmation.
- ๐ก๏ธ Safety First: Stop-loss direction correction, capital pre-rehearsal, and veto mechanisms to safeguard live trading.
- ๐ Full-Link Auditing: Every decision's adversarial process and confidence penalty details are recorded, achieving true "White-Box" decision-making.
๐๏ธ System Architecture Overview
Multi-Agent Architecture (Current)
flowchart TD
A["๐ฏ Symbol Selector"] --> B["๐ต๏ธ DataSync (5m/15m/1h)"]
B --> C["๐จโ๐ฌ Quant Analyst"]
C --> D["๐งญ Multi-Period Parser"]
C --> E["๐ฎ Trend / ๐ Setup / โก Trigger (LLM or Local)"]
C --> F["๐ช Reflection (optional)"]
D --> G["โ๏ธ Decision Core"]
E --> G
F --> G
G --> H["๐ก๏ธ Risk Audit"]
H --> I["๐ Execution Engine"]
Design highlights
- Symbol Selection chooses the active symbol(s) before analysis.
- DataSync aligns multi-timeframe data at the same snapshot moment.
- Quant Analyst produces numeric signals (trend/osc/sentiment/traps).
- Semantic Agents (Trend/Setup/Trigger) provide human-readable reasoning (LLM or local).
- Multi-Period Parser compresses 1h/15m/5m alignment into a Decision Core input.
- Decision Core fuses all enabled agent outputs into final action/confidence.
- Risk Audit can veto or adjust before execution.
- Reflection summarizes performance and feeds back into decisions.
๐ Detailed Docs: See Data Flow Analysis for complete mechanisms.
๐ค Supported Ecosystem
Supported Exchanges
CEX (Centralized Exchanges)
| Exchange | Status | Register (Fee Discount) |
|---|---|---|
| Binance | โ Supported | Register |
| Bybit | ๐๏ธ Coming Soon | Register |
| OKX | ๐๏ธ Coming Soon | Register |
| Bitget | ๐๏ธ Coming Soon | Register |
Perp-DEX (Decentralized Perpetual Exchanges)
| Exchange | Status | Register (Fee Discount) |
|---|---|---|
| Hyperliquid | ๐๏ธ Coming Soon | Register |
| Aster DEX | ๐๏ธ Coming Soon | Register |
| Lighter | ๐๏ธ Coming Soon | Register |
Supported AI Models
| AI Model | Status | Get API Key |
|---|---|---|
| DeepSeek | โ Supported | Get API Key |
| Qwen | โ Supported | Get API Key |
| OpenAI (GPT) | โ Supported | Get API Key |
| Claude | โ Supported | Get API Key |
| Gemini | โ Supported | Get API Key |
| Grok | ๐๏ธ Coming Soon | Get API Key |
| Kimi | ๐๏ธ Coming Soon | Get API Key |
๐ What You Need to Know
For Complete Beginners:
- This is an automated trading bot that trades cryptocurrency futures on Binance
- It uses AI (LLM) and machine learning to make trading decisions
- Test mode lets you practice with virtual money before risking real funds
- The bot runs 24/7 and makes decisions based on market analysis
Technical Level: Intermediate Python knowledge recommended but not required for basic usage.
๐ Quick Start (One-Click Installation)
๐ฏ Recommended: One-Click Installation
No need to manually configure Python environment! Use our automated installation scripts:
Method 1: Local Installation (Development)
# 1. Clone the project
git clone <your-repo-url>
cd LLM-TradeBot
# 2. One-click install
chmod +x install.sh
./install.sh
# 3. Configure API keys
vim .env # Edit and add your API keys
# 4. One-click start
./start.shVisit Dashboard: http://localhost:8000
Method 2: Docker Deployment (Production)
# 1. Clone the project
git clone <your-repo-url>
cd LLM-TradeBot
# 2. Configure environment
cp .env.example .env
vim .env # Edit and add your API keys
# 3. One-click start
cd docker && docker-compose up -d๐ Detailed Guide: See QUICKSTART.md
โ๏ธ Prerequisites
Before you start, make sure you have:
For One-Click Installation (Recommended)
- โ Git installed (Download here)
- โ Python 3.11+ OR Docker (installation script will check)
For Test Mode (Beginners)
- โ Nothing else needed! Test mode uses virtual balance
For Live Trading (Advanced)
- โ Binance Account (Sign up here)
- โ Binance Futures API Keys with trading permissions
- โ USDT in Futures Wallet (minimum $100 recommended)
โ ๏ธ Risk Warning: Only trade with money you can afford to lose
๐ง LLM Configuration (Multi-Provider Support)
The bot supports 8 LLM providers. Configure via environment variables or Dashboard Settings:
Supported Providers
| Provider | Model | Cost | Speed | Get API Key |
|---|---|---|---|---|
| DeepSeek (Recommended) | deepseek-chat | ๐ฐ Low | โก Fast | platform.deepseek.com |
| OpenAI | gpt-4o, gpt-4o-mini | ๐ฐ๐ฐ๐ฐ High | โก Fast | platform.openai.com |
| Claude | claude-3-5-sonnet | ๐ฐ๐ฐ Medium | โก Fast | console.anthropic.com |
| Qwen | qwen-turbo, qwen-plus | ๐ฐ Low | โก Fast | dashscope.console.aliyun.com |
| Gemini | gemini-1.5-pro | ๐ฐ Low | โก Fast | aistudio.google.com |
| Kimi | moonshot-v1-8k | ๐ฐ Low | โก Fast | platform.moonshot.ai |
| MiniMax | MiniMax-M2.1 | ๐ฐ Low | โก Fast | platform.minimax.io |
| GLM | glm-4-flash | ๐ฐ Low | โก Fast | open.bigmodel.cn |
Configuration Methods
Method 1: Environment Variables (Recommended)
Edit your .env file:
# Select LLM Provider (required)
LLM_PROVIDER=deepseek # Options: deepseek, openai, claude, qwen, gemini, kimi, minimax, glm
# Configure API Key for your selected provider
DEEPSEEK_API_KEY=sk-xxx # if using DeepSeek
OPENAI_API_KEY=sk-xxx # if using OpenAI
CLAUDE_API_KEY=sk-xxx # if using Claude
QWEN_API_KEY=sk-xxx # if using Qwen
GEMINI_API_KEY=xxx # if using Gemini
KIMI_API_KEY=sk-xxx # if using Kimi
MINIMAX_API_KEY=sk-xxx # if using MiniMax
GLM_API_KEY=sk-xxx # if using GLMMethod 2: Dashboard Settings
- Open Dashboard at
http://localhost:8000 - Click โ๏ธ Settings โ API Keys tab
- Select your preferred LLM provider and enter API key
- Click Save - changes apply on next trading cycle
Method 3: Config File (config.yaml)
llm:
provider: "deepseek" # or: openai, claude, qwen, gemini, kimi, minimax, glm
model: "deepseek-chat" # provider-specific model
temperature: 0.3
max_tokens: 2000
api_keys:
deepseek: "sk-xxx"
openai: "sk-xxx"
# ... other providers๐ Manual Installation (Advanced)
If you prefer manual setup:
1. Install Dependencies
pip install -r requirements.txt2. Configure Environment
# Copy environment variable template
cp .env.example .env
# Set API Keys
./set_api_keys.sh3. Configure Trading Parameters
# Copy config template
cp config.example.yaml config.yamlEdit config.yaml to set parameters:
- Trading pair (symbol)
- Max position size (max_position_size)
- Leverage (leverage)
- Stop loss/Take profit % (stop_loss_pct, take_profit_pct)
โ๏ธ Dashboard Settings
You can also configure all settings from the Dashboard:
Settings Modal with 4 tabs: API Keys (LLM Provider), Accounts (Multi-Account), Trading, Strategy (Prompt)
4. Start the Bot
Built-in modern real-time monitoring dashboard.
๐งช Test Mode (Recommended for beginners)
Simulates trading with virtual balance ($1000). No real trades executed.
# Start with test mode
python main.py --test --mode continuous๐ฅ๏ธ CLI Headless Mode (For Servers)
Run the bot without Web Dashboard, perfect for headless servers or terminal-only environments.
# Basic CLI mode (manual start required)
python main.py --test --headless
# Custom interval (1 minute cycles)
python main.py --test --headless --interval 1Features:
- โ No Web UI - runs entirely in terminal
- โ Rich formatted output with colors and tables
- โ Real-time price updates and trading decisions
- โ Account summary panel after each cycle
- โ Graceful shutdown with session statistics (Ctrl+C)
- โ Optimized log output (93% less verbose than Web mode)
Output Example:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ค LLM-TradeBot CLI - TEST MODE โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโ Cycle #1 | LINKUSDT, NEARUSDT โโโโโโโโโโโโ
๐ Analyzing LINKUSDT...
โ
Data ready: $13.29
โธ๏ธ HOLD | Confidence: 45.0%
Reason: No clear 1h trend
โญโโโโโโโโโโโโโโโ Account Summary โโโโโโโโโโโโโโโโโโโโฎ
โ ๐ฐ Equity: $1,000.00 โ
โ ๐ Available: $900.00 โ
โ ๐ PnL: $0.00 (0.00%) โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โณ Next cycle in 1.0 minutes...
๐ Simplified CLI Mode (Live Trading)
For production live trading, use the simplified CLI script that skips non-essential components:
# Activate virtual environment first
source venv/bin/activate
# Test mode - single run
python simple_cli.py --mode once
# Test mode - continuous (3-minute intervals)
python simple_cli.py --mode continuous --interval 3
# LIVE mode - continuous trading (โ ๏ธ REAL MONEY)
python simple_cli.py --mode continuous --interval 3 --live
# Custom symbols (overrides .env)
python simple_cli.py --mode continuous --symbols BTCUSDT,ETHUSDT --live
# AUTO3 mode - automatic symbol selection
python simple_cli.py --mode continuous --symbols AUTO3 --liveFeatures:
- โ Minimal footprint - only core trading components loaded
- โ Production-ready - designed for stable 24/7 operation
- โ AUTO3 support - automatic best symbol selection via backtest
- โ LLM integration - full multi-agent decision system
- โ Risk management - built-in risk audit and position limits
- โ Graceful shutdown - Ctrl+C for clean exit
Configuration:
The script reads trading symbols from .env file by default:
# In your .env file
TRADING_SYMBOLS=BTCUSDT,ETHUSDT
# Or use AUTO3 for automatic selection
TRADING_SYMBOLS=AUTO3- Valid Binance Futures API keys in
.env - Sufficient USDT balance in Futures wallet
- API permissions: Read + Futures Trading enabled
- DeepSeek/OpenAI API key for LLM decisions
๐ด Live Trading Mode (Web Dashboard)
# Start live trading
python main.py --mode continuousPrerequisites for Live Trading:
- Valid Binance Futures API keys configured in
.env- Sufficient USDT balance in Futures wallet
- API permissions: Read + Futures Trading enabled
After startup, visit: http://localhost:8000 (or use our Cloud Hosting)
Dashboard Features:
-
๐งช๐ฐ Test/Live Mode Toggle: Quick switch between paper trading and real trading with visual confirmation
-
๐ Real-time Balance Curve: Fixed initial balance with PnL-driven current balance
-
๐ฌ Agent Chatroom: Per-cycle multi-agent outputs with Decision Core final action
-
๐งญ Multi-Period Summary: Alignment snapshot from 1h/15m/5m signals
-
๐งฉ Agent Config Tabs: Per-agent parameters + optional system prompts
-
๐ Trade History: Complete record of all trades with Open/Close cycles and PnL statistics
-
๐ Live Log Output: Real-time scrolling logs with agent documentation sidebar, simplified/detailed mode toggle
๐ Recent Decisions Indicator Guide
All indicators use semantic icons and two-line display format for quick visual scanning:
๐ System Columns
- Time: Decision timestamp
- Cycle: Trading cycle number
- Symbol: Trading pair (e.g., BTCUSDT)
โ๏ธ Critic (Decision Core)
- Result: Final action (LONG/SHORT/WAIT)
- Conf: Decision confidence (0-100%)
- Reason: Decision rationale (hover for full text)
๐จโ๐ฌ Strategist (Quant Analysis)
- 1h/15m/5m: Multi-timeframe signals
- Format:
T:UP(Trend) /O:DN(Oscillator) - Colors: Green (UP), Red (DN), Gray (NEU)
- Format:
- Sent: Sentiment score with icon (๐/๐/โ)
๐ฎ Prophet (ML Prediction)
- Format:
๐ฎโ+65% - Direction: โUP (>55%), โNEU (45-55%), โDN (<45%)
๐๐ป Bull/Bear (Adversarial Analysis)
- Bull:
โBull/๐ฅBull+ confidence % - Bear:
โBear/๐ฅBear+ confidence % - Stance: ๐ฅStrong, โSlight, โNeutral, โUnclear
๐ Context (Market State)
- Regime:
๐UP/๐DN/ใฐ๏ธCHOP - Position:
๐HIGH/โMID/๐ปLOW+ percentage
๐ก๏ธ Guardian (Risk Control)
- Risk:
โ SAFE/โ ๏ธWARN/๐จDANGER - Guard:
โ PASS/โBLOCK(with reason on hover) - Aligned: โ Multi-period aligned / โ Not aligned
5. Common Operations
# Stop the bot
pkill -f "python main.py"
# Restart the bot (Test Mode)
pkill -f "python main.py"; sleep 2; python main.py --test --mode continuous
# View running processes
ps aux | grep "python main.py"
# View logs in terminal (if running in background)
tail -f logs/trading_$(date +%Y%m%d).log๐ Project Structure
Directory Description
LLM-TradeBot/
โโโ src/ # Core Source Code
โ โโโ agents/ # Multi-Agent Definitions (DataSync, Quant, Decision, Risk)
โ โโโ api/ # Binance API Client
โ โโโ data/ # Data Processing (processor, validator)
โ โโโ exchanges/ # ๐ Multi-Account Exchange Abstraction
โ โ โโโ base.py # BaseTrader ABC + Data Models
โ โ โโโ binance_trader.py # Binance Futures Implementation
โ โ โโโ factory.py # Exchange Factory
โ โ โโโ account_manager.py # Multi-Account Manager
โ โโโ execution/ # Order Execution Engine
โ โโโ features/ # Feature Engineering
โ โโโ llm/ # ๐ Multi-LLM Interface
โ โ โโโ base.py # BaseLLMClient ABC
โ โ โโโ openai_client.py # OpenAI Implementation
โ โ โโโ deepseek_client.py # DeepSeek Implementation
โ โ โโโ claude_client.py # Anthropic Claude
โ โ โโโ qwen_client.py # Alibaba Qwen
โ โ โโโ gemini_client.py # Google Gemini
โ โ โโโ factory.py # LLM Factory
โ โโโ monitoring/ # Monitoring & Logging
โ โโโ risk/ # Risk Management
โ โโโ strategy/ # LLM Decision Engine
โ โโโ utils/ # Utilities (DataSaver, TradeLogger, etc.)
โ
โโโ docs/ # Documentation
โ โโโ data_flow_analysis.md # Data Flow Analysis
โ โโโ ScreenShot_2026-01-21_003126_160.png # Dashboard
โ โโโ Backtesting.png # Backtesting UI
โ
โโโ data/ # Structured Data Storage (Archived by Date)
โ โโโ market_data/ # Raw K-Line Data
โ โโโ indicators/ # Technical Indicators
โ โโโ features/ # Feature Snapshots
โ โโโ decisions/ # Final Decision Results
โ โโโ execution/ # Execution Records
โ
โโโ config/ # Configuration Files
โ โโโ accounts.example.json # ๐ Multi-Account Config Template
โ
โโโ logs/ # System Runtime Logs
โโโ tests/ # Unit Tests
โ
โโโ main.py # Main Entry Point (Multi-Agent Loop)
โโโ config.yaml # Trading Parameters
โโโ .env # API Key Configuration
โโโ requirements.txt # Python Dependencies
๐ฏ Core Architecture
Multi-Agent Collaborative Framework + Four-Layer Strategy
The system uses a Four-Layer Strategy Filter with a multi-agent pipeline. Core agents are always enabled, while optional agents can be configured via Dashboard or config.yaml.
Key Feature: Agents have LLM and Local variants - LLM versions use AI for semantic analysis, while Local versions use fast rule-based heuristics.
Core Agents (Always Enabled)
| Agent | Role | Responsibility |
|---|---|---|
| ๐ต๏ธ DataSyncAgent | The Oracle | Async concurrent fetch of 5m/15m/1h K-lines, ensuring snapshot consistency |
| ๐จโ๐ฌ QuantAnalystAgent | The Strategist | Generates trend scores, oscillators, sentiment, and OI Fuel (Volume Proxy) |
| ๐ก๏ธ RiskAuditAgent | The Guardian | Risk audit with absolute veto power on all trades |
| ๐งญ MultiPeriodParserAgent | The Summarizer | Multi-period alignment summary for Decision Core |
Symbol Selection Layer (Optional)
| Agent | Role | Responsibility |
|---|---|---|
| ๐ฐ SymbolSelectorAgent | AUTO1/3 Selector | Two-stage backtest selection: AI500 Top10 + Majors โ Top 5 (1h) โ Top 2 (15m) |
Prediction & Analysis Layer (Optional)
| Agent | Role | Responsibility |
|---|---|---|
| ๐ฏ PredictAgent | The Prophet | Predicts price probability using LightGBM ML model (auto-retrain every 2h) |
| ๐ค AIPredictionFilterAgent | AI Validator | AI-Trend alignment verification with veto power |
| ๐ฎ RegimeDetectorAgent | Regime Analyzer | Detects market state (Trending/Choppy/Ranging) and ADX strength |
| ๐ PositionAnalyzerAgent | Position Tracker | Price position analysis (High/Mid/Low zone) and S/R level detection |
| โก TriggerDetectorAgent | Entry Scanner | 5m pattern detection and trigger signal scoring |
Semantic Analysis Layer (LLM or Local)
| Agent | LLM Version | Local Version | Responsibility |
|---|---|---|---|
| ๐ TrendAgent | TrendAgentLLM |
TrendAgent |
1h trend semantic analysis (UPTREND/DOWNTREND) |
| ๐ SetupAgent | SetupAgentLLM |
SetupAgent |
15m setup zone analysis (KDJ, Bollinger Bands, entry zones) |
| ๐ฅ TriggerAgent | TriggerAgentLLM |
TriggerAgent |
5m trigger signal analysis (CONFIRMED/WAITING) |
Decision & Execution Layer
| Agent | Role | Responsibility |
|---|---|---|
| โ๏ธ DecisionCoreAgent | The Critic | Aggregates multi-agent outputs into a final action |
| ๐ ExecutionEngine | The Executor | Precision order execution and state management |
| ๐ช ReflectionAgent | The Philosopher | Trade reflection every 10 trades (LLM or Local variant) |
Agent Configuration
Agents can be configured in multiple ways (priority order):
- Dashboard Settings โ Agents tab with checkboxes for each optional agent
- Environment Variables โ
AGENT_<NAME>=true/false(e.g.,AGENT_PREDICT_AGENT=false) - config.yaml โ
agents:section
# config.yaml example
agents:
# Prediction & Analysis
predict_agent: true # ML probability prediction
ai_prediction_filter_agent: true # AI veto mechanism
regime_detector_agent: true # Market state detection
position_analyzer_agent: false # Price position analysis
trigger_detector_agent: true # 5m pattern detection
# Semantic Analysis - LLM variants (expensive, disabled by default)
trend_agent_llm: false # 1h trend LLM analysis
setup_agent_llm: false # 15m setup LLM analysis
trigger_agent_llm: false # 5m trigger LLM analysis
# Semantic Analysis - Local variants (fast, enabled by default)
trend_agent_local: true # 1h trend rule-based analysis
setup_agent_local: true # 15m setup rule-based analysis
trigger_agent_local: true # 5m trigger rule-based analysis
# Reflection
reflection_agent_llm: false # Trade reflection via LLM
reflection_agent_local: true # Trade reflection via rules
# Symbol Selection
symbol_selector_agent: true # AUTO symbol selectionFour-Layer Strategy Filter
Layer 1: Trend + Fuel (1h EMA + Volume Proxy)
โ PASS/FAIL
Layer 2: AI Filter (PredictAgent direction alignment)
โ PASS/VETO
Layer 3: Setup (15m KDJ + Bollinger Bands entry zone)
โ READY/WAIT
Layer 4: Trigger (5m Pattern + RVOL volume confirmation)
โ CONFIRMED/WAITING
โ
๐ง LLM Decision (DeepSeek Bull/Bear Debate)
โ
๐ก๏ธ Risk Audit (Veto Power)
โ
๐ Execution
Data Flow Diagrams
๐ See System Architecture Overview section above for visual diagrams.
๐ Mermaid Diagram (Interactive)
graph TB
subgraph "1๏ธโฃ Data Collection Layer"
A["๐ต๏ธ DataSyncAgent<br/>(The Oracle)"] --> MS["MarketSnapshot<br/>5m/15m/1h K-lines"]
end
subgraph "2๏ธโฃ Quant Analysis Layer"
MS --> QA["๐จโ๐ฌ QuantAnalystAgent<br/>(The Strategist)"]
QA --> TS["๐ TrendSubAgent"]
QA --> OS["๐ OscillatorSubAgent"]
QA --> SS["๐น SentimentSubAgent"]
TS & OS & SS --> QR["Quant Signals"]
end
subgraph "3๏ธโฃ Prediction Layer"
MS --> PA["๐ฎ PredictAgent<br/>(The Prophet)"]
PA --> ML["LightGBM Model<br/>Auto-Train 2h"]
ML --> PR["P_Up Prediction"]
end
subgraph "4๏ธโฃ Bull/Bear Adversarial Layer"
MS --> BULL["๐ Bull Agent<br/>(The Optimist)"]
MS --> BEAR["๐ป Bear Agent<br/>(The Pessimist)"]
BULL --> BP["Bull Perspective"]
BEAR --> BRP["Bear Perspective"]
end
subgraph "5๏ธโฃ Reflection Layer"
TH["๐ Trade History<br/>Last 10 Trades"] --> REF["๐ง ReflectionAgent<br/>(The Philosopher)"]
REF --> RI["Reflection Insights<br/>Patterns & Recommendations"]
end
subgraph "6๏ธโฃ Decision Layer"
QR & PR & BP & BRP & RI --> DC["โ๏ธ DecisionCoreAgent<br/>(The Critic)"]
DC --> RD["RegimeDetector"]
DC --> POS["PositionAnalyzer"]
RD & POS --> VR["VoteResult<br/>Action + Confidence"]
end
subgraph "7๏ธโฃ Risk Audit Layer"
VR --> RA["๐ก๏ธ RiskAuditAgent<br/>(The Guardian)"]
RA --> AR["AuditResult<br/>Risk Level + Guard"]
end
subgraph "8๏ธโฃ Execution Layer"
AR --> EE["๐ ExecutionEngine<br/>(The Executor)"]
EE -.->|"Trade Complete"| TH
end
%% Styling for Agent Nodes
style A fill:#4A90E2,color:#fff,stroke:#2563EB,stroke-width:2px
style QA fill:#7ED321,color:#fff,stroke:#059669,stroke-width:2px
style PA fill:#BD10E0,color:#fff,stroke:#9333EA,stroke-width:2px
style BULL fill:#F8E71C,color:#333,stroke:#CA8A04,stroke-width:2px
style BEAR fill:#F8E71C,color:#333,stroke:#CA8A04,stroke-width:2px
style REF fill:#00CED1,color:#fff,stroke:#0891B2,stroke-width:2px
style DC fill:#F5A623,color:#fff,stroke:#EA580C,stroke-width:2px
style RA fill:#D0021B,color:#fff,stroke:#DC2626,stroke-width:2px
style EE fill:#9013FE,color:#fff,stroke:#7C3AED,stroke-width:2px
%% Styling for Output Nodes
style MS fill:#1E3A5F,color:#fff
style QR fill:#1E3A5F,color:#fff
style PR fill:#1E3A5F,color:#fff
style BP fill:#1E3A5F,color:#fff
style BRP fill:#1E3A5F,color:#fff
style RI fill:#1E3A5F,color:#fff
style VR fill:#1E3A5F,color:#fff
style AR fill:#1E3A5F,color:#fff
style TH fill:#1E3A5F,color:#fff
๐ Detailed Docs: See Data Flow Analysis for complete mechanisms.
๐งช Backtesting
Professional-grade backtesting system for strategy validation before live trading:
Features:
- ๐ Multi-Tab Parallel Backtests: Run up to 5 backtests simultaneously with independent configurations
- ๐ Real-time Progress: Live equity curve, drawdown chart, and trade markers
- ๐ฏ LLM-Enhanced Mode: Test the full multi-agent decision system including DeepSeek analysis
- ๐ Flexible Date Ranges: Quick presets (1/3/7/14/30 days) or custom date selection
- โ๏ธ Advanced Parameters: Configurable leverage, stop-loss, take-profit, and trailing stops
- ๐ Detailed Metrics: Total return, Sharpe/Sortino ratios, win rate, max drawdown, and more
- ๐พ Full Logging: All decisions and LLM interactions saved for analysis
Access: Visit http://localhost:8000/backtest after starting the bot.
๐ Full-Link Data Auditing
Storage Organization
The system automatically records intermediate processes for each cycle in the data/ directory, organized by date for easy review and debugging:
data/
โโโ market_data/ # Raw Multi-Timeframe K-Lines
โ โโโ {date}/
โ โโโ BTCUSDT_5m_{timestamp}.json
โ โโโ BTCUSDT_5m_{timestamp}.csv
โ โโโ BTCUSDT_5m_{timestamp}.parquet
โ โโโ BTCUSDT_15m_{timestamp}.json
โ โโโ BTCUSDT_1h_{timestamp}.json
โ
โโโ indicators/ # Full Technical Indicators DataFrames
โ โโโ {date}/
โ โโโ BTCUSDT_5m_{snapshot_id}.parquet
โ โโโ BTCUSDT_15m_{snapshot_id}.parquet
โ โโโ BTCUSDT_1h_{snapshot_id}.parquet
โ
โโโ features/ # Feature Snapshots
โ โโโ {date}/
โ โโโ BTCUSDT_5m_{snapshot_id}_v1.parquet
โ โโโ BTCUSDT_15m_{snapshot_id}_v1.parquet
โ โโโ BTCUSDT_1h_{snapshot_id}_v1.parquet
โ
โโโ context/ # Quant Analysis Summary
โ โโโ {date}/
โ โโโ BTCUSDT_quant_analysis_{snapshot_id}.json
โ
โโโ llm_logs/ # LLM Input Context & Voting Process
โ โโโ {date}/
โ โโโ BTCUSDT_{snapshot_id}.md
โ
โโโ decisions/ # Final Weighted Vote Results
โ โโโ {date}/
โ โโโ BTCUSDT_{snapshot_id}.json
โ
โโโ execution/ # Execution Tracking
โโโ {date}/
โโโ BTCUSDT_{timestamp}.json
Data Formats
- JSON: Human-readable, used for configuration and decision results
- CSV: High compatibility, easy for Excel import
- Parquet: Efficient compression, used for large-scale time-series data
๐ก๏ธ Safety Warning
- API Keys: Keep them safe, DO NOT commit to version control.
- Test First: Use
--testargument to run simulations first. - Risk Control: Set reasonable stop-loss and position limits in
config.yaml. - Minimal Permissions: Grant only necessary Futures Trading permissions to API keys.
- Monitoring: Regularly check the
logs/directory for anomalies.
๐ Documentation Navigation
| Document | Description |
|---|---|
| README.md | Project Overview & Quick Start |
| Data Flow Analysis | Complete Data Flow Mechanisms |
| API Key Guide | API Key Configuration Guide |
| Config Example | Trading Parameters Template |
| Env Example | Environment Variables Template |
๐ Latest Updates
2026-02-07:
- โ Multi-Agent Chatroom: Per-cycle agent outputs with Decision Core final action.
- โ Agent Config Tabs: Per-agent parameters + optional system prompts in the UI.
- โ LLM Toggle (default off): Enables LLM only when key is provided.
- โ Multi-Period Parser: 1h/15m/5m alignment summarized for Decision Core.
- โ Balance & PnL Fixes: Initial balance fixed, PnL-driven current balance.
2026-01-07:
- โ
AUTO3 Two-Stage Symbol Selection: Enhanced
SymbolSelectorAgentwith two-stage filtering.- Stage 1 (Coarse Filter): 1h backtest on AI500 Top10 + Major coins (~16 symbols) โ Top 5
- Stage 2 (Fine Filter): 15m backtest on Top 5 โ Top 2 performers
- Expanded candidate pool: AI500 (30+ AI/Data coins) + Majors (BTC, ETH, SOL, BNB, XRP, DOGE)
- Auto-refresh every 6 hours with smart caching
- โ
BacktestAgentRunner Parity: Full consistency between backtest and live trading environments.
- Risk Audit Agent integrated into backtest flow
- Four-Layer Strategy Filter applied in backtests
- Position analysis and regime detection enabled
- โ
Enhanced Backtest CLI:
python backtest.pywith support for:- Multi-symbol backtesting
- Agent strategy mode (
--strategy-mode agent) - LLM enhancement option (
--use-llm) - Detailed HTML reports with equity curves
2025-12-31:
- โ
Full Chinese Internationalization (i18n): Complete bilingual support with language toggle button.
- Dashboard UI elements (headers, tables, buttons) fully translated
- Agent documentation sidebar with Chinese descriptions
- Seamless language switching without page reload
2025-12-28:
- โ Dashboard Log Mode Toggle: Switch between Simplified (agent summaries) and Detailed (full debug) log views.
- โ Net Value Curve Enhancement: Smart x-axis labels that adapt to data volume while preserving first cycle timestamp.
2025-12-25:
- โ ReflectionAgent (The Philosopher): New agent that analyzes every 10 trades and provides insights to improve future decisions.
- โ Trading Retrospection: Automatic pattern detection, confidence calibration, and actionable recommendations.
- โ Decision Integration: Reflection insights are injected into Decision Agent prompts for continuous learning.
2025-12-24:
- โ Multi-LLM Support: Added support for 8 LLM providers (DeepSeek, OpenAI, Claude, Qwen, Gemini, Kimi, MiniMax, GLM) with unified interface.
- โ Dashboard LLM Settings: Switch LLM provider and API keys directly from Dashboard Settings.
- โ
Multi-Account Architecture: New
src/exchanges/module withBaseTraderabstraction for multi-exchange support. - โ
Account Manager: Manage multiple trading accounts via Dashboard or
config/accounts.json.
2025-12-21:
- โ
ML Model Upgrade: Upgraded
PredictAgentto use LightGBM machine learning model. - โ Auto-Training: Implemented automatic model retraining every 2 hours to adapt to market drifts.
- โ Dashboard Refinement: Enhanced dashboard with auto-scrolling logs, robust scrollbars, and ML probability display.
2025-12-20:
- โ
Adversarial Decision Framework: Introduced
PositionAnalyzerandRegimeDetector. - โ Confidence Score Refactor: Implemented dynamic confidence penalties.
- โ Full-Link Auditing: Implemented complete intermediate state archiving.
โ Frequently Asked Questions (FAQ)
For Beginners
Q: Is this safe to use? Will I lose money?
A: Test mode is 100% safe - it uses virtual money. For live trading, only use funds you can afford to lose. Cryptocurrency trading is risky.
Q: Do I need to know Python to use this?
A: No! Just follow the Quick Start guide. You only need Python installed, not programming knowledge.
Q: How much money do I need to start?
A: Test mode is free. For live trading, minimum $100 USDT recommended, but start small while learning.
Q: Will the bot trade 24/7?
A: Yes, once started in continuous mode, it runs non-stop analyzing markets and making decisions.
Q: How do I know if it's working?
A: Open http://localhost:8000 in your browser to see the real-time dashboard with live logs and charts.
Technical Questions
Q: Which exchanges are supported?
A: Currently only Binance Futures. Spot trading and other exchanges are not supported.
Q: Can I customize the trading strategy?
A: Yes! Edit config.yaml for basic parameters. Advanced users can modify agent logic in src/ directory.
Q: What's the difference between Test and Live mode?
A: Test mode simulates trading with $1000 virtual balance. Live mode executes real trades on Binance.
Q: How do I stop the bot?
A: Press Ctrl+C in the terminal, or run pkill -f "python main.py"
Q: Why is the dashboard not loading?
A: Make sure the bot is running and visit http://localhost:8000. Check firewall settings if issues persist.
Troubleshooting
Q: "ModuleNotFoundError" when starting
A: Run pip install -r requirements.txt to install all dependencies.
Q: "API Key invalid" error
A: Check your .env file has correct Binance API keys. For test mode, API keys are optional.
Q: Bot keeps saying "WAIT" and not trading
A: This is normal! The bot is conservative and only trades when conditions are favorable. Check the dashboard logs for reasoning.
Q: How do I update to the latest version?
A: Run git pull origin main then restart the bot.
๐ค Contribution
Issues and Pull Requests are welcome!
This project is licensed under the MIT License. See the LICENSE file for details.
Empowered by AI, Focused on Precision, Starting a New Era of Intelligent Quant! ๐


