Skip to content

trading_agent.runtime.no_model_turn_runner

A turn runner for a desk that has no model connected yet.

It lets the queue, the event bus and the gateway be tested end to end before any model is involved.

Typical usage example:

desk = DeskRuntime(desk_configuration, event_bus, NoModelTurnRunner())

NoModelTurnRunner

Bases: TurnRunner

Answers every trigger by saying that no model is connected.

run_turn async

run_turn(trigger)

Replies that no model is connected, quoting the trigger.

Parameters:

Name Type Description Default
trigger Trigger

The reason for the turn.

required

Returns:

Type Description
TurnResult

A reply that names the trigger's source and text.

Source code in src/trading_agent/runtime/no_model_turn_runner.py
async def run_turn(
    self,
    trigger: trigger_module.Trigger,
) -> turn_runner.TurnResult:
    """Replies that no model is connected, quoting the trigger.

    Args:
        trigger (trigger_module.Trigger): The reason for the turn.

    Returns:
        turn_runner.TurnResult: A reply that names the trigger's source and text.
    """
    return turn_runner.TurnResult(
        text=(
            f'No model is connected to this desk yet. Received a {trigger.source} trigger: {trigger.text}'
        ),
    )