# Backtest a Trader

> Backtest a Hyperliquid trader before copying them. POST /api/v1/backtest returns what copying them would have done over 30 or 90 days at an exposure level and balance, with the same method as the Monthly Report.

Before choosing a trader, an agent can ask what copying them would have done: "if I had copied this trader at this level, with this balance, over the last 30 or 90 days". The answer gives the return, the worst drop, the trades copied and skipped, and the fees.

It is a simulation on past data. Past results are not a promise.

## Request

`POST /api/v1/backtest` with your session token (see [Sign In With a Wallet](https://waketrades.com/docs/api/authentication.md)):

```json
{ "leader": "0xLEADER…", "level": "equilibre", "balance": 5000, "days": 90 }
```

| Field | Values |
| --- | --- |
| `leader` | Any Hyperliquid address (the trader to test) |
| `level` | `prudent`, `equilibre` or `risque`. `advanced` can't be backtested |
| `balance` | Starting balance in USDC, from 100 to 10,000,000. Default: 5,000 |
| `days` | `30` or `90`. Default: 90 |

## Answer

```json
{
  "leader": "0xleader…",
  "level": "equilibre",
  "balance": 5000,
  "days": 90,
  "period": { "from": "2026-07-22T10:00:00.000Z", "to": "2026-10-20T10:00:00.000Z" },
  "result": { "returnPct": 15.14, "pnlUsd": 757.12, "endBalance": 5757.12, "maxDrawdownPct": 5.66, "feesUsd": 41.3, "ruined": false },
  "trades": { "leader": 40, "copied": 39, "skipped": { "already_in_coin": 1 }, "openAtEnd": 2 },
  "coverage": { "truncated": false, "from": "2026-07-22T10:00:00.000Z", "days": 90, "fills": 628 },
  "assumptions": "Copies this one leader at the level's full size …",
  "disclaimer": "Simulation on past data. Past results, not a promise.",
  "dataAt": "2026-10-20T10:00:00.000Z",
  "usage": { "used": 1, "limit": 5, "window": "24h" }
}
```

- `returnPct`, `pnlUsd`, `endBalance`: result at the end of the period, open copies valued at the current price.
- `maxDrawdownPct`: the worst drop from a peak during the period, in % of the starting balance.
- `ruined`: the simulated account fell to 10% of its start; everything was closed there.
- `trades.leader`: trades the trader opened in the period on markets WakeTrades copies. `skipped` counts the others by reason: `already_in_coin`, `exposure_cap`, `insufficient_margin`, `order_below_minimum`, `market_not_copied`, `price_moved_over_1pct`, `no_mark_price`.
- `coverage.truncated: true`: Hyperliquid no longer serves the trader's oldest fills. Trades opened before `coverage.from` are not simulated.
- `coverage.valuedAtEntry`: markets whose hourly prices were not read. Their open copies are valued at entry until they close: the result is unchanged, the worst drop may be understated.

## Method

The same as the Simulated Copy column of the [Monthly Report](https://waketrades.com/docs/leaders/monthly-report.md), for this one trader:

- Size: the level's share of the trader's position, scaled to your balance against the trader's equity (¼ at Prudent, ½ at Balanced, the full size at Risky). In your account the size is split across 3 leaders; the backtest gives this one trader the level's full size.
- Adds and reductions are followed. One position per coin. Exposure cap: 3× your balance at Prudent, 10× at Balanced, 20× at Risky. A copy that needs more margin than the account has is skipped. Copies under Hyperliquid's minimum order open at 11 USDC.
- Prices: the trader's own fill prices, plus the average copy delay cost we measured on real copies. Fees: 0.0258% per side (limit orders first, then market).
- The account is valued every hour. At −90% everything is closed. Funding is not counted.

## Limits

- 5 backtests per 24 hours during the free trial (and before activation), 20 with a paid plan. Beyond: `429 backtest_limit`.
- The trader's data is read from Hyperliquid once and kept 1 hour: a second backtest of the same trader in that hour is instant.
- One fresh Hyperliquid read per minute for the whole service, to keep the rate limit for live copying. Beyond: `429 backtest_busy` with `Retry-After: 60`.

## Errors

| Error | What to do |
| --- | --- |
| `invalid_address` | Send a 0x-prefixed address with 40 hexadecimal characters |
| `unknown_leader` | The address has no Hyperliquid account |
| `unknown_level`, `invalid_balance`, `invalid_days` | Fix the field, see Request above |
| `backtest_limit` | Wait for the 24-hour window |
| `backtest_busy` | Retry after 60 seconds |
| `backtest_failed` | Hyperliquid did not answer: retry in a minute |

Every error carries `fix` and `docs`, as in [Endpoints and Errors](https://waketrades.com/docs/api/endpoints.md#errors).

## Through MCP

The tool `backtest_leader` takes the same fields (`leader`, `level`, `balance`, `days`) and returns the same answer. See [Use WakeTrades Through MCP](https://waketrades.com/docs/api/mcp.md).
