root = Card([header, kpiRow, positionsSection, exposureSection, gainersLosersSection, watchlistSection, ordersSection, headlinesSection, econSection, strategySection, drawdownSection, riskSection, rebalanceBtn, orderForm, timeframeSelector])
header = CardHeader("Trading Desk — Morning Workspace", "As of 09:30 ET · Portfolio: MAIN-ALPHA · Base Currency: USD")
kpiRow = SnippetCardBlock([kpiNav, kpiPnl, kpiVar, kpiMargin], "grid", true)
kpiNav = SnippetCardItem("nav", kpiNavLhs, kpiNavRhs)
kpiNavLhs = IconText(kpiNavIcon, "neutral", "m", "Portfolio Value", "Net liquidation value", false, "horizontal")
kpiNavIcon = Icon("wallet", "finance")
kpiNavRhs = BoldText("number", "$12,847,320", "+$142,180", "metric")
kpiPnl = SnippetCardItem("pnl", kpiPnlLhs, kpiPnlRhs)
kpiPnlLhs = IconText(kpiPnlIcon, "success", "m", "P&L Today", "Realized + unrealized", false, "horizontal")
kpiPnlIcon = Icon("trending-up", "charts")
kpiPnlRhs = BoldText("number", "+$142,180", "+1.12%", "metric")
kpiVar = SnippetCardItem("var", kpiVarLhs, kpiVarRhs)
kpiVarLhs = IconText(kpiVarIcon, "warning", "m", "Value at Risk (1d, 95%)", "Parametric VaR", false, "horizontal")
kpiVarIcon = Icon("alert-triangle", "alerts")
kpiVarRhs = BoldText("number", "$-387,400", "3.0% of NAV", "metric")
kpiMargin = SnippetCardItem("margin", kpiMarginLhs, kpiMarginRhs)
kpiMarginLhs = IconText(kpiMarginIcon, "neutral", "m", "Margin in Use", "Reg T initial margin", false, "horizontal")
kpiMarginIcon = Icon("credit-card", "finance")
kpiMarginRhs = BoldText("number", "$4,215,600", "32.8% of NAV", "metric")
positionsSection = SectionBlock([secPositions], false)
secPositions = SectionItem("positions", "Current Positions (28)", [positionsTable])
positionsTable = Table([colTicker, colSize, colEntry, colCurrent, colUnrealized, colPnlPct, colSector])
colTicker = Col("Ticker", ["AAPL", "MSFT", "NVDA", "GOOGL", "AMZN", "META", "TSLA", "JPM", "V", "JNJ", "WMT", "PG", "UNH", "MA", "HD", "DIS", "NFLX", "ADBE", "CRM", "PYPL", "INTC", "AMD", "CSCO", "PFE", "KO", "PEP", "T", "VZ", "XOM"], "string")
colSize = Col("Size", [12500, 8200, 4100, 6800, 5400, 3900, 7200, 9800, 4500, 6100, 8300, 7700, 3200, 2800, 4900, 11200, 2100, 1800, 3400, 5600, 14500, 6700, 18900, 15600, 12400, 9800, 22100, 18700, 10500], "number")
colEntry = Col("Entry", [172.45, 398.12, 412.30, 138.75, 167.89, 312.40, 248.60, 156.20, 267.80, 162.30, 148.90, 154.20, 512.60, 421.70, 324.50, 98.40, 421.80, 487.30, 234.60, 67.80, 34.20, 142.80, 48.90, 41.20, 62.30, 172.40, 28.90, 41.60, 108.70], "number")
colCurrent = Col("Current", [189.20, 421.50, 487.60, 142.30, 178.90, 334.20, 267.80, 168.40, 284.60, 158.90, 152.30, 158.70, 528.40, 438.20, 338.90, 102.10, 445.60, 512.80, 251.30, 71.20, 36.80, 158.40, 51.20, 39.80, 64.10, 178.90, 27.40, 39.80, 112.30], "number")
colUnrealized = Col("Unrealized P&L", [209375, 191516, 308730, 24205, 59454, 84918, 138240, 119560, 75600, -20740, 28220, 34650, 50560, 46270, 70560, 41440, 50022, 45900, 56782, 19040, 37700, 104580, 43680, -37440, 22320, 143550, -33150, -33790, 37800], "number")
colPnlPct = Col("P&L %", ["+9.7%", "+5.9%", "+18.3%", "+2.6%", "+6.6%", "+7.0%", "+7.7%", "+7.8%", "+6.3%", "-2.1%", "+2.3%", "+2.9%", "+3.1%", "+3.9%", "+4.4%", "+3.8%", "+5.6%", "+5.2%", "+7.1%", "+5.0%", "+7.6%", "+10.9%", "+4.7%", "-3.4%", "+2.9%", "+3.8%", "-5.2%", "-4.3%", "+3.3%"], "string")
colSector = Col("Sector", ["Tech", "Tech", "Tech", "Comm", "ConsDisc", "Comm", "ConsDisc", "Financials", "Financials", "Healthcare", "ConsStaples", "ConsStaples", "Healthcare", "Financials", "ConsDisc", "Comm", "Comm", "Tech", "Tech", "Financials", "Tech", "Tech", "Tech", "Healthcare", "ConsStaples", "ConsStaples", "Comm", "Comm", "Energy"], "string")
exposureSection = SectionBlock([secExposure], false)
secExposure = SectionItem("exposure", "Exposure by Sector", [exposureChart, exposureTable])
exposureChart = HorizontalBarChart(sectors, [exposureSeries], "grouped", "Exposure ($M)", "Sector")
sectors = ["Technology", "Financials", "Consumer Disc.", "Communication", "Healthcare", "Consumer Staples", "Energy", "Industrials", "Utilities", "Real Estate", "Materials"]
exposureSeries = Series("Exposure ($M)", [3.82, 2.14, 1.56, 1.23, 1.08, 0.89, 0.42, 0.38, 0.21, 0.15, 0.09])
exposureTable = Table([colSector2, colExposure, colPctNav, colBeta])
colSector2 = Col("Sector", sectors, "string")
colExposure = Col("Exposure ($M)", [3.82, 2.14, 1.56, 1.23, 1.08, 0.89, 0.42, 0.38, 0.21, 0.15, 0.09], "number")
colPctNav = Col("% of NAV", ["29.7%", "16.7%", "12.1%", "9.6%", "8.4%", "6.9%", "3.3%", "3.0%", "1.6%", "1.2%", "0.7%"], "string")
colBeta = Col("Portfolio Beta", [1.18, 1.05, 1.12, 0.98, 0.85, 0.62, 1.35, 1.08, 0.45, 0.72, 1.15], "number")
gainersLosersSection = SectionBlock([secGainers, secLosers], false)
secGainers = SectionItem("gainers", "Today's Biggest Gainers", [gainersTable])
gainersTable = Table([colGTicker, colGSize, colGEntry, colGCurrent, colGPnl, colGPnlPct])
colGTicker = Col("Ticker", ["NVDA", "AMD", "META", "NFLX", "ADBE"], "string")
colGSize = Col("Size", [4100, 6700, 3900, 2100, 1800], "number")
colGEntry = Col("Entry", [412.30, 142.80, 312.40, 421.80, 487.30], "number")
colGCurrent = Col("Current", [487.60, 158.40, 334.20, 445.60, 512.80], "number")
colGPnl = Col("P&L ($)", [308730, 104580, 84918, 5002