trading_agent.terminal.widgets.side_panel
¶
The right-hand panel of the chat: eight cards about the desk, as on the web page.
The panel reads the gateway on the web page's timings: the context window every 20 seconds and after a turn, a compression, a new session or a model switch; the account and the desks' open orders every 15 seconds and after an order, a fill, a halt or the kill switch; the MCP servers every minute. The counts of orders and the outputs come from the desk's events of today, which the chat screen passes on. Which cards are folded is remembered between runs.
Typical usage example:
panel = SidePanel(gateway, settings, opener) panel.set_desk('general') panel.take_events(events)
SidePanel
¶
Bases: VerticalScroll
The side panel.
Creates the panel and its cards.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gateway
|
GatewayClient
|
The gateway's routes. |
required |
settings
|
TerminalSettings
|
The remembered choices, holding the folded cards. |
required |
opener
|
AttachmentOpener
|
Downloads and opens the desk's files. |
required |
Source code in src/trading_agent/terminal/widgets/side_panel.py
compose
¶
Builds the panel.
Yields:
| Type | Description |
|---|---|
Widget
|
The eight cards. |
Source code in src/trading_agent/terminal/widgets/side_panel.py
on_mount
¶
Starts the timers that read the gateway.
Source code in src/trading_agent/terminal/widgets/side_panel.py
set_desk
¶
Shows another desk, forgetting the previous desk's events.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
desk_name
|
str
|
The desk. |
required |
Source code in src/trading_agent/terminal/widgets/side_panel.py
take_events
¶
Takes the desk's new events and reads the gateway again when they change something.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
events
|
list[dict[str, Any]]
|
The events, oldest first. |
required |
Source code in src/trading_agent/terminal/widgets/side_panel.py
take_desk
¶
Shows the desk's state and models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
desk
|
dict[str, Any] | None
|
The desk summary, or None while loading. |
required |
mode
|
str
|
"dry_run" or "live". |
required |
Source code in src/trading_agent/terminal/widgets/side_panel.py
on_collapsible_collapsed
¶
Remembers that a card was folded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Collapsed
|
The fold. |
required |
Source code in src/trading_agent/terminal/widgets/side_panel.py
on_collapsible_expanded
¶
Remembers that a card was opened.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
Expanded
|
The opening. |
required |
Source code in src/trading_agent/terminal/widgets/side_panel.py
refresh_context
async
¶
Reads the desk's context window and tools.
Source code in src/trading_agent/terminal/widgets/side_panel.py
refresh_account
async
¶
Reads the account and the desks' open orders.
Source code in src/trading_agent/terminal/widgets/side_panel.py
refresh_servers
async
¶
Reads the MCP servers.