Close RQAlpha P0-P2 parity gaps
This commit is contained in:
@@ -40,19 +40,19 @@ Confirmed aligned areas:
|
||||
close-today/close-yesterday, daily mark-to-market settlement, expiration
|
||||
settlement, and runtime account views.
|
||||
|
||||
Remaining parity gaps found by this pass:
|
||||
Parity gaps found by this pass and current closure state:
|
||||
|
||||
| Priority | Gap | RQAlpha capability | Current engine state | Next implementation |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| P0 | Futures intraday matching | Bar/tick matchers support futures orders through the same broker lifecycle, matching type, slippage, price limit, liquidity limit, volume limit, partial fill, and market-close rejection semantics. | Futures orders execute immediately from `FuturesOrderIntent` with explicit price and cost; they do not flow through the stock broker's pending/open-order matcher. | Add a futures broker/matcher path or generalize `BrokerSimulator` so futures intents can be market/limit/algo orders matched by bar/tick/open auction data. |
|
||||
| P0 | Futures open-order lifecycle | `SimulationBroker` keeps pending orders, supports `get_open_orders`, cancellation, before-trading activation, tick/bar rematching, and after-trading rejection. | Stock orders have open-order lifecycle; futures orders only emit immediate process/order/fill events. | Add futures pending limit orders, cancellation by id/symbol/all, open-order views, final order lookup, and market-close rejection. |
|
||||
| P0 | Combined multi-account NAV | RQAlpha portfolio aggregates account values across stock/future accounts. | `StrategyContext.accounts()` exposes both account views, but `DailyEquityPoint`, progress events, metrics, and holdings summary are still stock-portfolio based. | Add aggregate portfolio valuation that includes stock total equity plus futures account total value/margin/PnL, then compute metrics and progress from aggregate NAV. |
|
||||
| P1 | Futures trading parameter data source | RQAlpha loads contract multiplier, margin ratios, commission type, open/close/close-today commission ratios, settlement/prev-settlement, tick size, listed/de-listed dates, and dominant contracts from data proxy. | `FuturesContractSpec` and `transaction_cost` are passed manually in order intents; there is no data-source-backed trading-parameter resolver. | Add futures instrument/trading-parameter tables and resolver APIs, then let order creation derive spec, margin, tick size, settlement price, and costs automatically. |
|
||||
| P1 | Futures transaction cost decider | RQAlpha supports by-money/by-volume futures commission with separate open, close, and close-today rates and a commission multiplier. | Current futures execution accepts precomputed transaction cost and stores it; it does not calculate costs from contract metadata. | Implement `FuturesTransactionCostModel` backed by trading parameters and route all futures executions through it. |
|
||||
| P1 | Futures settlement price mode | RQAlpha can settle futures by `settlement` or `close`, including previous-settlement fields. | Current daily settlement accepts an injected settlement price map and expiration schedule; it does not automatically read settlement/prev_settlement series. | Extend data model with `settlement` and `prev_settlement` fields and support a configurable settlement price mode. |
|
||||
| P1 | Frontend risk validators for futures | RQAlpha applies cash/margin, position closable, price-limit, trading-status, and self-trade validators before order submission. | Stock path has comparable guardrails; futures margin/position checks exist inside account execution, but submission-time validators and self-trade checks are incomplete. | Add futures-aware validator layer before order acceptance and share diagnostics with order events. |
|
||||
| P2 | RQData helper APIs | RQAlpha exposes `get_dividend`, `get_split`, `get_yield_curve`, `get_factor`, `get_margin_stocks`, `get_securities_margin`, `get_dominant_future`, and dominant futures price APIs. | Core stock backtest APIs are implemented; these advanced helper APIs are not exposed by `StrategyContext`/DSL. | Add read-only data proxy methods first, then expose stable DSL/strategy functions where data is available. |
|
||||
| P2 | Analyzer/report parity | RQAlpha analyser can export richer trades, positions, benchmark, monthly returns, risk, and summary artifacts. | Engine returns metrics, equity curve, orders/fills/events/holdings, but not a full RQAlpha-style analyser artifact set. | Add normalized report builders on top of `BacktestResult` without changing execution semantics. |
|
||||
| P0 | Futures intraday matching | Bar/tick matchers support futures orders through the same broker lifecycle, matching type, slippage, price limit, liquidity limit, volume limit, partial fill, and market-close rejection semantics. | Closed for daily/open/close and tick-price futures fills, including limit checks and partial quantity handling. Full order-book-depth counterparty sweeping remains out of scope unless production strategies require it. | Keep extending matching detail only when real futures tick depth data is available. |
|
||||
| P0 | Futures open-order lifecycle | `SimulationBroker` keeps pending orders, supports `get_open_orders`, cancellation, before-trading activation, tick/bar rematching, and after-trading rejection. | Closed for futures pending limit orders, cross-day rematching, cancellation by id/symbol/all, and merged open-order runtime views. | Add more order status transitions only if UI requires RQAlpha's exact intermediate event names. |
|
||||
| P0 | Combined multi-account NAV | RQAlpha portfolio aggregates account values across stock/future accounts. | Closed. `DailyEquityPoint`, progress events, and metrics now use aggregate stock + futures initial cash and total equity. | None. |
|
||||
| P1 | Futures trading parameter data source | RQAlpha loads contract multiplier, margin ratios, commission type, open/close/close-today commission ratios, settlement/prev-settlement, tick size, listed/de-listed dates, and dominant contracts from data proxy. | Closed for engine-side trading-parameter ingestion/resolution via `futures_trading_parameters.csv` or component data. | Add more exchange metadata columns only when source data exposes them. |
|
||||
| P1 | Futures transaction cost decider | RQAlpha supports by-money/by-volume futures commission with separate open, close, and close-today rates and a commission multiplier. | Closed. `FuturesTransactionCostModel` calculates by-money/by-volume open/close/close-today costs from trading parameters. | None. |
|
||||
| P1 | Futures settlement price mode | RQAlpha can settle futures by `settlement` or `close`, including previous-settlement fields. | Closed. Engine supports configurable settlement price mode and resolves settlement/prev-settlement from factor fields with close/prev_close fallback. | Add dedicated settlement columns if the storage layer later separates them from factors. |
|
||||
| P1 | Frontend risk validators for futures | RQAlpha applies cash/margin, position closable, price-limit, trading-status, and self-trade validators before order submission. | Closed for zero quantity, invalid limit price, self-trade crossing risk, paused/no executable price, price-limit, margin, and close-position rejection diagnostics. | Add exchange-specific validators only as needed. |
|
||||
| P2 | RQData helper APIs | RQAlpha exposes `get_dividend`, `get_split`, `get_yield_curve`, `get_factor`, `get_margin_stocks`, `get_securities_margin`, `get_dominant_future`, and dominant futures price APIs. | Closed. These APIs are available through `DataSet` and `StrategyContext`, using existing corporate-action, factor, market, and futures-parameter data. | Wire any missing frontend DSL aliases separately if the script layer needs them. |
|
||||
| P2 | Analyzer/report parity | RQAlpha analyser can export richer trades, positions, benchmark, monthly returns, risk, and summary artifacts. | Closed for normalized trades, positions, equity curve, benchmark series, metrics, and JSON report bundle via `BacktestResult::analyzer_report(_json)`. | UI/service download endpoints can serialize this report directly. |
|
||||
| P3 | Mod/config/plugin architecture | RQAlpha has pluggable mods, event bus extension points, and many config toggles. | Engine has explicit Rust config and event/process records, not a full mod framework. | Only implement toggles required by production strategies; avoid recreating the whole RQAlpha mod system unless needed. |
|
||||
|
||||
## Remaining Gaps
|
||||
@@ -143,30 +143,30 @@ Remaining parity gaps found by this pass:
|
||||
positions at settlement price
|
||||
- [x] data-driven futures expiration schedule in `BacktestEngine` settlement
|
||||
phase
|
||||
- [ ] futures intraday matching integration
|
||||
- [ ] futures pending/open-order lifecycle and cancellation parity
|
||||
- [ ] aggregate multi-account NAV/metrics/progress across stock and futures
|
||||
- [ ] futures trading-parameter data source and automatic cost/margin resolver
|
||||
- [ ] futures settlement/prev-settlement data integration and settlement mode
|
||||
- [ ] futures-aware submission validators and self-trade checks
|
||||
- [x] futures intraday matching integration
|
||||
- [x] futures pending/open-order lifecycle and cancellation parity
|
||||
- [x] aggregate multi-account NAV/metrics/progress across stock and futures
|
||||
- [x] futures trading-parameter data source and automatic cost/margin resolver
|
||||
- [x] futures settlement/prev-settlement data integration and settlement mode
|
||||
- [x] futures-aware submission validators and self-trade checks
|
||||
|
||||
### Phase 10: Advanced data API parity
|
||||
|
||||
- [ ] `get_dividend`
|
||||
- [ ] `get_split`
|
||||
- [ ] `get_yield_curve`
|
||||
- [ ] `get_factor`
|
||||
- [ ] `get_margin_stocks`
|
||||
- [ ] `get_securities_margin`
|
||||
- [ ] `get_dominant_future`
|
||||
- [ ] futures dominant price helpers
|
||||
- [x] `get_dividend`
|
||||
- [x] `get_split`
|
||||
- [x] `get_yield_curve`
|
||||
- [x] `get_factor`
|
||||
- [x] `get_margin_stocks`
|
||||
- [x] `get_securities_margin`
|
||||
- [x] `get_dominant_future`
|
||||
- [x] futures dominant price helpers
|
||||
|
||||
### Phase 11: Analyzer / report parity
|
||||
|
||||
- [ ] RQAlpha-style normalized trades report
|
||||
- [ ] RQAlpha-style normalized positions report
|
||||
- [ ] benchmark / monthly returns / risk summary artifacts
|
||||
- [ ] downloadable analyser output bundle
|
||||
- [x] RQAlpha-style normalized trades report
|
||||
- [x] RQAlpha-style normalized positions report
|
||||
- [x] benchmark / monthly returns / risk summary artifacts
|
||||
- [x] downloadable analyser output bundle
|
||||
|
||||
## Execution Order
|
||||
|
||||
@@ -189,6 +189,6 @@ Remaining parity gaps found by this pass:
|
||||
|
||||
## Current Step
|
||||
|
||||
Active implementation target: close the P0 gaps found by the 2026-04-24
|
||||
re-audit. The next code target should be aggregate multi-account NAV/metrics,
|
||||
followed by futures intraday matching and futures pending-order lifecycle.
|
||||
Active implementation target: P0-P2 parity items are implemented in the engine
|
||||
core. Remaining future work should be driven by concrete production strategy or
|
||||
UI requirements rather than recreating RQAlpha's full plugin/mod framework.
|
||||
|
||||
Reference in New Issue
Block a user