feat(web): M8.6b 回测页做实 + 首页入口更新(零新后端 API)

- backtest 页:成本参数表单(手续费/印花税/滑点 %)+ 初始资金 → ResearchSpec.costs/
  initial_capital;结果新增年度收益卡与成交明细表(买/卖日、买/卖价、收益、累计换手)
- Dashboard 入口卡加入「股票筛选」「交易信号」(6 张)
- lib/types.ts:ResearchSpec 增加 price_adjustment/costs/portfolio/initial_capital,
  Trade 补 entry_price/exit_price
- 页面 200 冒烟 + tsc --noEmit 通过
This commit is contained in:
Simon
2026-09-09 00:41:49 +08:00
parent e1ac23fa25
commit e5a23f176d
3 changed files with 102 additions and 1 deletions
+10 -1
View File
@@ -27,9 +27,18 @@ export interface ResearchSpec {
min_listing_days?: number;
symbols?: string[];
};
price_adjustment?: "none" | "qfq";
factors: { name: string; weight: number }[];
selection: { top_n: number };
rebalance: "weekly" | "monthly";
costs?: {
commission_rate?: number;
stamp_tax_rate?: number;
slippage_rate?: number;
benchmark?: string;
};
portfolio?: { weighting?: string; max_position_pct?: number | null; max_industry_weight_pct?: number | null };
initial_capital?: number;
period: [string, string];
}
@@ -60,7 +69,7 @@ export interface BacktestResult {
monthly_returns: { year: number; month: number; return_pct: number }[];
yearly_returns: { year: number; return_pct: number }[];
positions: { date: string; symbol: string; weight: number }[];
trades: { entry_date: string; exit_date: string; symbol: string; return_pct: number }[];
trades: { entry_date: string; exit_date: string; symbol: string; entry_price?: number; exit_price?: number; return_pct: number }[];
turnover_pct: number;
unimplemented: string[];
config_snapshot: Record<string, unknown>;