Skip to content
Back to App

API Reference

TestMax exposes two REST APIs that give you full programmatic control over backtesting, order execution, and strategy management. Whether you are building a Python trading bot, integrating with an external tool, or automating your workflow, these APIs cover everything you need.

The two APIs

TestMax has two distinct APIs, each serving a different purpose:

Simulator API

Base path: https://api.test-max.com/api/sim/

The Simulator API implements common futures-gateway request shapes. Changing the base URL alone does not migrate a bot: adapt authentication, replay-session setup and the bar loop using the Gateway Compatibility guide.

This is the API you use when writing Python strategies in the Algo Playground or when building standalone trading bots.

Authentication: Bearer token obtained via Auth/loginKey (requires an API key generated in Settings).

Covers: Authentication, accounts, contracts, order placement, positions, trades, historical bars, replay control, and simulated withdrawals in the performance phase.

Playground API

Base path: https://api.test-max.com/api/playground/

The Playground API manages the Algo Playground experience — running backtests, managing saved strategies, browsing templates, and viewing run history.

Authentication: Cookie-based JWT (same session as the web app). No additional API key required.

Covers: Strategy templates, backtest execution, speed control, strategy CRUD, and run history.

Base URL

All API requests are made to:

https://api.test-max.com

The full URL for any endpoint is the base URL plus the API path. For example:

https://api.test-max.com/api/sim/Auth/loginKey
https://api.test-max.com/api/playground/templates

Standard response format

Every API response follows a consistent JSON structure:

{
"success": true,
"errorCode": 0,
"errorMessage": null,
...data
}
FieldTypeDescription
successbooleantrue if the request succeeded, false if there was an error
errorCodenumber0 for success, non-zero for errors
errorMessagestring or nullHuman-readable error description, or null on success

Additional data fields are included alongside these three fields depending on the endpoint. For example, Account/search returns an accounts array at the top level of the response object.

Authentication overview

The Simulator API uses Bearer token authentication.

  1. Generate an API key in the TestMax web app under Settings > API Access
  2. Send a POST request to Auth/loginKey with your email and API key
  3. Receive a token in the response
  4. Include the token in all subsequent requests via the Authorization header
Authorization: Bearer <your-token>

Tokens can be refreshed with Auth/validate and invalidated with Auth/logout.

See the Authentication page for the complete auth flow with code examples.

Rate limits

TestMax enforces the following limits to ensure fair usage:

LimitValue
Max concurrent backtests per user1
Backtest execution timeout30 minutes
Memory for one backtest2 GB for the script and every process it starts together
Processes and threads for one backtest64
Max strategy script size200 KB
Playground speed range1x to 50x
Auth/loginKey attempts10 per 15 minutes per IP, 5 per 15 minutes per email
History/retrieveBars requests20 per minute per account
Replay/start calls20 per minute per account; at most 10 live replay sessions per account (the 11th answers errorCode 4)
Playground CRUD/control endpoints100 per minute per user
Daily bar budget (bulk loads)1,000,000 bars per account per UTC day

When a rate limit is hit, the API responds with HTTP 429 and a Retry-After header telling you how many seconds to wait.

Trading and replay endpoints (Order/*, Position/*, and Replay/* other than Replay/start) have no per-minute limits — the simulator is designed for rapid-fire order placement and bar stepping within a single session.

The daily bar budget covers bulk loads only: History/retrieveBars and the chart’s own history loads. Stepping a replay (Replay/step) is not billed against it, so a backtest that walks a whole session never exhausts it. Stepping and jumping do count against the separate daily streaming allowance and the per-second egress rate: over either, Replay/step and Replay/jumpTo answer HTTP 429 with a Retry-After; while the session is loading its next data window or another operation holds it, they answer HTTP 503 with Retry-After: 1. Retry both with a bounded backoff — the bundled api() helper does. Exceeding the budget returns HTTP 429 with "Daily data limit reached. Resets at 00:00 UTC." and a Retry-After pointing at the reset. An identical History/retrieveBars request (same contract, window, time range and limit) repeated within 5 minutes is served from cache and is not billed again — re-running a backtest over the same range costs one pull, not one per run.

Getting started

The fastest way to start using the API is through the Algo Playground, where authentication and session setup are handled automatically. If you want to build a standalone bot or integrate directly:

  1. Create an account at test-max.com
  2. Generate an API key in Settings > API Access
  3. Authenticate via POST Auth/loginKey
  4. Search for accounts via POST Account/search
  5. Find your contract via POST Contract/search
  6. Start a replay session via POST Replay/start
  7. Step through bars and place orders using the Order and Replay endpoints
  8. End the session via POST Replay/end to get final results

API reference sections