Skip to main content

algo-backtest

Overview

This Algorithm Backtest tool provides back-testing for Ember trading strategies. It works by advancing a virtual clock, initially set at some specified time in the past, and replaying historical market data from configured algorithm subscription TimeBase streams and order requests from provided journal JSON file. The orders issued by the tested algorithm are routed to the simulator trading algorithms that are consuming the same market data during the test.

The tool collects statistics on orders issued by the algorithm and displays the resulting data after running through the test time interval specified by the user.

Setup

To use the algo-backtest, follow these steps:

  1. Open a console window.

  2. Set EMBER_HOME environment variable to the location of your Execution Server (ES) home. Make sure Ember config folder contains ember.conf file with the configuration for the tested trading algorithm and the simulation algorithms.

    set EMBER_HOME=/deltix/emberhome
  3. Launch the tool:

    <ember-deploy-dir>/bin/algo-backtest -algorithm STA -simulators COINBASE BOS -start 2023-11-17T09:00:00-05 -duration P1D

    In this command example algo-backtest is given these parameters: tested algorithm and simulator algorithms IDs, start time and duration of the test. Here is the description of all supported parameters and their format:

    Usage: algo-backtest -a <arg> -t <arg> -d <arg> [-i <arg>] [-l <arg>] [-s <arg>] [-j <arg>]
    -a,--algorithm <arg> Name of the algorithm to test
    -d,--duration <arg> Test duration in java duration format. For example "P2DT3H4M" parses as
    "2 days, 3 hours and 4 minutes"
    -i,--tick <arg> Time interval in Ns to use as a time step for the clock. 1 ms by default
    -j,--journal <arg> JSON Journal file
    -l,--dataLevel <arg> Market data model type. LEVEL_TWO is set by default but LEVEL_THREE is
    also supported
    -s,--simulators <arg> Names of the trades simulating algorithms
    -t,--start <arg> Test start time in zoned date-time format like this:
    2023-11-17T09:00:00-05