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

@@ -91,6 +91,8 @@ class SyntheticBacktestEngine:
)
)
margin_call_days_unhedged = sum(1 for point in daily_points if point.margin_call_unhedged)
margin_call_days_hedged = sum(1 for point in daily_points if point.margin_call_hedged)
summary = BacktestSummaryMetrics(
start_value=scenario.initial_portfolio.start_value,
end_value_unhedged=daily_points[-1].underlying_value,
@@ -99,8 +101,10 @@ class SyntheticBacktestEngine:
total_option_payoff_realized=total_option_payoff_realized,
max_ltv_unhedged=max(point.ltv_unhedged for point in daily_points),
max_ltv_hedged=max(point.ltv_hedged for point in daily_points),
margin_threshold_breached_unhedged=any(point.margin_call_unhedged for point in daily_points),
margin_threshold_breached_hedged=any(point.margin_call_hedged for point in daily_points),
margin_call_days_unhedged=margin_call_days_unhedged,
margin_call_days_hedged=margin_call_days_hedged,
margin_threshold_breached_unhedged=margin_call_days_unhedged > 0,
margin_threshold_breached_hedged=margin_call_days_hedged > 0,
)
return TemplateBacktestResult(
template_slug=template.slug,