feat(data): 恢复双源(task#79)—撮合raw+策略qfq, 分红除权准确
用户要模拟=回测准确: raw除权缺口致MA假信号, 必须双源。
- data_source: qfq→qfq_dir(干净qfq), raw→raw_dir; _check_adjust_cfg(cfg提供才校验)
- engine 双bar流: step(raw_bars,qfq_bars)撮合/盯市raw+策略on_bar qfq; run zip(raw,qfq)
- live_orchestrator: warmup用qfq(信号am); 去adjust参数(双源固定)
- raw_redownload --adjust(''raw/'qfq'); config qfq_dir
- 113/113通过
This commit is contained in:
@@ -101,12 +101,12 @@ def test_engine_step_single_bar_advances(tmp_path):
|
||||
]
|
||||
pe, db, aid, account, runner = _build(tmp_path, sections)
|
||||
# day1 step:_AlwaysBuyStrategy 买单(NEXT_OPEN)→ 进 pending,当根不撮合
|
||||
pending, closes = pe.step("2024-01-01", sections[0][1], {}, [])
|
||||
pending, closes = pe.step("2024-01-01", sections[0][1], sections[0][1], {}, [])
|
||||
assert len(pending) == 1
|
||||
assert account.positions.get("600000") is None
|
||||
assert closes["600000"] == 10.0
|
||||
# day2 step:撮合 day1 pending @ open 10.5;策略 on_bar(day2) 又发单进 pending 等 day3
|
||||
pending2, closes2 = pe.step("2024-01-02", sections[1][1], closes, pending)
|
||||
pending2, closes2 = pe.step("2024-01-02", sections[1][1], sections[1][1], closes, pending)
|
||||
assert len(pending2) == 1 # day2 新信号(无 day3 不撮合)
|
||||
assert account.positions["600000"].volume == 100 # day1 单 day2 open 10.5 撮合 100 股
|
||||
# step 入库(day1+day2 各一条余额)
|
||||
|
||||
Reference in New Issue
Block a user