Skip to content

IIsolatorLimitResultProvider

QuantConnect.IIsolatorLimitResultProvider

Provides an abstraction for managing isolator limit results. This is originally intended to be used by the training feature to permit a single algorithm time loop to extend past the default of ten minutes

consume

consume(
    scheduled_event: ScheduledEvent,
    scan_time_utc: Union[datetime, date],
    time_monitor: TimeMonitor,
) -> None
consume(
    time_provider: ITimeProvider,
    code: Callable[[], Any],
    time_monitor: TimeMonitor,
    name: str = None,
) -> None

Signature descriptions:

  • Convenience method for invoking a scheduled event's Scan method inside the IsolatorLimitResultProvider

  • Executes the provided code block and while the code block is running, continually consume from the limit result provided one token each minute. This function allows the code to run for the first full minute without requesting additional time from the provider. Following that, every minute an additional one minute will be requested from the provider.

is_within_limit

is_within_limit() -> IsolatorLimitResult

Determines whether or not a custom isolator limit has be reached.

request_additional_time

request_additional_time(minutes: int) -> None

Requests additional time from the isolator result provider. This is intended to prevent is_within_limit from returning an error result. This method will throw a TimeoutException if there is insufficient resources available to fulfill the specified number of minutes.

Parameters:

Name Type Description Default
minutes int

The number of additional minutes to request

required

try_request_additional_time

try_request_additional_time(minutes: int) -> bool

Attempts to request additional time from the isolator result provider. This is intended to prevent is_within_limit from returning an error result. This method will only return false if there is insufficient resources available to fulfill the specified number of minutes.

Parameters:

Name Type Description Default
minutes int

The number of additional minutes to request

required