Lean  $LEAN_TAG$
QuantConnect.Brokerages.DefaultConnectionHandler Class Reference

A default implementation of IConnectionHandler which signals disconnection if no data is received for a given time span and attempts to reconnect automatically. More...

Inheritance diagram for QuantConnect.Brokerages.DefaultConnectionHandler:
[legend]

Public Member Functions

void Initialize (string connectionId)
 Initializes the connection handler More...
 
void EnableMonitoring (bool isEnabled)
 Enables/disables monitoring of the connection More...
 
void KeepAlive (DateTime lastDataReceivedTime)
 Notifies the connection handler that new data was received More...
 
void Dispose ()
 Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. More...
 

Public Attributes

bool IsConnectionLost => _connectionLost
 Returns true if the connection has been lost More...
 

Protected Member Functions

virtual void OnConnectionLost ()
 Event invocator for the ConnectionLost event More...
 
virtual void OnConnectionRestored ()
 Event invocator for the ConnectionRestored event More...
 
virtual void OnReconnectRequested ()
 Event invocator for the ReconnectRequested event More...
 

Properties

TimeSpan MaximumIdleTimeSpan = TimeSpan.FromSeconds(5) [get, set]
 The elapsed time with no received data after which a connection loss is reported More...
 
int MinimumSecondsForNextReconnectionAttempt = 1 [get, set]
 The minimum time in seconds to wait before attempting to reconnect More...
 
int MaximumSecondsForNextReconnectionAttempt = 60 [get, set]
 The maximum time in seconds to wait before attempting to reconnect More...
 
string ConnectionId [get]
 The unique Id for the connection More...
 
- Properties inherited from QuantConnect.Brokerages.IConnectionHandler
bool IsConnectionLost [get]
 Returns true if the connection has been lost More...
 

Events

EventHandler ConnectionLost
 Event that fires when a connection loss is detected More...
 
EventHandler ConnectionRestored
 Event that fires when a lost connection is restored More...
 
EventHandler ReconnectRequested
 Event that fires when a reconnection attempt is required More...
 
- Events inherited from QuantConnect.Brokerages.IConnectionHandler
EventHandler ConnectionLost
 Event that fires when a connection loss is detected More...
 
EventHandler ConnectionRestored
 Event that fires when a lost connection is restored More...
 
EventHandler ReconnectRequested
 Event that fires when a reconnection attempt is required More...
 

Detailed Description

A default implementation of IConnectionHandler which signals disconnection if no data is received for a given time span and attempts to reconnect automatically.

Definition at line 28 of file DefaultConnectionHandler.cs.

Member Function Documentation

◆ Initialize()

void QuantConnect.Brokerages.DefaultConnectionHandler.Initialize ( string  connectionId)

Initializes the connection handler

Parameters
connectionIdThe connection id

Implements QuantConnect.Brokerages.IConnectionHandler.

Definition at line 82 of file DefaultConnectionHandler.cs.

Here is the call graph for this function:

◆ EnableMonitoring()

void QuantConnect.Brokerages.DefaultConnectionHandler.EnableMonitoring ( bool  isEnabled)

Enables/disables monitoring of the connection

Parameters
isEnabledTrue to enable monitoring, false otherwise

Implements QuantConnect.Brokerages.IConnectionHandler.

Definition at line 167 of file DefaultConnectionHandler.cs.

Here is the call graph for this function:

◆ KeepAlive()

void QuantConnect.Brokerages.DefaultConnectionHandler.KeepAlive ( DateTime  lastDataReceivedTime)

Notifies the connection handler that new data was received

Parameters
lastDataReceivedTimeThe UTC timestamp of the last data point received

Implements QuantConnect.Brokerages.IConnectionHandler.

Definition at line 182 of file DefaultConnectionHandler.cs.

Here is the caller graph for this function:

◆ OnConnectionLost()

virtual void QuantConnect.Brokerages.DefaultConnectionHandler.OnConnectionLost ( )
protectedvirtual

Event invocator for the ConnectionLost event

Definition at line 193 of file DefaultConnectionHandler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnConnectionRestored()

virtual void QuantConnect.Brokerages.DefaultConnectionHandler.OnConnectionRestored ( )
protectedvirtual

Event invocator for the ConnectionRestored event

Definition at line 202 of file DefaultConnectionHandler.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnReconnectRequested()

virtual void QuantConnect.Brokerages.DefaultConnectionHandler.OnReconnectRequested ( )
protectedvirtual

Event invocator for the ReconnectRequested event

Definition at line 211 of file DefaultConnectionHandler.cs.

Here is the caller graph for this function:

◆ Dispose()

void QuantConnect.Brokerages.DefaultConnectionHandler.Dispose ( )

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Definition at line 219 of file DefaultConnectionHandler.cs.

Member Data Documentation

◆ IsConnectionLost

bool QuantConnect.Brokerages.DefaultConnectionHandler.IsConnectionLost => _connectionLost

Returns true if the connection has been lost

Definition at line 76 of file DefaultConnectionHandler.cs.

Property Documentation

◆ MaximumIdleTimeSpan

TimeSpan QuantConnect.Brokerages.DefaultConnectionHandler.MaximumIdleTimeSpan = TimeSpan.FromSeconds(5)
getset

The elapsed time with no received data after which a connection loss is reported

Definition at line 56 of file DefaultConnectionHandler.cs.

◆ MinimumSecondsForNextReconnectionAttempt

int QuantConnect.Brokerages.DefaultConnectionHandler.MinimumSecondsForNextReconnectionAttempt = 1
getset

The minimum time in seconds to wait before attempting to reconnect

Definition at line 61 of file DefaultConnectionHandler.cs.

◆ MaximumSecondsForNextReconnectionAttempt

int QuantConnect.Brokerages.DefaultConnectionHandler.MaximumSecondsForNextReconnectionAttempt = 60
getset

The maximum time in seconds to wait before attempting to reconnect

Definition at line 66 of file DefaultConnectionHandler.cs.

◆ ConnectionId

string QuantConnect.Brokerages.DefaultConnectionHandler.ConnectionId
get

The unique Id for the connection

Definition at line 71 of file DefaultConnectionHandler.cs.

Event Documentation

◆ ConnectionLost

EventHandler QuantConnect.Brokerages.DefaultConnectionHandler.ConnectionLost

Event that fires when a connection loss is detected

Definition at line 41 of file DefaultConnectionHandler.cs.

◆ ConnectionRestored

EventHandler QuantConnect.Brokerages.DefaultConnectionHandler.ConnectionRestored

Event that fires when a lost connection is restored

Definition at line 46 of file DefaultConnectionHandler.cs.

◆ ReconnectRequested

EventHandler QuantConnect.Brokerages.DefaultConnectionHandler.ReconnectRequested

Event that fires when a reconnection attempt is required

Definition at line 51 of file DefaultConnectionHandler.cs.


The documentation for this class was generated from the following file: