---
title: "Test a simple strategy on the real trade history of an asset"
method: POST
path: "/v1/backtest"
---

# Test a simple strategy on the real trade history of an asset

`POST /v1/backtest`

## Request

- Base URL: `https://qmax.exchange/api`
- URL: `https://qmax.exchange/api/v1/backtest`
- Auth: none declared

Replays a strategy over hourly candles of real QX fills and QSwap swaps. A price-based strategy decides on the close of an hour and trades at the open of the next hour with trades; hold and dca follow the calendar. Fees are the contracts' own (QX 0.3% from the seller; QSwap a flat 100,000 QU per swap, with its 0.3% pool fee already inside its prices). Order book depth was not kept, so every fill is assumed at the candle price: optimistic for large amounts and thin assets. Past results do not predict future ones.

## Request body

- object
  - `asset` string, required
  - `range` '30d' | '90d' | 'all'
  - `venue` 'auto' | 'QX' | 'QSwap' | 'all': Which market's trades make the price series. 'all' joins both and charges each trade the cheaper venue's fees.
  - `startingQu` integer, required
  - `strategy` object, required: hold: no settings. dca: amountQu (default 500000, fees included) every everyHours (default 168). bands: lookbackHours (168), bandPct (5), fractionPct (25), cooldownHours (24).
    - `type` 'hold' | 'dca' | 'bands', required
    - `amountQu` integer
    - `everyHours` integer
    - `lookbackHours` integer
    - `bandPct` number
    - `fractionPct` number
    - `cooldownHours` integer

## Response `200`

The summary sentence, the trades, the equity curve, metrics and warnings, with the inputs echoed back

## Other responses

- `400`: A setting is missing or out of range; `error` names each one
- `404`: Unknown asset

---

[API](https://skmtc.dev/qmax/apis/qmax-api.md) · [All operations](https://skmtc.dev/qmax/apis/qmax-api/llms.txt) · [OpenAPI document](https://skmtc.dev/qmax/apis/qmax-api/revisions/af70e2813a7a?raw)
