Skip to content

trading_agent.terminal.widgets.event_step_view

An event shown inside a turn or on its own, such as a risk decision, an order or a fill.

Typical usage example:

view = EventStepView(event)

EventStepView

EventStepView(event, with_time=False)

Bases: Static

One event as a line in its tone's colour, with its detail below.

Creates the line.

Parameters:

Name Type Description Default
event dict[str, Any]

The event.

required
with_time bool

Whether to start with the event's India clock time, for events outside turns.

False
Source code in src/trading_agent/terminal/widgets/event_step_view.py
def __init__(self, event: dict[str, Any], with_time: bool = False):
    """Creates the line.

    Args:
        event (dict[str, Any]): The event.
        with_time (bool): Whether to start with the event's India clock time, for events outside turns.
    """
    description = event_describer.EventDescriber().describe(event)
    super().__init__(
        self._content(event, description, with_time),
        classes=f'event-step tone-{description.tone}',
    )