Skip to content

IConnectionHandler

QuantConnect.Brokerages.IConnectionHandler

Bases: IDisposable

Provides handling of a brokerage or data feed connection

connection_lost

connection_lost: _EventContainer[
    Callable[[Object, EventArgs], Any], Any
]

Event that fires when a connection loss is detected

connection_restored

connection_restored: _EventContainer[
    Callable[[Object, EventArgs], Any], Any
]

Event that fires when a lost connection is restored

reconnect_requested

reconnect_requested: _EventContainer[
    Callable[[Object, EventArgs], Any], Any
]

Event that fires when a reconnection attempt is required

is_connection_lost

is_connection_lost: bool

Returns true if the connection has been lost

enable_monitoring

enable_monitoring(is_enabled: bool) -> None

Enables/disables monitoring of the connection

Parameters:

Name Type Description Default
is_enabled bool

True to enable monitoring, false otherwise

required

initialize

initialize(connection_id: str) -> None

Initializes the connection handler

Parameters:

Name Type Description Default
connection_id str

The connection id

required

keep_alive

keep_alive(
    last_data_received_time: Union[datetime, date],
) -> None

Notifies the connection handler that new data was received

Parameters:

Name Type Description Default
last_data_received_time Union[datetime, date]

The UTC timestamp of the last data point received

required