feat(DATA-004): add underlying instrument selector
This commit is contained in:
@@ -86,9 +86,10 @@ async def _resolve_hedge_spot(workspace_id: str | None = None) -> tuple[dict[str
|
||||
|
||||
try:
|
||||
data_service = get_data_service()
|
||||
quote = await data_service.get_quote(data_service.default_symbol)
|
||||
underlying = config.underlying or "GLD"
|
||||
quote = await data_service.get_quote(underlying)
|
||||
spot, source, updated_at = resolve_portfolio_spot_from_quote(
|
||||
config, quote, fallback_symbol=data_service.default_symbol
|
||||
config, quote, fallback_symbol=underlying
|
||||
)
|
||||
portfolio = portfolio_snapshot(config, runtime_spot_price=spot)
|
||||
return portfolio, source, updated_at
|
||||
@@ -120,12 +121,25 @@ async def _render_hedge_page(workspace_id: str | None = None) -> None:
|
||||
)
|
||||
updated_label = f"Quote timestamp: {quote_updated_at}" if quote_updated_at else "Quote timestamp: unavailable"
|
||||
|
||||
# Get underlying for display
|
||||
underlying = "GLD"
|
||||
if workspace_id:
|
||||
try:
|
||||
repo = get_workspace_repository()
|
||||
config = repo.load_portfolio_config(workspace_id)
|
||||
underlying = config.underlying or "GLD"
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
with dashboard_page(
|
||||
"Hedge Analysis",
|
||||
"Compare hedge structures across scenarios, visualize cost-benefit tradeoffs, and inspect net equity impacts.",
|
||||
f"Compare hedge structures across scenarios, visualize cost-benefit tradeoffs, and inspect net equity impacts for {underlying}.",
|
||||
"hedge",
|
||||
workspace_id=workspace_id,
|
||||
):
|
||||
with ui.row().classes("w-full items-center justify-between gap-4 max-md:flex-col max-md:items-start"):
|
||||
ui.label(f"Active underlying: {underlying}").classes("text-sm text-slate-500 dark:text-slate-400")
|
||||
|
||||
left_pane, right_pane = split_page_panes(
|
||||
left_testid="hedge-left-pane",
|
||||
right_testid="hedge-right-pane",
|
||||
|
||||
Reference in New Issue
Block a user