TT® REST API 2.0

ttbacktest Documentation

Overview

The ttbacktest service of the TT REST API is used for starting and stopping backtests for ADL algos as well as retrieving their results.

Prior to using this service via the REST API, TT recommends reviewing the existing documentation on the GUI-based version located at: https://library.tradingtechnologies.com/tt-backtesting/

Environments

TT Backtesting can only be accessed in the simulation environment.

Therefore, all requests to the ttbacktest service of the TT REST API use the following base URL:

https://ttrestapi.trade.tt/ttbacktest/ext_prod_sim

Note: When submitting requests, all API urls are case sensitive and should include the endpoint name in lowercase. For example, using https://ttrestapi.trade.tt/TTBACKTEST/ext_prod_sim/ results in a 403 server error.

You must use https://ttrestapi.trade.tt/ttbacktest/ext_prod_sim/ in order to properly reach the API.

Access Parameters

Calls to the ttbacktest services listed below require both of the following in your header:

  • Application Key
    • x-api-key=<application key>
  • Token
    • Authorization=Bearer <token>

For instructions on obtaining your application key and token, refer to the related sections in the TT REST Web Services documentation.

Test calls

The documentation uses only the User Acceptance Testing (UAT) environment to submit test calls. You cannot submit test calls from the documentation to the Prod SIM environment.

Due to this limitation, test calls from the documentation are not supported for ttbacktesting.

Submitting a Backtest

Use the /algobacktest POST endpoint to submit a new backtest and populate the related backtest parameters.

Backtest Status

Prior to retrieving the backtest results, you must use the /algobacktest/{backtestId} GET endpoint to check the execution status of the backtest. This endpoint returns one of the following statuses:

  • PENDING = the backtest is connecting to the TT backend and preparing to launch.
  • LAUNCHING = the backtest instance has spun up and is preparing to run.
  • PRICE_DOWNLOAD = the backtest is downloading the market data playback files
  • INITIALIZATION = starting the backtest components
  • RUNNING = the backtest has launched and is processing the market data
  • FINISHED = the backtest has completed. Users may now use the /algobacktest/{backtestId}/result endpoint to obtain the URL to download the backtest file containing the results and/or the /algobacktest/{backtestId}/fillgraph endpoint to GET the fill data.
  • SUCCESS = the backtest has completed processing and is now preparing the result file and the fill graph data.
  • STOPPED = the backtest was manually stopped by user
  • STOPPING = the user initiated a manual stop and we're waiting for the image to stop
  • FAIL = the backtest has failed

Note: TT strongly recommends checking the backtest status no more than once a minute.

Retrieving Backtest Results

After running the backtest and receiving the status of FINISHED from the /algobacktest/{backtestId} GET endpoint, you may use the /algobacktest/{backtestId}/results GET endpoint to receive the URL link to download the backtest file that contains the results of the backtest.

In addition, the /algobacktest/{backtestId}/fillgraph GET endpoint provides the data needed to build the fill graph for the selected backtest.