trading_agent.journal.journal_reader
¶
Reads the events a journal folder holds for one India date.
Typical usage example:
reader = JournalReader(layout.desk_directory('general') / 'journal') events = reader.events(reader.today(), ['order', 'fill'])
JournalReader
¶
The journal files of one desk, or of the gateway.
Creates the reader without reading anything.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder
|
Path
|
The journal folder, holding one YYYY-MM-DD.jsonl file per India date. |
required |
clock
|
Callable[[], datetime] | None
|
Returns the current time; None uses the system clock. |
None
|
Source code in src/trading_agent/journal/journal_reader.py
today
¶
Today's India date, as the name its journal file uses.
Returns:
| Type | Description |
|---|---|
str
|
The date, such as "2026-10-19". |
Source code in src/trading_agent/journal/journal_reader.py
events
¶
Reads one day's events, oldest first, skipping lines that are not JSON.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
day
|
str
|
The India date, such as "2026-10-19". |
required |
kinds
|
Collection[str] | None
|
The event kinds to keep, such as "order"; None keeps every kind. |
None
|
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
The events, each with kind, desk, payload and created_at. The list is empty when the day has no file. |