Lean  $LEAN_TAG$
QuantConnect.Brokerages.BrokerageMultiWebSocketSubscriptionManager Class Reference

Handles brokerage data subscriptions with multiple websocket connections, with optional symbol weighting More...

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

Public Member Functions

 BrokerageMultiWebSocketSubscriptionManager (string webSocketUrl, int maximumSymbolsPerWebSocket, int maximumWebSocketConnections, Dictionary< Symbol, int > symbolWeights, Func< WebSocketClientWrapper > webSocketFactory, Func< IWebSocket, Symbol, bool > subscribeFunc, Func< IWebSocket, Symbol, bool > unsubscribeFunc, Action< WebSocketMessage > messageHandler, TimeSpan webSocketConnectionDuration, RateGate connectionRateLimiter=null)
 Initializes a new instance of the BrokerageMultiWebSocketSubscriptionManager class More...
 
override void Dispose ()
 Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. More...
 
- Public Member Functions inherited from QuantConnect.Data.EventBasedDataQueueHandlerSubscriptionManager
 EventBasedDataQueueHandlerSubscriptionManager ()
 Creates an instance of EventBasedDataQueueHandlerSubscriptionManager with a single channel name More...
 
 EventBasedDataQueueHandlerSubscriptionManager (Func< TickType, string > getChannelName)
 Creates an instance of EventBasedDataQueueHandlerSubscriptionManager More...
 
- Public Member Functions inherited from QuantConnect.Data.DataQueueHandlerSubscriptionManager
void Subscribe (SubscriptionDataConfig dataConfig)
 Increment number of subscribers for current TickType More...
 
void Unsubscribe (SubscriptionDataConfig dataConfig)
 Decrement number of subscribers for current TickType More...
 
IEnumerable< SymbolGetSubscribedSymbols ()
 Returns subscribed symbols More...
 
IEnumerable< SymbolGetSubscribedSymbols (TickType tickType)
 Retrieves the list of unique Symbol instances that are currently subscribed for a specific TickType. More...
 
bool IsSubscribed (Symbol symbol, TickType tickType)
 Checks if there is existing subscriber for current channel More...
 

Protected Member Functions

override bool Subscribe (IEnumerable< Symbol > symbols, TickType tickType)
 Subscribes to the symbols More...
 
override bool Unsubscribe (IEnumerable< Symbol > symbols, TickType tickType)
 Unsubscribes from the symbols More...
 
- Protected Member Functions inherited from QuantConnect.Data.EventBasedDataQueueHandlerSubscriptionManager
override bool Subscribe (IEnumerable< Symbol > symbols, TickType tickType)
 The way Brokerage subscribes to symbol tickers More...
 
override bool Unsubscribe (IEnumerable< Symbol > symbols, TickType tickType)
 The way Brokerage unsubscribes from symbol tickers More...
 
override string ChannelNameFromTickType (TickType tickType)
 Channel name More...
 

Additional Inherited Members

- Properties inherited from QuantConnect.Data.EventBasedDataQueueHandlerSubscriptionManager
Func< IEnumerable< Symbol >, TickType, bool > SubscribeImpl [get, set]
 Subscription method implementation More...
 
Func< IEnumerable< Symbol >, TickType, bool > UnsubscribeImpl [get, set]
 Unsubscription method implementation More...
 
- Properties inherited from QuantConnect.Data.DataQueueHandlerSubscriptionManager
ConcurrentDictionary< Channel, int > SubscribersByChannel = new ConcurrentDictionary<Channel, int>() [get]
 Counter More...
 

Detailed Description

Handles brokerage data subscriptions with multiple websocket connections, with optional symbol weighting

Definition at line 31 of file BrokerageMultiWebSocketSubscriptionManager.cs.

Constructor & Destructor Documentation

◆ BrokerageMultiWebSocketSubscriptionManager()

QuantConnect.Brokerages.BrokerageMultiWebSocketSubscriptionManager.BrokerageMultiWebSocketSubscriptionManager ( string  webSocketUrl,
int  maximumSymbolsPerWebSocket,
int  maximumWebSocketConnections,
Dictionary< Symbol, int >  symbolWeights,
Func< WebSocketClientWrapper webSocketFactory,
Func< IWebSocket, Symbol, bool >  subscribeFunc,
Func< IWebSocket, Symbol, bool >  unsubscribeFunc,
Action< WebSocketMessage messageHandler,
TimeSpan  webSocketConnectionDuration,
RateGate  connectionRateLimiter = null 
)

Initializes a new instance of the BrokerageMultiWebSocketSubscriptionManager class

Parameters
webSocketUrlThe URL for websocket connections
maximumSymbolsPerWebSocketThe maximum number of symbols per websocket connection
maximumWebSocketConnectionsThe maximum number of websocket connections allowed (if zero, symbol weighting is disabled)
symbolWeightsA dictionary for the symbol weights
webSocketFactoryA function which returns a new websocket instance
subscribeFuncA function which subscribes a symbol
unsubscribeFuncA function which unsubscribes a symbol
messageHandlerThe websocket message handler
webSocketConnectionDurationThe maximum duration of the websocket connection, TimeSpan.Zero for no duration limit
connectionRateLimiterThe rate limiter for creating new websocket connections

Definition at line 61 of file BrokerageMultiWebSocketSubscriptionManager.cs.

Here is the call graph for this function:

Member Function Documentation

◆ Subscribe()

override bool QuantConnect.Brokerages.BrokerageMultiWebSocketSubscriptionManager.Subscribe ( IEnumerable< Symbol symbols,
TickType  tickType 
)
protectedvirtual

Subscribes to the symbols

Parameters
symbolsSymbols to subscribe
tickTypeType of tick data

Implements QuantConnect.Data.DataQueueHandlerSubscriptionManager.

Definition at line 133 of file BrokerageMultiWebSocketSubscriptionManager.cs.

Here is the call graph for this function:

◆ Unsubscribe()

override bool QuantConnect.Brokerages.BrokerageMultiWebSocketSubscriptionManager.Unsubscribe ( IEnumerable< Symbol symbols,
TickType  tickType 
)
protectedvirtual

Unsubscribes from the symbols

Parameters
symbolsSymbols to subscribe
tickTypeType of tick data

Implements QuantConnect.Data.DataQueueHandlerSubscriptionManager.

Definition at line 154 of file BrokerageMultiWebSocketSubscriptionManager.cs.

Here is the call graph for this function:

◆ Dispose()

override void QuantConnect.Brokerages.BrokerageMultiWebSocketSubscriptionManager.Dispose ( )
virtual

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

Reimplemented from QuantConnect.Data.DataQueueHandlerSubscriptionManager.

Definition at line 177 of file BrokerageMultiWebSocketSubscriptionManager.cs.

Here is the call graph for this function:

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