LeakyBucketControlParameters
QuantConnect.Packets.LeakyBucketControlParameters
LeakyBucketControlParameters()
LeakyBucketControlParameters(
capacity: int,
refill_amount: int,
time_interval_minutes: int,
)
Bases: Object
Provides parameters that control the behavior of a leaky bucket rate limiting algorithm. The parameter names below are phrased in the positive, such that the bucket is filled up over time vs leaking out over time.
Signature descriptions:
-
Initializes a new instance of the LeakyBucketControlParameters using default values
-
Initializes a new instance of the LeakyBucketControlParameters with the specified value
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
capacity
|
Optional[int]
|
The total capacity of the bucket in minutes |
None
|
refill_amount
|
Optional[int]
|
The number of additional minutes to add to the bucket |
None
|
time_interval_minutes
|
Optional[int]
|
The interval, in minutes, that must pass before the refill_amount |
None
|
default_capacity
default_capacity: int
default_time_interval
default_time_interval: int
Default time interval
default_refill_amount
default_refill_amount: int
Default refill amount
capacity
capacity: int
Sets the total capacity of the bucket in a leaky bucket algorithm. This is the maximum number of 'units' the bucket can hold and also defines the maximum burst rate, assuming instantaneous usage of 'units'. In reality, the usage of 'units' takes times, and so it is possible for the bucket to incrementally refill while consuming from the bucket.
refill_amount
refill_amount: int
Sets the refill amount of the bucket. This defines the quantity of 'units' that become available to a consuming entity after the time interval has elapsed. For example, if the refill amount is equal to one, then each time interval one new 'unit' will be made available for a consumer that is throttled by the leaky bucket.
time_interval_minutes
time_interval_minutes: int
Sets the time interval for the refill amount of the bucket, in minutes. After this amount of wall-clock time has passed, the bucket will refill the refill amount, thereby making more 'units' available for a consumer. For example, if the refill amount equals 10 and the time interval is 30 minutes, then every 30 minutes, 10 more 'units' become available for a consumer. The available 'units' will continue to increase until the bucket capacity is reached.