Execution engine

AWTS includes a powerful and general purpose execution engine. The same engine is used for a wide variety of activities from general charting to backtesting to production execution of live strategies.

The AWTS execution engine is simulation/event based (not vectorised) - i.e. it ticks, at an interval defined by input data streams, and each tick is considered to be at time T and has all information available at time T to make decisions.

From the strategy's (and engine's) perspective, there is no difference between backtest and live. No difference between replay, paper and real-money trading. Strategies don't even know which they are running in.

The engine is hosted by the Runner, its setup is defined by a job spec and strategies are tested and run by running jobs.

Structure

Runner hosts Jobs. Some of those Jobs run the Engine.

The engine is configured according to the Job Spec, which includes details as to which Data sources to include, and on what timeframes.

When started, the engine backfills from the back_from timestamp up to the start_at timestamp - so that sufficient backdata is available to the strategies (e.g. 200 candles are needed so that a 200SMA can be calculated from the first tick of the run).

It then runs the strategy from the start_at timestamp up to the end_at timestamp. The engine ticks - and runs the strategy - on every time interval, governed by the lowest resolution data source. E.g. a spec including M1 candles and daily candles would tick for each minute (i.e. for every M1 candle).

Backtests are achieved by having start_at and end_at in the past; in these scenarios data is streamed from the data sources into the engine at full speed and the strategy runs on each tick.

Real-time running (forward testing, paper or production!) is achieved by setting start_at to null or in the future. The engine will then run only in real-time, up to end_at - or indefinitely if end_at is null.

Replay of historic data, and replay of backtests, is achieved by setting replay_delay to a non-zero value. The value is specified in ms (milliseconds) as the time to wait/delay on each tick. Using this, in conjunction with cast enables a fast and easy-to-use time-accelerated replay mode to visually inspect price action vs the behaviour of your strategy.

On each tick

Strategies

Execution

Exposure

BP/Margin

Capital allocation

X/Y axes

Indicators

In AWTS, indicators are defined as 'any quantiative measure derived from price, volume and time from one or more data sources'. I.e. a very broad definition.

Indicators may generate (or amend!) values on every engine tick - but indicators are not just time series!

Indicator types

Series

Level

Line

Event

Built-in indicators

Creating custom indicators