The engine

The AWTS engine is a simulation-based time-series engine for backtesting, market replay, live visualization as well as running strategies. It supports parallelized execution, and live casting of state data to dashboards.

In essence, it is an event-based time-driven simulation that ticks as new data becomes available.

Each "Run" of the engine begins with configuration, including specifying one or more data sources to connect to. It can optionally be connected to Dash charts and/or a Strategy.

The Run then starts at a configurable time T1, and as new data becomes available, ticks through to time T2.

The engine is hosted by the Runner, and how to set it up is covered there.

Key principles

  • Time is treated as continuous
  • The engine 'ticks' periodically, at a rate governed by new data becoming available
  • Data comes from Data sources and hence automatically cope with latency; i.e. not just when data happened, but when we can realistically know about it.
  • Any number of data sources can be connected, on multiple timeframes. The engine will tick every time there is new data (i.e. at the lowest timeframe)

Use cases

By "casting" to a Dash chart, the engine can be used for live charting and historic replay

By connecting a Strategy and a Book, the engine can be used for backtesting, paper and live trading.

Connecting a strategy, and casting to a dash chart (with a 'delay') can be used for time-accelerated visualization of strategy performance across a backtest. This can be especially powerful in seeing visually how the strategy behaves in different circumstances. Note this is not possible for strategies that simultaneously manage a portfolio of open positions across a broad set of instruments.

Start/end date + delay

A typical backtest would be configured with start and end dates in the past, and no delay. The engine will then tick as fast as possible through the connected data.

A start + end date in the past, and a non-zero delay - e.g. 250ms - per tick makes a good setting for a time-accelerated replay of past data.

If both start and end date are omitted, the engine will run live in real-time from 'now'. Setting an end date in the future will cause the engine run to stop when that time is reached.

Setting a start date in the past, and omitting an end date (or setting an end date in the future) will cause the engine to speed through historic data and proceed directly into real-time data. This setup is not permitted if a strategy is connected (i.e. it is invalid for backtesting and paper/live trading).