trading_agent.terminal.widgets.side_card
¶
One foldable card of the side panel, with rows of a label and a value.
Each card of the panel is its own subclass, which fills the body with show_body.
Typical usage example:
class FundsCard(SideCard): ... self.show_body(self.rows([('Balance', '₹60,602.56')]))
SideCard
¶
Bases: Collapsible
A side panel card.
Attributes:
| Name | Type | Description |
|---|---|---|
card_id |
The card's short name, such as "funds", used to remember whether it is folded. |
Creates the card with an empty body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
card_id
|
str
|
The card's short name. |
required |
title
|
str
|
The card's title. |
required |
*extra
|
Widget
|
Widgets shown under the body, such as a list. |
()
|
collapsed
|
bool
|
Whether the card starts folded. |
False
|
Source code in src/trading_agent/terminal/widgets/side_card.py
show_body
¶
Replaces the card's body.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
Content | str
|
The new body. |
required |
show_aside
¶
Puts a short note after the title, such as a count or "DRY RUN".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aside
|
str
|
The note, or an empty string for none. |
required |
Source code in src/trading_agent/terminal/widgets/side_card.py
rows
¶
Lays out rows of a label and a value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rows
|
Sequence[Row]
|
The rows; a value may carry its own colour. |
required |
Returns:
| Type | Description |
|---|---|
Content
|
One line per row, the label padded and the value aligned right. |
Source code in src/trading_agent/terminal/widgets/side_card.py
note
¶
A muted note line.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The note. |
required |
Returns:
| Type | Description |
|---|---|
Content
|
The dimmed text. |