Skip to content

ManualTimeProvider

QuantConnect.Lean.Engine.DataFeeds.ManualTimeProvider

ManualTimeProvider(set_current_time_time_zone: Any = None)
ManualTimeProvider(
    current_time: Union[datetime, date],
    set_current_time_time_zone: Any = None,
)

Bases: Object, ITimeProvider

Provides an implementation of ITimeProvider that can be manually advanced through time

Signature descriptions:

  • Initializes a new instance of the ManualTimeProvider

  • Initializes a new instance of the ManualTimeProvider class

Parameters:

Name Type Description Default
set_current_time_time_zone Any

Specify to use this time zone when calling set_current_time,

None
current_time Optional[Union[datetime, date]]

The current time in the specified time zone, if the time zone is

None

advance

advance(span: timedelta) -> None

Advances the current time by the specified span

Parameters:

Name Type Description Default
span timedelta

The amount of time to advance the current time by

required

advance_seconds

advance_seconds(seconds: float) -> None

Advances the current time by the specified number of seconds

Parameters:

Name Type Description Default
seconds float

The number of seconds to advance the current time by

required

get_utc_now

get_utc_now() -> datetime

Gets the current time in UTC

Returns:

Type Description
datetime

The current time in UTC.

set_current_time

set_current_time(time: Union[datetime, date]) -> None

Sets the current time interpeting the specified time as a local time using the time zone used at instatiation.

Parameters:

Name Type Description Default
time Union[datetime, date]

The local time to set the current time time, will be converted into UTC

required

set_current_time_utc

set_current_time_utc(time: Union[datetime, date]) -> None

Sets the current time interpreting the specified time as a UTC time

Parameters:

Name Type Description Default
time Union[datetime, date]

The current time in UTC

required