Phase 5 plan replay backtest

This commit is contained in:
Codex
2026-05-06 15:35:21 +08:00
parent 79e21aeee4
commit 16f319a603
12 changed files with 900 additions and 18 deletions
@@ -0,0 +1,24 @@
alter table if exists backtest_runs
add column if not exists subject_type text,
add column if not exists trading_plan_id bigint references trading_plans(id),
add column if not exists candidate_model_code text;
update backtest_runs
set subject_type = coalesce(subject_type, 'signal');
create index if not exists idx_backtest_runs_subject_started_desc
on backtest_runs (subject_type, started_ts desc);
create index if not exists idx_backtest_runs_plan_started_desc
on backtest_runs (trading_plan_id, started_ts desc);
alter table if exists backtest_results
add column if not exists trading_plan_id bigint references trading_plans(id),
add column if not exists candidate_id bigint references trade_plan_candidates(id),
add column if not exists candidate_model_code text;
create index if not exists idx_backtest_results_plan_id
on backtest_results (trading_plan_id, id desc);
create index if not exists idx_backtest_results_candidate_id
on backtest_results (candidate_id, id desc);