root = Card([header, portfolioValue, profitLoss, positions, exposureChart, biggestGainersLosers, watchedInstruments, workingOrders, marginUse, marketHeadlines, economicReleases, strategyReturns, drawdownText, riskAlert, rebalanceBtn, orderForm, timeframeSelect])
header = CardHeader("Morning Workspace", null)
portfolioValue = TextContent("Portfolio Value: $1.2M", "large")
profitLoss = TextContent("Profit/Loss Today: +$45,000", "default")
colTicker = Col("Ticker", ["AAPL","MSFT","TSLA","GOOG"], "string")
colSize = Col("Size", [100,200,50,75], "number")
colEntry = Col("Entry", [150,300,200,1000], "number")
colCurrent = Col("Current", [155,310,210,1020], "number")
positions = Table([colTicker, colSize, colEntry, colCurrent])
sectors = ["Tech","Energy","Healthcare","Finance","Consumer"]
exposureValues = [35,20,15,20,10]
exposureSeries = Series("Exposure", exposureValues)
exposureChart = BarChart(sectors, [exposureSeries], "grouped", "Sector", "Exposure Value")
gainerA = ListItem("AAPL", "↑ 3.2%")
gainerB = ListItem("MSFT", "↑ 2.5%")
loserX = ListItem("TSLA", "↓ 4.1%")
loserY = ListItem("GOOG", "↓ 1.8%")
biggestGainersLosers = ListBlock([gainerA, gainerB, loserX, loserY])
watchA = ListItem("AAPL", "155.0")
watchB = ListItem("MSFT", "310.0")
watchC = ListItem("TSLA", "210.0")
watchD = ListItem("GOOG", "1020.0")
watchedInstruments = ListBlock([watchA, watchB, watchC, watchD])
colOrderTicker = Col("Ticker", ["AAPL","MSFT"], "string")
colOrderSide = Col("Side", ["Buy","Sell"], "string")
colOrderQty = Col("Qty", [10,5], "number")
colOrderStatus = Col("Status", ["Pending","Filled"], "string")
workingOrders = Table([colOrderTicker, colOrderSide, colOrderQty, colOrderStatus])
marginUse = TextContent("Margin in Use: $250,000", "default")
headline1 = TextCallout("info", "Tech earnings beat expectations", "Positive")
headline2 = TextCallout("warning", "Oil prices dip amid supply concerns", "Negative")
headline3 = TextCallout("success", "Gold hits record high", "Positive")
marketHeadlines = ListBlock([headline1, headline2, headline3])
release1 = TextCallout("info", "US CPI Release", "High")
release2 = TextCallout("warning", "Fed Rate Decision", "Medium")
release3 = TextCallout("success", "Non-Farm Payrolls", "High")
economicReleases = ListBlock([release1, release2, release3])
strategies = ["Momentum","Mean Reversion","Arbitrage"]
returns = [12,8,5]
strategySeries = Series("Return", returns)
strategyReturns = BarChart(strategies, [strategySeries], "grouped", "Strategy", "Return %")
drawdownText = TextContent("Max Drawdown: 15% over past year", "default")
riskAlert = Alert("Risk Limit Alert", "Margin usage at 95% of limit", "warning")
sideBuy = SelectItem("Buy","Buy")
sideSell = SelectItem("Sell","Sell")
orderTickerInput = Input("ticker", "Enter ticker", "text")
orderSideSelect = Select("side", [sideBuy, sideSell], "Choose side")
orderQtyInput = Input("quantity", "Enter quantity", "number")
orderSubmitBtn = Button("Place Order", null, "primary")
orderTickerControl = FormControl("Ticker", orderTickerInput, "Ticker symbol")
orderSideControl = FormControl("Side", orderSideSelect, "Buy or Sell")
orderQtyControl = FormControl("Quantity", orderQtyInput, "Number of shares")
orderForm = Form("orderForm", Buttons([orderSubmitBtn]), [orderTickerControl, orderSideControl, orderQtyControl])
timeframeItem1 = SelectItem("1D","1 Day")
timeframeItem2 = SelectItem("1W","1 Week")
timeframeItem3 = SelectItem("1M","1 Month")
timeframeSelect = Select("timeframe", [timeframeItem1, timeframeItem2, timeframeItem3], "1D")
rebalanceBtn = Button("Rebalance Portfolio", null, "primary")