Skip to content
All library documents

Registering Timed Callbacks and Running Async Tasks

Article Quant course library

Summary

This guide explains two ways to schedule asynchronous work in an event-driven trading application. A loop-run task registers an asynchronous callback at a specified interval, measured in seconds, and returns an identifier that can later be used to unregister it. The text says callbacks are triggered during a once-per-second heartbeat and notes that the heartbeat count can help determine when work should run. The callback is expected to accept arbitrary positional and keyword arguments.

A separate single-task mechanism starts an asynchronous callback with supplied arguments, allowing coroutine work to run concurrently. The document focuses on task registration and invocation rather than trading logic or market data. It provides no measurements of runtime improvement, scheduling precision, or failure behavior. It also does not discuss exception handling, task cancellation for single tasks, or safeguards against slow callbacks, so those operational details would need separate consideration.

Key ideas

  • Timed callbacks must be asynchronous and accept arbitrary positional and keyword arguments.
  • A loop-run task can be registered with an interval and later unregistered by its task identifier.
  • The scheduler checks timed work through a one-second heartbeat.
  • A single-task runner starts an asynchronous callback with the provided arguments.
  • The guide gives no performance measurements or exception-handling guidance.

Tags

From a private course collection; the original is not published.