root = Card([header, keyMetrics, alertsSection, headlinesSection, positionsSection, exposureSection, drawdownSection, gainersSection, losersSection, watchlistSection, ordersSection, economicSection, strategySection, orderFormSection, followup], "card", "column", "l")
header = Card([headerTitle, headerActions], "clear", "column", "m")
headerTitle = CardHeader("Trading Desk — Morning Workspace", "Tuesday, 17 June 2025 · 07:30 ET · New York")
headerActions = Card([timeframeLabel, timeframeButtons, rebalanceDialog], "clear", "row", "m", "center")
timeframeLabel = TextContent("View:", "small")
timeframeButtons = Buttons([tf1d, tf1w, tf1m, tf3m, tf1y])
tf1d = Button("1D", null, "secondary")
tf1w = Button("1W", null, "secondary")
tf1m = Button("1M", null, "secondary")
tf3m = Button("3M", null, "secondary")
tf1y = Button("1Y", null, "primary")
rebalanceDialog = DialogBlock("Rebalance Portfolio", "Portfolio Rebalance", "Adjust target allocations and submit for approval.", [rebalanceForm], "default")
rebalanceForm = Form("rebalance", rebalanceButtons, [equityField, bondField, cashField])
equityField = FormControl("Equity target", equitySlider, "Current: 55%")
equitySlider = Slider("equity_target", "discrete", 0, 100, 5, ["55"], "Equity %")
bondField = FormControl("Fixed income target", bondSlider, "Current: 25%")
bondSlider = Slider("bond_target", "discrete", 0, 100, 5, ["25"], "Fixed income %")
cashField = FormControl("Cash target", cashSlider, "Current: 20%")
cashSlider = Slider("cash_target", "discrete", 0, 100, 5, ["20"], "Cash %")
rebalanceButtons = Buttons([submitRebalance, cancelRebalance])
submitRebalance = Button("Submit rebalance", null, "primary")
cancelRebalance = Button("Cancel", null, "tertiary")
keyMetrics = Card([portfolioLabel, portfolioValue, metricSep1, pnlLabel, pnlValue, pnlTag, metricSep2, varLabel, varValue, metricSep3, marginLabel, marginProgress], "sunk", "row", "xl", "center", "between", true)
portfolioLabel = TextContent("Portfolio Value", "small")
portfolioValue = TextContent("**$12.48B**", "large")
metricSep1 = Separator("vertical", true)
pnlLabel = TextContent("P&L Today", "small")
pnlValue = TextContent("**+$84.2M**", "large")
pnlTag = Tag("+0.68%", null, null, "success")
metricSep2 = Separator("vertical", true)
varLabel = TextContent("Value at Risk (95%)", "small")
varValue = TextContent("**$42.5M**", "large")
metricSep3 = Separator("vertical", true)
marginLabel = TextContent("Margin in Use", "small")
marginProgress = Progress(68, "68% · $5.4B / $8.0B limit")
alertsSection = Card([riskCallout], "clear")
riskCallout = Callout("warning", "Risk limits close to breach", "• VaR utilization at 68% of 75% cap\n• Technology sector 35% of 40% cap\n• Gross leverage 5.2x of 6.0x max")
headlinesSection = Card([headlinesHeading, headlineFed, headlineOil, headlineCpi, headlineEarnings], "sunk", "column", "m")
headlinesHeading = Heading("Market Headlines", "h2")
headlineFed = Callout("success", "Fed holds rates steady, signals one cut in 2025", "Positive · S&P futures +0.3%")
headlineOil = Callout("info", "Oil slips as OPEC+ weighs output increase", "Neutral · WTI -0.4% at $77.20")
headlineCpi = Callout("warning", "Core CPI surprise pushes bond yields higher", "Negative · 10Y +8bp at 4.42%")
headlineEarnings = Callout("success", "Adobe beats, guides higher on AI demand", "Positive · ADBE +7% after hours")
positionsSection = Card([positionsHeading, positionsTable], "sunk", "column", "m")
positionsHeading = Heading("Positions", "h2")
positionsTable = Table([tickerCol, sizeCol, entryCol, currentCol, dayPnlCol])
tickerCol = Col("Ticker", ["AAPL", "MSFT", "NVDA", "TSLA", "JPM", "XOM"])
sizeCol = Col("Size", ["250,000", "180,000", "120,000", "95,000", "400,000", "300,000"])
entryCol = Col("Entry", [174.20, 420.10, 880.10, 240.00, 62.50, 62.80])
currentCol = Col("Current", [182.30, 430.50, 920.40, 255.70, 63.90, 64.20])
dayPnlCol = Col("Day P&L", ["+$2.0M", "+$1.9M", "+$4.8M", "+$1.5M", "+$0.6M", "+$0.4M"])
exposureSection = Card([exposureHeading, exposurePie], "sunk", "column", "m")
exposureHeading = Heading("Exposure by Sector", "h2")
exposurePie = PieChart(["Technology", "Financials", "Energy", "Consumer", "Healthcare", "Other"], [35, 22, 15, 12, 10, 6], "donut", "circular")
drawdownSection = Card([drawdownHeading, drawdownArea], "sunk", "column", "m")
drawdownHeading = Heading("Drawdown — Trailing 12 Months", "h2")
drawdownArea = AreaChart(["Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Jan", "Feb", "Mar", "Apr", "May", "Jun"], [drawdownSeries], "natural", "", "%")
drawdownSeries = Series("Drawdown %", [0, -1.8, -3.4, -2.6, -5.2, -4.6, -3.1, -2.4, -1.9, -1.2, -1.6, -0.9])
gainersSection = Card([gainersHeading, gainersList], "sunk", "column", "m")
gainersHeading = Heading("Top Gainers — Today", "h2")
gainersList = ListBlock([gainer1, gainer2, gainer3, gainer4, gainer5], "number")
gainer1 = ListItem("TSLA", "+6.2% · $255.70")
gainer2 = ListItem("NVDA", "+4.8% · $920.40")
gainer3 = ListItem("AMD", "+3.9% · $168.10")
gainer4 = ListItem("COIN", "+3.1% · $221.00")
gainer5 = ListItem("PLTR", "+2.7% · $28.90")
losersSection = Card([losersHeading, losersList], "sunk", "column", "m")
losersHeading = Heading("Top Losers — Today", "h2")
losersList = ListBlock([loser1, loser2, loser3, loser4, loser5], "number")
loser1 = ListItem("BA", "-4.1% · $182.30")
loser2 = ListItem("MRNA", "-3.6% · $92.50")
loser3 = ListItem("NIO", "-2.9% · $4.80")
loser4 = ListItem("PYPL", "-2.2% · $67.30")
loser5 = ListItem("DIS", "-1.8% · $102.10")
watchlistSection = Card([watchlistHeading, watchlistTable], "sunk", "column", "m")
watchlistHeading = Heading("Instruments Watched", "h2")
watchlistTable = Table([watchTickerCol, watchPriceCol, watchChangeCol])
watchTickerCol = Col("Instrument", ["BTC-USD", "ETH-USD", "SPX", "NDX", "DXY", "CL-Fut", "EURUSD"])
watchPriceCol = Col("Price", ["$67,420", "$3,520", "5,632.10", "19,840.20", "104.30", "$77.20", "1.0815"])
watchChangeCol = Col("Chg %", ["+1.2%", "+0.8%", "+0.3%", "+0.5%", "-0.2%", "-0.6%", "+0.1%"])
ordersSection = Card([ordersHeading, ordersTable], "sunk", "column", "m")
ordersHeading = Heading("Working Orders", "h2")
ordersTable = Table([orderTickerCol, orderSideCol, orderQtyCol, orderTypeCol, orderStatusCol])
orderTickerCol = Col("