fix(live): live_step传qfq_bars对齐step双源签名(端到端跑通)
live_step当日补fetch_day qfq + step(today,raw,qfq,prev,pending)5参数对齐. 修前 step5参数 vs live_step4参数 missing pending(预存, c6b19f4双源后未对齐). 容器verify_live_step端到端跑通(live_step@2026-07-07, _restore_ledger不崩, 分红/占用成本加载OK). 139 passed.
This commit is contained in:
@@ -106,12 +106,16 @@ def live_step(db_path: str, account_id: int, data_source, cfg, today: str | None
|
||||
runner.paper_cta_engine.on_bar(wbars[runner.symbol])
|
||||
runner.paper_cta_engine.pop_orders() # warmup 单丢弃(不撮合)
|
||||
|
||||
# 4. 当日 raw bar(Mac launchd 已推 NAS)
|
||||
# 4. 当日 raw bar(撮合)+ qfq bar(策略 on_bar 信号)
|
||||
bars = {}
|
||||
qfq_bars = {}
|
||||
for sym in symbols:
|
||||
bar = data_source.fetch_day(sym, today, interval, adjust="raw", cfg=cfg)
|
||||
if bar is not None:
|
||||
bars[sym] = bar
|
||||
rbar = data_source.fetch_day(sym, today, interval, adjust="raw", cfg=cfg)
|
||||
if rbar is not None:
|
||||
bars[sym] = rbar
|
||||
qbar = data_source.fetch_day(sym, today, interval, adjust="qfq", cfg=cfg)
|
||||
if qbar is not None:
|
||||
qfq_bars[sym] = qbar
|
||||
if not bars:
|
||||
logger.info("live_step %s: 当日无 raw bar(%s 非交易日或未推?),跳过", account_id, today)
|
||||
return
|
||||
@@ -141,7 +145,7 @@ def live_step(db_path: str, account_id: int, data_source, cfg, today: str | None
|
||||
pe = PaperEngine(account, runners, data_source, acc_cfg, db_path, account_id,
|
||||
symbols, acc.get("start_date") or today, today, interval,
|
||||
risk_free_rate=getattr(cfg, "risk_free_rate", 0.0))
|
||||
pending_new, _closes = pe.step(today, bars, prev_close, pending)
|
||||
pending_new, _closes = pe.step(today, bars, qfq_bars, prev_close, pending)
|
||||
|
||||
# 6. 存状态(pending + positions)
|
||||
save_pending_orders(db_path, account_id, [
|
||||
|
||||
Reference in New Issue
Block a user