FixedIntervalRefillStrategy
QuantConnect.Util.RateLimit.FixedIntervalRefillStrategy
FixedIntervalRefillStrategy(
time_provider: ITimeProvider,
refill_amount: int,
refill_interval: timedelta,
)
Bases: Object, IRefillStrategy
Provides a refill strategy that has a constant, quantized refill rate. For example, after 1 minute passes add 5 units. If 59 seconds has passed, it will add zero unit, but if 2 minutes have passed, then 10 units would be added.
Initializes a new instance of the FixedIntervalRefillStrategy class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time_provider
|
ITimeProvider
|
Provides the current time used for determining how much time has elapsed between invocations of the refill method |
required |
refill_amount
|
int
|
Defines the constant number of tokens to be made available for consumption each time the provided refill_interval has passed |
required |
refill_interval
|
timedelta
|
The amount of time that must pass before adding the specified refill_amount back to the bucket |
required |
refill
refill() -> int
Computes the number of new tokens made available to the bucket for consumption by determining the number of time intervals that have passed and multiplying by the number of tokens to refill for each time interval.