# Backtest Finder API

Search millions of precomputed option strategy backtests by ticker and strategy, then retrieve full results: summary stats, monthly returns, trade logs, and daily returns. The finder powers the [Options Backtester](https://orats.com/backtester) in the ORATS dashboard.

Authentication uses the token query parameter only. Do not send an Authorization header: clients that forward headers across redirects will break the Results Stats endpoint, which redirects to a presigned S3 URL.

Precomputed backtests are available for these strategies: IronButterfly, IronCondor, LongCall, LongCallCalendar, LongCallSpread, LongPut, LongPutCalendar, LongPutSpread, LongStraddle, ShortCall, ShortCallSpread, ShortPut, ShortPutSpread, ShortStraddle, and ShortStrangle. Requesting a ticker and strategy combination that has not been precomputed returns a 500 error; use the Catalog endpoint below to discover which combinations exist. Validation errors can arrive with a 200 status and a message field in the body, so inspect the body as well as the status code.

Product overview and pricing for this and the other Tools APIs live on the [Tools APIs page](https://orats.com/tools-apis).

Base URL: `https://api.orats.io/backtest-finder`

---

## Catalog

`GET https://api.orats.io/backtest-finder/catalog`

Retrieves the universe of precomputed backtests: every ticker, the strategies precomputed for it, and the number of stored backtests per ticker and strategy combination. Use it to populate ticker and strategy pickers and to avoid the 500 error a never-precomputed combination returns from the Performance endpoint.

The response is an object keyed by ticker; each value is an array of strategy entries.

### Required attributes

No attributes beyond the token.

**cURL**

```bash
curl -L "https://api.orats.io/backtest-finder/catalog?token=my-token"
```

**Response**

```json
{
  "SPY": [
    {
      "strategy": "IronButterfly",
      "count": 1080
    },
    {
      "strategy": "IronCondor",
      "count": 5701
    }
  ],
  "AAPL": [
    {
      "strategy": "ShortPutSpread",
      "count": 4662
    }
  ]
}
```

---

## Performance

`POST https://api.orats.io/backtest-finder/performance`

Retrieves ranked backtest performance rows for a ticker and strategy. The response is an array of up to 100 rows, each holding the ranked performance metrics, the leg targets, the entry and exit triggers, and the full input configuration.

Each row's id can be passed to the Performance by Id and Results endpoints below, and its rootBaseId can be passed to the Backtest Input endpoint.

### Required attributes

- `ticker` (string): The underlying symbol to search. Ex: SPY
- `strategy` (string): The strategy to search, from the precomputed list above. Ex: IronCondor
- `rank` (string): The ranking to order results by: a composite (bestReturnOnRisk, bestOverallPerformance, bestConservativeWinner) or a metric id such as annualReturn, sharpe, sortino, or maxDrawDown. bestReturnOnRisk is scored for every ticker; the other two composites are not scored for some tickers and ranking by them there currently fails with a 502.

### Optional attributes

- `rankDir` (string): Orders the rank positions: asc returns the best-ranked rows first, desc returns the worst first. Defaults to asc.
- `filters` (object): Metric bands that narrow candidates before ranking. Each key is a metric id with a min and/or max, for example pctOfTimeInMarket with min 40, marginToStockPct with max 40, riskRewardAvg with min 0.07. Defaults to no filters.
- `currentEnvironment` (object): Set to null (the default) to search all backtests regardless of the current market environment. Pass an object of the five entry-trigger levels to keep only backtests whose entry triggers match it: each of entryVix, entrySma, entryRsi, entryIvPct, and entrySlopePct on a row must be none or equal one of the supplied values (entrySma accepts an array, e.g. ["below50d","above200d"]). Level values come from the current-environment endpoint of the Data API for the same ticker. Results are ranked by the same rank and rankDir as an unfiltered search.

**cURL**

```bash
curl -L "https://api.orats.io/backtest-finder/performance?token=my-token" \
  -H "Content-Type: application/json" \
  -d '{
    "ticker": "SPY",
    "strategy": "IronCondor",
    "currentEnvironment": null,
    "filters": {},
    "rank": "bestReturnOnRisk",
    "rankDir": "asc"
  }'
```

**Response**

```json
[
  {
    "rank": 1,
    "id": "0185013a5010d4ce4519bc8106d0d7ed",
    "ticker": "SPY",
    "strategy": "IronCondor",
    "dte1Target": 45,
    "dte2Target": 45,
    "dte3Target": 45,
    "dte4Target": 45,
    "delta1Target": 0.12,
    "delta2Target": 0.22,
    "delta3Target": 0.22,
    "delta4Target": 0.12,
    "lrDteLeg1Leg2Min": 0,
    "lrDteLeg1Leg2Max": 0,
    "lrDteLeg2Leg3Min": 0,
    "lrDteLeg2Leg3Max": 0,
    "lrDteLeg3Leg4Min": 0,
    "lrDteLeg3Leg4Max": 0,
    "lrSwLeg1Leg2Min": 1,
    "lrSwLeg1Leg2Max": 5,
    "lrSwLeg2Leg3Min": 1,
    "lrSwLeg2Leg3Max": 5,
    "lrSwLeg3Leg4Min": 1,
    "lrSwLeg3Leg4Max": 5,
    "spreadYieldLevel": "moderate",
    "spreadYieldTarget": -0.0068547,
    "spreadYieldMin": -0.0071025,
    "spreadYieldMax": -0.006607,
    "strikeDiffPctLevel": "none",
    "strikeDiffPctTarget": null,
    "strikeDiffPctMin": null,
    "strikeDiffPctMax": null,
    "entryVix": "none",
    "entrySma": "below50d",
    "entryRsi": "moderate",
    "entryIvPct": "none",
    "entrySlopePct": "none",
    "exitStopLoss": "-75",
    "exitProfit": "25",
    "annualReturn": 4.14,
    "annualMarginReturn": 170.07,
    "annualReturnBull": null,
    "annualReturnBear": null,
    "annualReturn1Yr": null,
    "annualReturn5Yr": null,
    "sharpe": 8.16,
    "sortino": 119.58,
    "volatility": 0.51,
    "maxDrawDown": -0.13,
    "drawDownDays": 86,
    "bestMonthRtn": 0.24,
    "worstMonthRtn": -0.06,
    "bestYearRtn": 0.18,
    "worstYearRtn": 0.18,
    "bestTradePL": 22,
    "worstTradePL": 22,
    "bestTradePct": 0.15,
    "worstTradePct": 0.15,
    "plPerTradeAvg": 22,
    "plPerDayAvg": 2.36,
    "plPerTradeAvgPct": 0.18145,
    "plPerDayAvgPct": 0.0165,
    "stratWinRate": 100,
    "daysInTradeAvg": 14,
    "totStratTrades": 1,
    "totStratPL": 22,
    "totStratPLPct": 0,
    "creditReceivedPerTradeAvg": 97,
    "marginPerTradeAvg": 349,
    "mostMarginUsed": 349,
    "leastMarginUsed": 349,
    "bestTradePctMargin": 6.3,
    "worstTradePctMargin": 6.3,
    "marginToStockPct": 2.44,
    "riskRewardAvg": 0.320132,
    "pctOfTimeInMarket": 0.23,
    "bestReturnOnRisk": 99.99999999,
    "bestOverallPerformance": null,
    "bestConservativeWinner": null,
    "startDate": "2007-01-03",
    "endDate": "2026-01-06",
    "baseId": "8376cbdfd263ca1a1b2c349b8c1dcedf",
    "executionTime": 0.01,
    "createdDate": "2026-01-22 01:15:24.0",
    "updatedAt": "2026-01-22 01:15:24.0",
    "v": "2026-Q2-prod",
    "rootBaseId": "222c018f7a838983a4cf7bcb476e620d",
    "rootBaseId_1": "222c018f7a838983a4cf7bcb476e620d",
    "rootBaseId_2": "222c018f7a838983a4cf7bcb476e620d",
    "input": {
      "legs": [
        {
          "deltaMax": 0.2,
          "deltaMin": 0.05,
          "deltaTarget": 0.12,
          "dteMax": 66,
          "dteMin": 30,
          "dteTarget": 45,
          "ratio": 1,
          "type": "call"
        },
        {
          "deltaMax": 0.3,
          "deltaMin": 0.15,
          "deltaTarget": 0.22,
          "dteMax": 66,
          "dteMin": 30,
          "dteTarget": 45,
          "ratio": -1,
          "type": "call"
        },
        {
          "deltaMax": 0.3,
          "deltaMin": 0.15,
          "deltaTarget": 0.22,
          "dteMax": 66,
          "dteMin": 30,
          "dteTarget": 45,
          "ratio": -1,
          "type": "put"
        },
        {
          "deltaMax": 0.2,
          "deltaMin": 0.05,
          "deltaTarget": 0.12,
          "dteMax": 66,
          "dteMin": 30,
          "dteTarget": 45,
          "ratio": 1,
          "type": "put"
        }
      ],
      "lrDte": [
        {
          "max": 0,
          "min": 0,
          "name": "leg1Leg2"
        },
        {
          "max": 0,
          "min": 0,
          "name": "leg2Leg3"
        },
        {
          "max": 0,
          "min": 0,
          "name": "leg3Leg4"
        }
      ],
      "lrSw": [
        {
          "max": 5,
          "min": 1,
          "name": "leg1Leg2"
        },
        {
          "max": 5,
          "min": 1,
          "name": "leg2Leg3"
        },
        {
          "max": 5,
          "min": 1,
          "name": "leg3Leg4"
        }
      ],
      "spreadYield": {
        "level": "moderate",
        "target": -0.0068547,
        "min": -0.0071025,
        "max": -0.006607
      },
      "strategy": "IronCondor",
      "ticker": "SPY",
      "entryVix": "none",
      "entryRsi": "moderate",
      "entrySma": "below50d",
      "entryIvPct": "none",
      "entrySlopePct": "none",
      "exitStopLoss": "-75",
      "exitProfit": "25"
    }
  }
]
```

---

## Performance by Id

`GET https://api.orats.io/backtest-finder/performance`

Retrieves a single backtest performance row by its id, from any ticker and strategy — no other attributes are required. The row has the same shape as the Performance endpoint's rows, including the full input configuration, so one call recovers everything about a stored backtest from its id alone.

The response is an array holding the one matching row. Unknown ids return an empty array with a 200 status, never a 404.

### Required attributes

- `id` (string): The id from a Performance row. Ex: 0185013a5010d4ce4519bc8106d0d7ed

**cURL**

```bash
curl -L "https://api.orats.io/backtest-finder/performance?token=my-token&id=0185013a5010d4ce4519bc8106d0d7ed"
```

**Response**

```json
[
  {
    "rank": 1,
    "id": "0185013a5010d4ce4519bc8106d0d7ed",
    "ticker": "SPY",
    "strategy": "IronCondor",
    "dte1Target": 45,
    "dte2Target": 45,
    "dte3Target": 45,
    "dte4Target": 45,
    "delta1Target": 0.12,
    "delta2Target": 0.22,
    "delta3Target": 0.22,
    "delta4Target": 0.12,
    "lrDteLeg1Leg2Min": 0,
    "lrDteLeg1Leg2Max": 0,
    "lrDteLeg2Leg3Min": 0,
    "lrDteLeg2Leg3Max": 0,
    "lrDteLeg3Leg4Min": 0,
    "lrDteLeg3Leg4Max": 0,
    "lrSwLeg1Leg2Min": 1,
    "lrSwLeg1Leg2Max": 5,
    "lrSwLeg2Leg3Min": 1,
    "lrSwLeg2Leg3Max": 5,
    "lrSwLeg3Leg4Min": 1,
    "lrSwLeg3Leg4Max": 5,
    "spreadYieldLevel": "moderate",
    "spreadYieldTarget": -0.0068547,
    "spreadYieldMin": -0.0071025,
    "spreadYieldMax": -0.006607,
    "strikeDiffPctLevel": "none",
    "strikeDiffPctTarget": null,
    "strikeDiffPctMin": null,
    "strikeDiffPctMax": null,
    "entryVix": "none",
    "entrySma": "below50d",
    "entryRsi": "moderate",
    "entryIvPct": "none",
    "entrySlopePct": "none",
    "exitStopLoss": "-75",
    "exitProfit": "25",
    "annualReturn": 4.14,
    "annualMarginReturn": 170.07,
    "annualReturnBull": null,
    "annualReturnBear": null,
    "annualReturn1Yr": null,
    "annualReturn5Yr": null,
    "sharpe": 8.16,
    "sortino": 119.58,
    "volatility": 0.51,
    "maxDrawDown": -0.13,
    "drawDownDays": 86,
    "bestMonthRtn": 0.24,
    "worstMonthRtn": -0.06,
    "bestYearRtn": 0.18,
    "worstYearRtn": 0.18,
    "bestTradePL": 22,
    "worstTradePL": 22,
    "bestTradePct": 0.15,
    "worstTradePct": 0.15,
    "plPerTradeAvg": 22,
    "plPerDayAvg": 2.36,
    "plPerTradeAvgPct": 0.18145,
    "plPerDayAvgPct": 0.0165,
    "stratWinRate": 100,
    "daysInTradeAvg": 14,
    "totStratTrades": 1,
    "totStratPL": 22,
    "totStratPLPct": 0,
    "creditReceivedPerTradeAvg": 97,
    "marginPerTradeAvg": 349,
    "mostMarginUsed": 349,
    "leastMarginUsed": 349,
    "bestTradePctMargin": 6.3,
    "worstTradePctMargin": 6.3,
    "marginToStockPct": 2.44,
    "riskRewardAvg": 0.320132,
    "pctOfTimeInMarket": 0.23,
    "bestReturnOnRisk": 99.99999999,
    "bestOverallPerformance": null,
    "bestConservativeWinner": null,
    "startDate": "2007-01-03",
    "endDate": "2026-01-06",
    "baseId": "8376cbdfd263ca1a1b2c349b8c1dcedf",
    "executionTime": 0.01,
    "createdDate": "2026-01-22 01:15:24.0",
    "updatedAt": "2026-01-22 01:15:24.0",
    "v": "2026-Q2-prod",
    "rootBaseId": "222c018f7a838983a4cf7bcb476e620d",
    "rootBaseId_1": "222c018f7a838983a4cf7bcb476e620d",
    "rootBaseId_2": "222c018f7a838983a4cf7bcb476e620d",
    "input": {
      "legs": [
        {
          "deltaMax": 0.2,
          "deltaMin": 0.05,
          "deltaTarget": 0.12,
          "dteMax": 66,
          "dteMin": 30,
          "dteTarget": 45,
          "ratio": 1,
          "type": "call"
        },
        {
          "deltaMax": 0.3,
          "deltaMin": 0.15,
          "deltaTarget": 0.22,
          "dteMax": 66,
          "dteMin": 30,
          "dteTarget": 45,
          "ratio": -1,
          "type": "call"
        },
        {
          "deltaMax": 0.3,
          "deltaMin": 0.15,
          "deltaTarget": 0.22,
          "dteMax": 66,
          "dteMin": 30,
          "dteTarget": 45,
          "ratio": -1,
          "type": "put"
        },
        {
          "deltaMax": 0.2,
          "deltaMin": 0.05,
          "deltaTarget": 0.12,
          "dteMax": 66,
          "dteMin": 30,
          "dteTarget": 45,
          "ratio": 1,
          "type": "put"
        }
      ],
      "lrDte": [
        {
          "max": 0,
          "min": 0,
          "name": "leg1Leg2"
        },
        {
          "max": 0,
          "min": 0,
          "name": "leg2Leg3"
        },
        {
          "max": 0,
          "min": 0,
          "name": "leg3Leg4"
        }
      ],
      "lrSw": [
        {
          "max": 5,
          "min": 1,
          "name": "leg1Leg2"
        },
        {
          "max": 5,
          "min": 1,
          "name": "leg2Leg3"
        },
        {
          "max": 5,
          "min": 1,
          "name": "leg3Leg4"
        }
      ],
      "spreadYield": {
        "level": "moderate",
        "target": -0.0068547,
        "min": -0.0071025,
        "max": -0.006607
      },
      "strategy": "IronCondor",
      "ticker": "SPY",
      "entryVix": "none",
      "entryRsi": "moderate",
      "entrySma": "below50d",
      "entryIvPct": "none",
      "entrySlopePct": "none",
      "exitStopLoss": "-75",
      "exitProfit": "25"
    }
  }
]
```

---

## Current Environment

`POST https://api.orats.io/backtest-finder/performance/environment`

Retrieves ranked backtest performance rows whose entry triggers match the current market environment, across the precomputed environment universe of ETFs: DIA, EEM, GLD, HYG, IWM, QQQ, SPY, TLT, XLE, XLK, and XLY.

The request body is a JSON array of strategy names, not an object. Rows are ranked globally across every ticker and strategy combination, capped at 100, and have the same shape as the Performance endpoint minus a few bookkeeping fields: bestOverallPerformance, bestConservativeWinner, createdDate, updatedAt, and the duplicated rootBaseId columns. Sending an empty array returns a message that the body must be a non-empty array of strategy names.

### Required attributes

- `body` (array): A JSON array of strategy names from the precomputed list. Ex: ["IronCondor","IronButterfly"]

**cURL**

```bash
curl -L "https://api.orats.io/backtest-finder/performance/environment?token=my-token" \
  -H "Content-Type: application/json" \
  -d '["IronCondor"]'
```

**Response**

```json
[
  {
    "rank": 59,
    "id": "988c00ada5d823a1821576ec0da4d2a5",
    "ticker": "SPY",
    "strategy": "IronCondor",
    "dte1Target": 8,
    "dte2Target": 8,
    "dte3Target": 8,
    "dte4Target": 8,
    "delta1Target": 0.1,
    "delta2Target": 0.35,
    "delta3Target": 0.35,
    "delta4Target": 0.1,
    "lrDteLeg1Leg2Min": 0,
    "lrDteLeg1Leg2Max": 0,
    "lrDteLeg2Leg3Min": 0,
    "lrDteLeg2Leg3Max": 0,
    "lrDteLeg3Leg4Min": 0,
    "lrDteLeg3Leg4Max": 0,
    "lrSwLeg1Leg2Min": 1,
    "lrSwLeg1Leg2Max": null,
    "lrSwLeg2Leg3Min": 1,
    "lrSwLeg2Leg3Max": null,
    "lrSwLeg3Leg4Min": 1,
    "lrSwLeg3Leg4Max": null,
    "spreadYieldLevel": null,
    "spreadYieldTarget": -0.0304462,
    "spreadYieldMin": -0.0518128,
    "spreadYieldMax": -0.0090796,
    "strikeDiffPctLevel": null,
    "strikeDiffPctTarget": null,
    "strikeDiffPctMin": null,
    "strikeDiffPctMax": null,
    "entryVix": "none",
    "entrySma": "above50d",
    "entryRsi": "none",
    "entryIvPct": "low",
    "entrySlopePct": "none",
    "exitStopLoss": -50,
    "exitProfit": 50,
    "annualReturn": 2.04,
    "annualMarginReturn": 67.45,
    "annualReturnBull": 3.23,
    "annualReturnBear": 0.69,
    "annualReturn1Yr": 1.71,
    "annualReturn5Yr": 1.89,
    "sharpe": 0.68,
    "sortino": 1.16,
    "volatility": 2.99,
    "maxDrawDown": -2.72,
    "drawDownDays": 135,
    "bestMonthRtn": 2.45,
    "worstMonthRtn": -2.36,
    "bestYearRtn": 5.86,
    "worstYearRtn": -1,
    "bestTradePL": 619,
    "worstTradePL": -1521,
    "bestTradePct": 1.44,
    "worstTradePct": -2.5,
    "plPerTradeAvg": 21.02,
    "plPerDayAvg": 12.87,
    "plPerTradeAvgPct": 0.03529,
    "plPerDayAvgPct": 0.0187,
    "stratWinRate": 61.4,
    "daysInTradeAvg": 8,
    "totStratTrades": 1020,
    "totStratPL": 21445,
    "totStratPLPct": 0,
    "creditReceivedPerTradeAvg": 310.15,
    "marginPerTradeAvg": 1006.44,
    "mostMarginUsed": 3285,
    "leastMarginUsed": 221,
    "bestTradePctMargin": 52.25,
    "worstTradePctMargin": -84.62,
    "marginToStockPct": 3.08,
    "riskRewardAvg": 0.406324,
    "pctOfTimeInMarket": 40.35,
    "bestReturnOnRisk": 0.009208,
    "startDate": "2007-01-03",
    "endDate": "2026-01-06",
    "baseId": "2c5fa0a71a3cf39aacd069b06bd2e67c",
    "executionTime": "0.17",
    "v": "2026-Q2-prod",
    "rootBaseId": "0d2284dc0eeef69b2042b14a04859a72",
    "input": {
      "legs": [
        {
          "deltaMax": 0.2,
          "deltaMin": 0.05,
          "deltaTarget": 0.1,
          "dteMax": 16,
          "dteMin": 4,
          "dteTarget": 8,
          "ratio": 1,
          "type": "call"
        },
        {
          "deltaMax": 0.45,
          "deltaMin": 0.3,
          "deltaTarget": 0.35,
          "dteMax": 16,
          "dteMin": 4,
          "dteTarget": 8,
          "ratio": -1,
          "type": "call"
        },
        {
          "deltaMax": 0.45,
          "deltaMin": 0.3,
          "deltaTarget": 0.35,
          "dteMax": 16,
          "dteMin": 4,
          "dteTarget": 8,
          "ratio": -1,
          "type": "put"
        },
        {
          "deltaMax": 0.2,
          "deltaMin": 0.05,
          "deltaTarget": 0.1,
          "dteMax": 16,
          "dteMin": 4,
          "dteTarget": 8,
          "ratio": 1,
          "type": "put"
        }
      ]
    }
  }
]
```

---

## Backtest Input

`GET https://api.orats.io/backtest-finder/input`

Retrieves the base input configuration for a backtest: the leg definitions with delta and DTE bands, the leg relationships, and the spread yield band.

Pass the rootBaseId from a Performance row, not the row id. Unknown ids return an empty object with a 200 status, never a 404.

Note that this is the BASE configuration shared by a family of stored variants — its bands and criteria can differ from any one variant's (in the example below, the base has no spread yield criterion while the variant row above carries a moderate band). To replicate a specific backtest exactly, read the input object embedded on its Performance row instead.

### Required attributes

- `id` (string): The rootBaseId from a Performance row. Ex: 222c018f7a838983a4cf7bcb476e620d

**cURL**

```bash
curl -L "https://api.orats.io/backtest-finder/input?token=my-token&id=222c018f7a838983a4cf7bcb476e620d"
```

**Response**

```json
{
  "id": "222c018f7a838983a4cf7bcb476e620d",
  "legs": [
    {
      "deltaMax": 0.2,
      "deltaMin": 0.05,
      "deltaTarget": 0.12,
      "dteMax": 66,
      "dteMin": 30,
      "dteTarget": 45,
      "ratio": 1,
      "type": "call"
    },
    {
      "deltaMax": 0.3,
      "deltaMin": 0.15,
      "deltaTarget": 0.22,
      "dteMax": 66,
      "dteMin": 30,
      "dteTarget": 45,
      "ratio": -1,
      "type": "call"
    },
    {
      "deltaMax": 0.3,
      "deltaMin": 0.15,
      "deltaTarget": 0.22,
      "dteMax": 66,
      "dteMin": 30,
      "dteTarget": 45,
      "ratio": -1,
      "type": "put"
    },
    {
      "deltaMax": 0.2,
      "deltaMin": 0.05,
      "deltaTarget": 0.12,
      "dteMax": 66,
      "dteMin": 30,
      "dteTarget": 45,
      "ratio": 1,
      "type": "put"
    }
  ],
  "lrDte": [
    {
      "max": 0,
      "min": 0,
      "name": "leg1Leg2"
    },
    {
      "max": 0,
      "min": 0,
      "name": "leg2Leg3"
    },
    {
      "max": 0,
      "min": 0,
      "name": "leg3Leg4"
    }
  ],
  "lrSw": [
    {
      "max": 5,
      "min": 1,
      "name": "leg1Leg2"
    },
    {
      "max": 5,
      "min": 1,
      "name": "leg2Leg3"
    },
    {
      "max": 5,
      "min": 1,
      "name": "leg3Leg4"
    }
  ],
  "spreadYield": {
    "level": "none",
    "max": null,
    "min": null,
    "target": null
  },
  "strategy": "IronCondor",
  "ticker": "SPY"
}
```

---

## Results Stats

`GET https://api.orats.io/backtest-finder/results/stats`

Retrieves the full results blob for a backtest: summary statistics, monthly returns by year, the per-leg trade log, and daily returns for in-trade days.

The endpoint responds with a 302 redirect to a presigned S3 URL that expires in 300 seconds. Follow the redirect (for example with the -L flag in cURL) and do not send an Authorization header, which S3 rejects. The S3 object is gzip encoded; most HTTP clients decompress it automatically.

### Required attributes

- `id` (string): The id from a Performance row. Ex: 0185013a5010d4ce4519bc8106d0d7ed

**cURL**

```bash
curl -L --compressed "https://api.orats.io/backtest-finder/results/stats?token=my-token&id=0185013a5010d4ce4519bc8106d0d7ed"
```

**Response**

```json
{
  "summary": {
    "AnnReturn": 4.14,
    "AnnMarginReturn": 170.07,
    "AnnSharpe": 8.16,
    "AnnSortino": 119.58,
    "AnnVolatility": 0.51,
    "MaxDrawDown": -0.13,
    "DrawDownDays": 86,
    "BestMonthRtn": 0.24,
    "WorstMonthRtn": -0.06,
    "BestYearRtn": 0.18,
    "WorstYearRtn": 0.18,
    "BestTradePL": 22.0,
    "WorstTradePL": 22.0,
    "BestTradePct": 0.15,
    "WorstTradePct": 0.15,
    "PLPerTradeAvg": 22.0,
    "PLPerDayAvg": 2.36,
    "PLPerTradeAvgPct": 0.18145,
    "PLPerDayAvgPct": 0.0165,
    "StratWinRate": 100.0,
    "DaysInTradeAvg": 14,
    "TotStratTrades": 1,
    "TotStratPL": 22,
    "TotStratPLPct": 0.0,
    "CreditReceivedPerTradeAvg": 97.0,
    "marginPerTradeAvg": 349.0,
    "mostMarginUsed": 349.0,
    "leastMarginUsed": 349.0,
    "bestTradePctMargin": 6.3,
    "worstTradePctMargin": 6.3,
    "marginToStockPct": 2.44,
    "riskRewardAvg": 0.320132,
    "PctOfTimeInMarket": 0.23,
    "BestReturnOnRisk": 9940.1129339
  },
  "monthly": [
    {
      "year": 2007,
      "Jan": 0,
      "Feb": 0,
      "Mar": -0.06,
      "Apr": 0.24,
      "May": 0,
      "Jun": 0,
      "Jul": 0,
      "Aug": 0,
      "Sep": 0,
      "Oct": 0,
      "Nov": 0,
      "Dec": 0,
      "annReturn": 0.18,
      "annSharpe": 0.36,
      "annSortino": 5.24,
      "annVolatility": 0.51
    }
  ],
  "trades": [
    {
      "date": "2007-03-21",
      "ticker": "SPY",
      "leg": 1,
      "ratio": 1,
      "weight": 1,
      "optionType": "call",
      "year": 2007,
      "month": 4,
      "strike": 148,
      "dte": 32,
      "tradeOptPx": 0.16,
      "delta": 0.13,
      "entryStockPx": 143.29,
      "ivPctile": 47.62,
      "exitDate": "2007-04-04",
      "exitStockPx": 143.85,
      "exitOptionPx": 0.07,
      "expirDate": "2007-04-20",
      "expirPx": 148.62,
      "profit": -11.0,
      "tradeType": "opening",
      "iVolMid": 0.076589,
      "startingConstIv": 0.10156,
      "tradeIv": 0.0817
    },
    {
      "date": "2007-03-21",
      "ticker": "SPY",
      "leg": 2,
      "ratio": -1,
      "weight": 1,
      "optionType": "call",
      "year": 2007,
      "month": 4,
      "strike": 146,
      "dte": 32,
      "tradeOptPx": 0.62,
      "delta": 0.28,
      "entryStockPx": 143.29,
      "ivPctile": 47.62,
      "exitDate": "2007-04-04",
      "exitStockPx": 143.85,
      "exitOptionPx": 0.43,
      "expirDate": "2007-04-20",
      "expirPx": 148.62,
      "profit": 17.0,
      "tradeType": "opening",
      "iVolMid": 0.088247,
      "startingConstIv": 0.10156,
      "tradeIv": 0.093
    }
  ],
  "returns": [
    {
      "date": "2007-03-21",
      "return": -0.00027915,
      "marginReturn": -0.01146132,
      "profit": -4,
      "count": 1,
      "openingCount": 1
    },
    {
      "date": "2007-03-22",
      "return": -0.00027915,
      "marginReturn": -0.01146132,
      "profit": -4,
      "count": 1,
      "openingCount": 0
    }
  ]
}
```

---

## Results Trades

`GET https://api.orats.io/backtest-finder/results/trades`

Retrieves the per-leg trade log for a backtest as CSV. Each row is one leg of one trade.

### Required attributes

- `id` (string): The id from a Performance row. Ex: 0185013a5010d4ce4519bc8106d0d7ed

**cURL**

```bash
curl -L "https://api.orats.io/backtest-finder/results/trades?token=my-token&id=0185013a5010d4ce4519bc8106d0d7ed"
```

**Response**

```json
date,ticker,leg,ratio,weight,optionType,year,month,strike,dte,tradeOptPx,delta,entryStockPx,ivPctile,exitDate,exitStockPx,exitOptionPx,expirDate,expirPx,profit,tradeType,iVolMid,startingConstIv,tradeIv
2007-03-21,SPY,1,1,1,call,2007,4,148,32,0.16,0.13,143.29,47.62,2007-04-04,143.85,0.07,2007-04-20,148.62,-11,opening,0.076589,0.10156,0.0817
2007-03-21,SPY,2,-1,1,call,2007,4,146,32,0.62,0.28,143.29,47.62,2007-04-04,143.85,0.43,2007-04-20,148.62,17,opening,0.088247,0.10156,0.093
```

---

## Results Returns

`GET https://api.orats.io/backtest-finder/results/returns`

Retrieves daily returns for a backtest as CSV, covering in-trade days only.

### Required attributes

- `id` (string): The id from a Performance row. Ex: 0185013a5010d4ce4519bc8106d0d7ed

**cURL**

```bash
curl -L "https://api.orats.io/backtest-finder/results/returns?token=my-token&id=0185013a5010d4ce4519bc8106d0d7ed"
```

**Response**

```json
date,returns,marginReturns,profit,trades,openingTrades
2007-03-21,-0.00027915,-0.01146132,-4,1,1
2007-03-22,-0.00027915,-0.01146132,-4,1,0
```
