The scheduler class is used to run functions with a low-overhead CPU cost, as well as pass cached arguments & data. This allows single functions to double as asynchronous logic that can be used across exchanges & currencies.
A scheduler can be created by calling
|Fill with a function reference to be called in the scheduler thread.
|Time interval for the given function to run.
|str or int/float
|Optional boolean. If set to
True, the scheduler will not start until
.start() is run.
|Align the scheduler with intervals in UTC. ex: if the interval is '1h' then with sync it will only run at *:00
|Arguments to pass into the callback function. This can be used to distinguish what the logic in the callback should do.
|A scheduler object
scheduler = blankly.Scheduler(price_event, '2m')
Start a scheduler. This only needs to be used if
initially_stopped is set to
|Optional argument to override any duplicate thread protection.
Get the interval in seconds that the scheduler is running on.
|The scheduler interval in seconds
Get the custom arguments that were passed during construction.
|A dictionary containing all the key/value pairs that were added during construction.
Raise a stop flag that will be checked on the next scheduler run & stop the thread.
Get the callback function that the scheduler is attached to.
|The callable object passed in during object construction.