Lean
$LEAN_TAG$
|
A default implementation of IConnectionHandler which signals disconnection if no data is received for a given time span and attempts to reconnect automatically. More...
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... | |
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.
void QuantConnect.Brokerages.DefaultConnectionHandler.Initialize | ( | string | connectionId | ) |
Initializes the connection handler
connectionId | The connection id |
Implements QuantConnect.Brokerages.IConnectionHandler.
Definition at line 82 of file DefaultConnectionHandler.cs.
void QuantConnect.Brokerages.DefaultConnectionHandler.EnableMonitoring | ( | bool | isEnabled | ) |
Enables/disables monitoring of the connection
isEnabled | True to enable monitoring, false otherwise |
Implements QuantConnect.Brokerages.IConnectionHandler.
Definition at line 167 of file DefaultConnectionHandler.cs.
void QuantConnect.Brokerages.DefaultConnectionHandler.KeepAlive | ( | DateTime | lastDataReceivedTime | ) |
Notifies the connection handler that new data was received
lastDataReceivedTime | The UTC timestamp of the last data point received |
Implements QuantConnect.Brokerages.IConnectionHandler.
Definition at line 182 of file DefaultConnectionHandler.cs.
|
protectedvirtual |
Event invocator for the ConnectionLost event
Definition at line 193 of file DefaultConnectionHandler.cs.
|
protectedvirtual |
Event invocator for the ConnectionRestored event
Definition at line 202 of file DefaultConnectionHandler.cs.
|
protectedvirtual |
Event invocator for the ReconnectRequested event
Definition at line 211 of file DefaultConnectionHandler.cs.
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.
bool QuantConnect.Brokerages.DefaultConnectionHandler.IsConnectionLost => _connectionLost |
Returns true if the connection has been lost
Definition at line 76 of file DefaultConnectionHandler.cs.
|
getset |
The elapsed time with no received data after which a connection loss is reported
Definition at line 56 of file DefaultConnectionHandler.cs.
|
getset |
The minimum time in seconds to wait before attempting to reconnect
Definition at line 61 of file DefaultConnectionHandler.cs.
|
getset |
The maximum time in seconds to wait before attempting to reconnect
Definition at line 66 of file DefaultConnectionHandler.cs.
|
get |
The unique Id for the connection
Definition at line 71 of file DefaultConnectionHandler.cs.
EventHandler QuantConnect.Brokerages.DefaultConnectionHandler.ConnectionLost |
Event that fires when a connection loss is detected
Definition at line 41 of file DefaultConnectionHandler.cs.
EventHandler QuantConnect.Brokerages.DefaultConnectionHandler.ConnectionRestored |
Event that fires when a lost connection is restored
Definition at line 46 of file DefaultConnectionHandler.cs.
EventHandler QuantConnect.Brokerages.DefaultConnectionHandler.ReconnectRequested |
Event that fires when a reconnection attempt is required
Definition at line 51 of file DefaultConnectionHandler.cs.