Stage 07 | 执行引擎
in trade plan (from risk) -> out order execution via broker API + execution confirmation
Sends validated orders to exchange, manages order lifecycle, records execution results.
01 kline -> 02 intel -> 03 signal -> 04 copilot -> 05 backtest
-> 06 risk -> [07 executor] -> 08 journal
- Broker adapters:
- Alpaca Paper Trading (US equities, sandbox first)
- Binance (crypto)
- Hyperliquid (existing from tradinghouse)
- 东方财富/QMT (A-shares, TBD)
- dry_run mode: simulates fills locally without broker API
- Order lifecycle: place -> confirm/reject -> fill -> journal
- Automatic journal recording on every execution (success, rejected, error, wait)
Each adapter implements safe_mode fallback:
- If execution cannot confirm within N seconds: cancel pending order
- Emit HALT event to risk engine
- Send Telegram alert to operator
- All broker API keys in environment variables ONLY, never in code or config
- Alpaca keys: trade-only permissions, no fund transfer
- Binance keys: API-trading only, IP allowlist required
- Pre-commit hook scans for credential patterns
Adapted from tradinghouse/src/execution/executor.py + clients/exchange_client.py. Existing code has dry_run + live mode with Hyperliquid target.
Python 3.11+ | FastAPI | httpx (async) | SQLAlchemy
Scaffolding. Core logic exists in tradinghouse, migration pending. Start with Alpaca Paper Trading sandbox.