feat(CORE-001D): close remaining boundary cleanup slices
This commit is contained in:
@@ -13,6 +13,7 @@ from app.models.backtest import (
|
||||
)
|
||||
from app.models.event_preset import EventPreset
|
||||
from app.services.backtesting.historical_provider import DailyClosePoint, SyntheticHistoricalProvider
|
||||
from app.services.backtesting.input_normalization import normalize_historical_scenario_inputs
|
||||
from app.services.backtesting.service import BacktestService
|
||||
from app.services.event_presets import EventPresetService
|
||||
from app.services.strategy_templates import StrategyTemplateService
|
||||
@@ -64,16 +65,24 @@ class EventComparisonService:
|
||||
financing_rate: float = 0.0,
|
||||
provider_ref: ProviderRef | None = None,
|
||||
) -> EventComparisonReport:
|
||||
preset = self.event_preset_service.get_preset(preset_slug)
|
||||
scenario = self.preview_scenario_from_inputs(
|
||||
preset_slug=preset_slug,
|
||||
normalized_inputs = normalize_historical_scenario_inputs(
|
||||
underlying_units=underlying_units,
|
||||
loan_amount=loan_amount,
|
||||
margin_call_ltv=margin_call_ltv,
|
||||
template_slugs=template_slugs,
|
||||
currency=currency,
|
||||
cash_balance=cash_balance,
|
||||
financing_rate=financing_rate,
|
||||
)
|
||||
preset = self.event_preset_service.get_preset(preset_slug)
|
||||
scenario = self.preview_scenario_from_inputs(
|
||||
preset_slug=preset_slug,
|
||||
underlying_units=normalized_inputs.underlying_units,
|
||||
loan_amount=normalized_inputs.loan_amount,
|
||||
margin_call_ltv=normalized_inputs.margin_call_ltv,
|
||||
template_slugs=template_slugs,
|
||||
currency=normalized_inputs.currency,
|
||||
cash_balance=normalized_inputs.cash_balance,
|
||||
financing_rate=normalized_inputs.financing_rate,
|
||||
provider_ref=provider_ref,
|
||||
)
|
||||
return self._compare_materialized_event(preset=preset, scenario=scenario)
|
||||
@@ -91,19 +100,27 @@ class EventComparisonService:
|
||||
financing_rate: float = 0.0,
|
||||
provider_ref: ProviderRef | None = None,
|
||||
) -> BacktestScenario:
|
||||
preset = self.event_preset_service.get_preset(preset_slug)
|
||||
history = self._load_preset_history(preset)
|
||||
entry_spot = history[0].close
|
||||
initial_portfolio = materialize_backtest_portfolio_state(
|
||||
symbol=preset.symbol,
|
||||
normalized_inputs = normalize_historical_scenario_inputs(
|
||||
underlying_units=underlying_units,
|
||||
entry_spot=entry_spot,
|
||||
loan_amount=loan_amount,
|
||||
margin_call_ltv=margin_call_ltv,
|
||||
currency=currency,
|
||||
cash_balance=cash_balance,
|
||||
financing_rate=financing_rate,
|
||||
)
|
||||
preset = self.event_preset_service.get_preset(preset_slug)
|
||||
history = self._load_preset_history(preset)
|
||||
entry_spot = history[0].close
|
||||
initial_portfolio = materialize_backtest_portfolio_state(
|
||||
symbol=preset.symbol,
|
||||
underlying_units=normalized_inputs.underlying_units,
|
||||
entry_spot=entry_spot,
|
||||
loan_amount=normalized_inputs.loan_amount,
|
||||
margin_call_ltv=normalized_inputs.margin_call_ltv,
|
||||
currency=normalized_inputs.currency,
|
||||
cash_balance=normalized_inputs.cash_balance,
|
||||
financing_rate=normalized_inputs.financing_rate,
|
||||
)
|
||||
return self.materialize_scenario(
|
||||
preset,
|
||||
initial_portfolio=initial_portfolio,
|
||||
|
||||
Reference in New Issue
Block a user