trading_agent.terminal.terminal_settings
¶
Remembers the terminal program's choices between runs: the desk, the theme, the side panel and its folded cards.
They are kept in ~/.local/state/trading-agent/terminal.json, beside the prompt history. A missing or unreadable file gives the defaults.
Typical usage example:
settings = TerminalSettings.load() settings.desk = 'scalper' settings.save()
TerminalSettings
¶
The remembered choices.
Attributes:
| Name | Type | Description |
|---|---|---|
desk |
str | None
|
The desk the chat opened on last, or None. |
theme |
The theme's name. |
|
side_panel_open |
Whether the right-hand panel is shown. |
|
collapsed_cards |
list[str]
|
The side panel cards that are folded, by short name. |
file |
Where the choices are kept. |
Creates the defaults.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
Path
|
Where the choices are kept. |
required |
Source code in src/trading_agent/terminal/terminal_settings.py
state_directory
classmethod
¶
The folder for the terminal program's state.
Returns:
| Type | Description |
|---|---|
Path
|
$XDG_STATE_HOME/trading-agent, or ~/.local/state/trading-agent. |
Source code in src/trading_agent/terminal/terminal_settings.py
load
classmethod
¶
Reads the remembered choices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
Path | None
|
The file, or None for terminal.json in the state folder. |
None
|
Returns:
| Type | Description |
|---|---|
TerminalSettings
|
The choices, or the defaults when the file is missing or unreadable. |
Source code in src/trading_agent/terminal/terminal_settings.py
save
¶
Writes the choices, ignoring a folder that cannot be written.