Skip to content

EventBasedDataQueueHandlerSubscriptionManager

QuantConnect.Data.EventBasedDataQueueHandlerSubscriptionManager

EventBasedDataQueueHandlerSubscriptionManager()
EventBasedDataQueueHandlerSubscriptionManager(
    get_channel_name: Callable[[TickType], str],
)

Bases: DataQueueHandlerSubscriptionManager

Overrides DataQueueHandlerSubscriptionManager methods using events

Signature descriptions:

  • Creates an instance of EventBasedDataQueueHandlerSubscriptionManager with a single channel name

  • Creates an instance of EventBasedDataQueueHandlerSubscriptionManager

Parameters:

Name Type Description Default
get_channel_name Optional[Callable[[TickType], str]]

Convert TickType into string

None

subscribe_impl

subscribe_impl: Callable[[Iterable[Symbol], TickType], bool]

Subscription method implementation

unsubscribe_impl

unsubscribe_impl: Callable[
    [Iterable[Symbol], TickType], bool
]

Unsubscription method implementation

subscribers_by_channel

subscribers_by_channel: ConcurrentDictionary[Channel, int]

Counter

This codeEntityType is protected.

channel_name_from_tick_type

channel_name_from_tick_type(tick_type: TickType) -> str

Channel name

This codeEntityType is protected.

Parameters:

Name Type Description Default
tick_type TickType

Type of tick data

required

Returns:

Type Description
str

Returns Socket channel name corresponding tick_type.

subscribe

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

The way Brokerage subscribes to symbol tickers

This codeEntityType is protected.

Parameters:

Name Type Description Default
symbols List[Symbol]

Symbols to subscribe

required
tick_type TickType

Type of tick data

required

unsubscribe

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

The way Brokerage unsubscribes from symbol tickers

This codeEntityType is protected.

Parameters:

Name Type Description Default
symbols List[Symbol]

Symbols to unsubscribe

required
tick_type TickType

Type of tick data

required

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.]

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.