> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sandmark.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Backtesting

> Test an options strategy on years of crypto derivatives history with one request.

The Backtesting API runs an options strategy over history and returns what would have happened: the equity
curve, every fill, the positions they belonged to and the full set of performance statistics. You describe the
strategy as JSON; there is nothing to install and no data to download.

```bash theme={null}
curl -X POST https://api.sandmark.com/backtesting/v1/backtest \
  -H "X-API-Key: $SANDMARK_BACKTEST_KEY" \
  -H "Content-Type: application/json" \
  --data @covered-call.json
```

## What you can express

> [card] Any structure up to 8 legs
>
> Calls, puts and dated futures, long or short, with strikes chosen by delta, moneyness or price. Straddles,
> strangles, spreads, condors, butterflies, collars and calendars.

> [card] Expiry selection
>
> Front monthly, the nth listed expiry, a target tenor, or only certain weekdays, set for the whole structure
> or per leg.

> [card] Exit rules
>
> Close on days to expiry, premium decay, P\&L, a leg's delta, IV, spot or days held, measured against entry or
> the high-water mark.

> [card] Hedging and costs
>
> Delta, vega or gamma hedging with futures and options. Mark or bid/ask fills, slippage, taker fees and the
> exchange's fee cap.

## Ground rules

> [accordion] Everything is denominated in coin
>
> Inverse BTC and ETH options are quoted and settled in the base coin, so that is the ledger: equity,
> premiums, fees and P\&L are in BTC (or ETH). `equity_usd` and `spot` are reported alongside for reading in
> dollars.

> [accordion] History starts in September 2021
>
> Option marks, greeks and implied vol exist from September 2021 for BTC and ETH, February 2024 for SOL and
> March 2024 for XRP. How far back you can start depends on your
> [add-on plan](https://docs.sandmark.com/backtesting/plans-and-limits.md).

> [accordion] Warnings are part of the result
>
> Silent data holes are how an options backtest lies. Degraded fills, carried-forward marks and structures
> the chain could not resolve are counted in `warnings` and `diagnostics` on every result. Read them before
> you trust a number.

> [accordion] Results come back in four formats
>
> JSON for code, a self-contained HTML report with charts, a zip of CSVs, or an Excel workbook. Pick one
> with `format`.

## Next steps

> [card] [Quickstart](https://docs.sandmark.com/backtesting/quickstart.md)
>
> Run your first backtest in five minutes.

> [card] [Strategy specification](https://docs.sandmark.com/backtesting/strategy-spec.md)
>
> Every field of the request body.

> [card] [Recipes](https://docs.sandmark.com/backtesting/recipes.md)
>
> Five tested strategies to copy and adapt.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.