Skip to content

zinan92/executor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

executor

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.

Pipeline Position

01 kline -> 02 intel -> 03 signal -> 04 copilot -> 05 backtest
                                  -> 06 risk -> [07 executor] -> 08 journal

Capabilities

  • 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)

Error Handling

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

Credential Policy

  • 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

Source

Adapted from tradinghouse/src/execution/executor.py + clients/exchange_client.py. Existing code has dry_run + live mode with Hyperliquid target.

Tech Stack

Python 3.11+ | FastAPI | httpx (async) | SQLAlchemy

Status

Scaffolding. Core logic exists in tradinghouse, migration pending. Start with Alpaca Paper Trading sandbox.

About

执行引擎。in 交易计划 → out API下单+执行确认

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors