fix(CORE-001D): close boundary review gaps
This commit is contained in:
@@ -117,13 +117,18 @@ class EventComparisonPageService:
|
||||
) -> BacktestScenario:
|
||||
if not template_slugs:
|
||||
raise ValueError("Select at least one strategy template.")
|
||||
normalized_inputs = normalize_historical_scenario_inputs(
|
||||
underlying_units=underlying_units,
|
||||
loan_amount=loan_amount,
|
||||
margin_call_ltv=margin_call_ltv,
|
||||
)
|
||||
try:
|
||||
scenario = self.comparison_service.preview_scenario_from_inputs(
|
||||
preset_slug=preset_slug,
|
||||
template_slugs=template_slugs,
|
||||
underlying_units=underlying_units,
|
||||
loan_amount=loan_amount,
|
||||
margin_call_ltv=margin_call_ltv,
|
||||
underlying_units=normalized_inputs.underlying_units,
|
||||
loan_amount=normalized_inputs.loan_amount,
|
||||
margin_call_ltv=normalized_inputs.margin_call_ltv,
|
||||
)
|
||||
except ValueError as exc:
|
||||
if str(exc) == "loan_amount must be less than initial collateral value":
|
||||
@@ -134,9 +139,17 @@ class EventComparisonPageService:
|
||||
preset.window_end,
|
||||
)
|
||||
if preview:
|
||||
_validate_initial_collateral(underlying_units, preview[0].close, loan_amount)
|
||||
_validate_initial_collateral(
|
||||
normalized_inputs.underlying_units,
|
||||
preview[0].close,
|
||||
normalized_inputs.loan_amount,
|
||||
)
|
||||
raise
|
||||
_validate_initial_collateral(underlying_units, scenario.initial_portfolio.entry_spot, loan_amount)
|
||||
_validate_initial_collateral(
|
||||
normalized_inputs.underlying_units,
|
||||
scenario.initial_portfolio.entry_spot,
|
||||
normalized_inputs.loan_amount,
|
||||
)
|
||||
return scenario
|
||||
|
||||
def run_read_only_comparison(
|
||||
|
||||
Reference in New Issue
Block a user