Skip to content

SubscriptionCollection

QuantConnect.Lean.Engine.DataFeeds.SubscriptionCollection

SubscriptionCollection()

Bases: Object, Iterable[Subscription]

Provides a collection for holding subscriptions.

Initializes a new instance of the SubscriptionCollection class

fill_forward_resolution_changed

fill_forward_resolution_changed: _EventContainer[
    Callable[
        [Object, FillForwardResolutionChangedEvent], Any
    ],
    Any,
]

Event fired when the fill forward resolution changes

__iter__

__iter__() -> Iterator[Subscription]

contains

contains(configuration: SubscriptionDataConfig) -> bool

Checks the collection for the specified subscription configuration

Parameters:

Name Type Description Default
configuration SubscriptionDataConfig

The subscription configuration to check for

required

Returns:

Type Description
bool

True if a subscription with the specified configuration is found in this collection, false otherwise.

freeze_fill_forward_resolution

freeze_fill_forward_resolution(freeze: bool) -> None

Will disable or enable fill forward resolution updates

get_enumerator

get_enumerator() -> IEnumerator[Subscription]

Returns an enumerator that iterates through the collection.

Returns:

Type Description
IEnumerator[Subscription]

An enumerator that can be used to iterate through the collection.

try_add

try_add(subscription: Subscription) -> bool

Attempts to add the specified subscription to the collection. If another subscription exists with the same configuration then it won't be added.

Parameters:

Name Type Description Default
subscription Subscription

The subscription to add

required

Returns:

Type Description
bool

True if the subscription is successfully added, false otherwise.

try_get_value

try_get_value(
    configuration: SubscriptionDataConfig,
    subscription: Optional[Subscription],
) -> Tuple[bool, Subscription]

Attempts to retrieve the subscription with the specified configuration

Parameters:

Name Type Description Default
configuration SubscriptionDataConfig

The subscription's configuration

required
subscription Optional[Subscription]

The subscription matching the configuration, null if not found

required

Returns:

Type Description
Tuple[bool, Subscription]

True if the subscription is successfully retrieved, false otherwise.

try_remove

try_remove(
    configuration: SubscriptionDataConfig,
    subscription: Optional[Subscription],
) -> Tuple[bool, Subscription]

Attempts to remove the subscription with the specified configuraton from the collection.

Parameters:

Name Type Description Default
configuration SubscriptionDataConfig

The configuration of the subscription to remove

required
subscription Optional[Subscription]

The removed subscription, null if not found.

required

Returns:

Type Description
Tuple[bool, Subscription]

True if the subscription is successfully removed, false otherwise.

update_and_get_fill_forward_resolution

update_and_get_fill_forward_resolution(
    configuration: SubscriptionDataConfig = None,
) -> Ref[timedelta]

Gets and updates the fill forward resolution by checking specified subscription configurations and selecting the smallest resoluton not equal to tick