feat(PORT-004C): seed workspace routes from portfolio settings

This commit is contained in:
Bu5hm4nn
2026-03-24 21:14:09 +01:00
parent 2cbe4f274d
commit 5ac66ea97b
8 changed files with 350 additions and 51 deletions

View File

@@ -54,6 +54,32 @@ def test_backtest_non_default_template_slug_runs_successfully() -> None:
assert result.run_result.template_results[0].template_slug == non_default_slug
def test_backtest_page_service_keeps_fixture_history_while_using_caller_portfolio_inputs() -> None:
service = BacktestPageService()
result = service.run_read_only_scenario(
symbol="GLD",
start_date=date(2024, 1, 2),
end_date=date(2024, 1, 8),
template_slug="protective-put-atm-12m",
underlying_units=9680.0,
loan_amount=222000.0,
margin_call_ltv=0.80,
)
assert result.entry_spot == 100.0
assert result.scenario.initial_portfolio.underlying_units == 9680.0
assert result.scenario.initial_portfolio.loan_amount == 222000.0
assert result.scenario.initial_portfolio.margin_call_ltv == 0.80
assert [point.date.isoformat() for point in result.run_result.template_results[0].daily_path] == [
"2024-01-02",
"2024-01-03",
"2024-01-04",
"2024-01-05",
"2024-01-08",
]
@pytest.mark.parametrize(
("kwargs", "message"),
[