feat(BT-003): add event preset backtest comparison

This commit is contained in:
Bu5hm4nn
2026-03-24 17:49:58 +01:00
parent d4dc34d5ab
commit 8566cc203f
9 changed files with 741 additions and 3 deletions

View File

@@ -3,6 +3,8 @@ from __future__ import annotations
from dataclasses import dataclass, field
from datetime import date
from app.models.event_preset import EventPreset
@dataclass(frozen=True)
class BacktestPortfolioState:
@@ -107,6 +109,8 @@ class BacktestSummaryMetrics:
total_option_payoff_realized: float
max_ltv_unhedged: float
max_ltv_hedged: float
margin_call_days_unhedged: int
margin_call_days_hedged: int
margin_threshold_breached_unhedged: bool
margin_threshold_breached_hedged: bool
@@ -125,3 +129,23 @@ class TemplateBacktestResult:
class BacktestRunResult:
scenario_id: str
template_results: tuple[TemplateBacktestResult, ...]
@dataclass(frozen=True)
class EventComparisonRanking:
rank: int
template_slug: str
template_name: str
survived_margin_call: bool
max_ltv_hedged: float
hedge_cost: float
final_equity: float
result: TemplateBacktestResult
@dataclass(frozen=True)
class EventComparisonReport:
event_preset: EventPreset
scenario: BacktestScenario
rankings: tuple[EventComparisonRanking, ...]
run_result: BacktestRunResult