trading_agent.terminal.terminal_application
¶
The terminal program: a full-screen chat with the desks of a running gateway, like Claude Code.
It is a client of the gateway, as the web page is. One event stream connection carries every live event; the desks' states are read every 5 seconds and again after events that change them.
Typical usage example:
application = TerminalApplication(gateway, settings, history) application.run()
TerminalApplication
¶
Bases: App[int]
The terminal program.
Creates the program without connecting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gateway
|
GatewayClient
|
The gateway's routes. |
required |
settings
|
TerminalSettings
|
The remembered choices. |
required |
history
|
PromptHistory
|
The earlier prompts. |
required |
desk_name
|
str | None
|
The desk to open on, or None for the one used last. |
None
|
Source code in src/trading_agent/terminal/terminal_application.py
on_mount
¶
Applies the theme, opens the chat, and starts the event stream and the desk polling.
Source code in src/trading_agent/terminal/terminal_application.py
on_unmount
async
¶
refresh_desks
async
¶
Reads the desks' states and passes them to the chat.
Source code in src/trading_agent/terminal/terminal_application.py
remember_desk
¶
Remembers the desk the chat shows, for the next run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
desk_name
|
str
|
The desk. |
required |
open_page
¶
Opens a page, such as Trading, over the chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
The page's slash command, such as "/trading". |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when the command names a page. |
Source code in src/trading_agent/terminal/terminal_application.py
action_pick_page
¶
Opens the list of pages.
Source code in src/trading_agent/terminal/terminal_application.py
toggle_theme
¶
Switches between the dark and light theme and remembers the choice.