- Add CompositeEngine for backtesting portfolios spanning multiple markets (e.g. A-shares + crypto) with a single shared capital pool - Extract on_bar logic (funding fee, liquidation, swap) into _market_hooks.py as pure functions, called by both original engines and CompositeEngine - Fix _align() signal shift bug: shift on each symbol's own trading calendar then ffill to unified dates (prevents Monday close-and-reopen for A-shares) - Add calendar-day annualization for cross-market Sharpe calculation - Add cross-market-strategy skill with vol-adjusted weighting example - Update all READMEs (en/zh/ja/ko/ar): news, 69 skills, composite engine - Update test imports for extracted _market_hooks functions
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
"""Backtest engines.
|
|
|
|
Wave 1 (v1):
|
|
- BaseEngine: ABC for bar-by-bar execution with market rules
|
|
- ChinaAEngine: A-share (T+1, no short, price limits)
|
|
- GlobalEquityEngine: US / HK equities
|
|
- CryptoEngine: Crypto perpetuals (funding fees, liquidation)
|
|
- options_portfolio: European/American options (Black-Scholes, v2 with IV smile)
|
|
|
|
Wave 2:
|
|
- FuturesBaseEngine: intermediate layer adding contract-multiplier logic
|
|
- ChinaFuturesEngine: China commodity/financial futures (CFFEX/SHFE/DCE/ZCE/INE)
|
|
- GlobalFuturesEngine: International futures (CME/ICE/Eurex)
|
|
- ForexEngine: FX spot/CFD (spread, swap, high leverage)
|
|
|
|
Wave 3:
|
|
- CompositeEngine: Cross-market engine with shared capital pool
|
|
- _market_hooks: Extracted on_bar logic (funding, liquidation, swap)
|
|
|
|
Inheritance:
|
|
BaseEngine
|
|
├── ChinaAEngine
|
|
├── GlobalEquityEngine
|
|
├── CryptoEngine
|
|
├── ForexEngine
|
|
├── CompositeEngine (delegates to sub-engines as rule providers)
|
|
└── FuturesBaseEngine
|
|
├── ChinaFuturesEngine
|
|
└── GlobalFuturesEngine
|
|
"""
|