RateGate
QuantConnect.Util.RateGate
RateGate(occurrences: int, time_unit: timedelta)
Bases: Object, IDisposable
Used to control the rate of some occurrence per unit of time.
Initializes a RateGate with a rate of occurrences per time_unit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
occurrences
|
int
|
Number of occurrences allowed per unit of time. |
required |
time_unit
|
timedelta
|
Length of the time unit. |
required |
occurrences
occurrences: int
Number of occurrences allowed per unit of time.
time_unit_milliseconds
time_unit_milliseconds: int
The length of the time unit, in milliseconds.
is_rate_limited
is_rate_limited: bool
Flag indicating we are currently being rate limited
dispose
dispose() -> None
dispose(is_disposing: bool) -> None
Releases unmanaged resources held by an instance of this class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
is_disposing
|
Optional[bool]
|
Whether this object is being disposed. |
None
|
wait_to_proceed
wait_to_proceed(milliseconds_timeout: int) -> bool
wait_to_proceed(timeout: timedelta) -> bool
wait_to_proceed() -> None
Signature descriptions:
-
Blocks the current thread until allowed to proceed or until the specified timeout elapses.
-
Blocks the current thread indefinitely until allowed to proceed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
milliseconds_timeout
|
Optional[int]
|
Number of milliseconds to wait, or -1 to wait indefinitely. |
None
|
timeout
|
Optional[timedelta]
|
|
None
|
Returns:
| Type | Description |
|---|---|
Optional[bool]
|
true if the thread is allowed to proceed, or false if timed out. |