Skip to content

DataQueueHandlerSubscriptionManager

QuantConnect.Data.DataQueueHandlerSubscriptionManager

Bases: Object, IDisposable

Count number of subscribers for each channel (Symbol, Socket) pair

subscribers_by_channel

subscribers_by_channel: ConcurrentDictionary[Channel, int]

Counter

This codeEntityType is protected.

get_subscribed_symbols

get_subscribed_symbols() -> Iterable[Symbol]
get_subscribed_symbols(
    tick_type: TickType,
) -> Iterable[Symbol]

Signature descriptions:

  • Returns subscribed symbols

  • Retrieves the list of unique Symbol instances that are currently subscribed for a specific TickType.

Parameters:

Name Type Description Default
tick_type Optional[TickType]

The type of tick data to filter subscriptions by.

None

Returns:

Type Description
Iterable[Symbol]

Depends on the signature used. Case 1: [list of Symbol currently subscribed.]; Case 2: [A collection of unique Symbol objects that match the specified tick_type.]

subscribe

subscribe(data_config: SubscriptionDataConfig) -> None
subscribe(
    symbols: List[Symbol], tick_type: TickType
) -> bool

Signature descriptions:

  • Increment number of subscribers for current TickType

  • Describes the way IDataQueueHandler implements subscription

Parameters:

Name Type Description Default
data_config Optional[SubscriptionDataConfig]

defines the subscription configuration data.

None
symbols Optional[List[Symbol]]

Symbols to subscribe

None
tick_type Optional[TickType]

Type of tick data

None

Returns:

Type Description
Optional[bool]

Returns true if subsribed; otherwise false.

unsubscribe

unsubscribe(data_config: SubscriptionDataConfig) -> None
unsubscribe(
    symbols: List[Symbol], tick_type: TickType
) -> bool

Signature descriptions:

  • Decrement number of subscribers for current TickType

  • Describes the way IDataQueueHandler implements unsubscription

Parameters:

Name Type Description Default
data_config Optional[SubscriptionDataConfig]

defines the subscription configuration data.

None
symbols Optional[List[Symbol]]

Symbols to unsubscribe

None
tick_type Optional[TickType]

Type of tick data

None

Returns:

Type Description
Optional[bool]

Returns true if unsubsribed; otherwise false.

channel_name_from_tick_type

channel_name_from_tick_type(tick_type: TickType) -> str

Brokerage maps TickType to real socket/api channel

This codeEntityType is protected.

Parameters:

Name Type Description Default
tick_type TickType

Type of tick data

required

dispose

dispose() -> None

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

is_subscribed

is_subscribed(
    symbol: Union[Symbol, str, BaseContract],
    tick_type: TickType,
) -> bool

Checks if there is existing subscriber for current channel

Parameters:

Name Type Description Default
symbol Union[Symbol, str, BaseContract]

Symbol

required
tick_type TickType

Type of tick data

required

Returns:

Type Description
bool

return true if there is one subscriber at least; otherwise false.