Skip to content

RateLimitEnumerator

QuantConnect.Lean.Engine.DataFeeds.Enumerators.RateLimitEnumerator

RateLimitEnumerator(
    enumerator: IEnumerator[
        QuantConnect_Lean_Engine_DataFeeds_Enumerators_RateLimitEnumerator_T
    ],
    time_provider: ITimeProvider,
    minimum_time_between_calls: timedelta,
)

Bases: Generic[QuantConnect_Lean_Engine_DataFeeds_Enumerators_RateLimitEnumerator_T], Object, IEnumerator[QuantConnect_Lean_Engine_DataFeeds_Enumerators_RateLimitEnumerator_T]

Provides augmentation of how often an enumerator can be called. Time is measured using an ITimeProvider instance and calls to the underlying enumerator are limited to a minimum time between each call.

Initializes a new instance of the RateLimitEnumerator{T} class

Parameters:

Name Type Description Default
enumerator IEnumerator[QuantConnect_Lean_Engine_DataFeeds_Enumerators_RateLimitEnumerator_T]

The underlying enumerator to place rate limits on

required
time_provider ITimeProvider

Time provider used for determing the time between calls

required
minimum_time_between_calls timedelta

The minimum time allowed between calls to the underlying enumerator

required

current

current: QuantConnect_Lean_Engine_DataFeeds_Enumerators_RateLimitEnumerator_T

Gets the element in the collection at the current position of the enumerator.

dispose

dispose() -> None

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

move_next

move_next() -> bool

Advances the enumerator to the next element of the collection.

Returns:

Type Description
bool

true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.

reset

reset() -> None

Sets the enumerator to its initial position, which is before the first element in the collection.