{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/fiatdock-com/json-schema/fiatdock-com-strategy-backtest-schema.json",
  "title": "StrategyBacktest",
  "description": "Paid. Strategy backtest (crypto, daily closes).",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/fiatdock-com-market-api-openapi.yml#/components/schemas/StrategyBacktest",
  "type": "object",
  "properties": {
    "asset": {
      "type": "string",
      "description": "The asset tested (its ticker)"
    },
    "market": {
      "type": "string",
      "description": "The Coinbase Exchange market read, e.g. BTC-USD"
    },
    "strategy": {
      "type": "string",
      "description": "The rule tested: sma_cross, rsi_reversion, dca or buy_and_hold"
    },
    "params": {
      "type": "object",
      "properties": {},
      "description": "The parameters the rule used (defaults filled in)"
    },
    "period": {
      "type": "object",
      "properties": {
        "from": {
          "type": "string"
        },
        "to": {
          "type": "string"
        },
        "days": {
          "type": "number"
        }
      },
      "required": [
        "from",
        "to",
        "days"
      ],
      "description": "The tested window: first and last completed UTC day, and its length"
    },
    "startPriceUsd": {
      "type": "number",
      "description": "Close on the first day of the window"
    },
    "endPriceUsd": {
      "type": "number",
      "description": "Close on the last day of the window"
    },
    "finalEquityUsd": {
      "type": "number",
      "description": "Capital at the end, cash plus the asset at the last close"
    },
    "totalReturnPct": {
      "type": "number",
      "description": "The rule's return over the window, fees included, in percent"
    },
    "buyAndHoldReturnPct": {
      "type": "number",
      "description": "Buying at the first close and holding, in percent (no fee) — the benchmark"
    },
    "maxDrawdownPct": {
      "type": "number",
      "description": "The largest peak-to-trough fall of the rule's equity, in percent"
    },
    "sharpe": {
      "type": [
        "number",
        "null"
      ],
      "description": "Annualised Sharpe ratio of daily equity returns (risk-free 0); null when equity never moved"
    },
    "exposurePct": {
      "type": "number",
      "description": "Share of days the rule held the asset, in percent"
    },
    "trades": {
      "type": "number",
      "description": "Number of trades (buys and sells)"
    },
    "winRatePct": {
      "type": [
        "number",
        "null"
      ],
      "description": "Share of closed round trips that ended above their entry, in percent; null with no closed trip"
    },
    "tradeList": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string"
          },
          "side": {
            "type": "string"
          },
          "priceUsd": {
            "type": "number"
          }
        },
        "required": [
          "date",
          "side",
          "priceUsd"
        ]
      },
      "description": "The last 30 trades: date, buy or sell, execution close"
    },
    "equityCurve": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string"
          },
          "equityUsd": {
            "type": "number"
          },
          "priceUsd": {
            "type": "number"
          }
        },
        "required": [
          "date",
          "equityUsd",
          "priceUsd"
        ]
      },
      "description": "Up to 31 evenly spaced points of the equity curve, with the asset's close"
    },
    "method": {
      "type": "string",
      "description": "The rules, in full — enough to recompute every number"
    },
    "source": {
      "type": "string",
      "description": "Where the prices come from"
    },
    "asOf": {
      "type": "string",
      "description": "ISO time the prices were read"
    },
    "note": {
      "type": "string",
      "description": "What a backtest is and is not"
    }
  },
  "required": [
    "asset",
    "market",
    "strategy",
    "params",
    "period",
    "startPriceUsd",
    "endPriceUsd",
    "finalEquityUsd",
    "totalReturnPct",
    "buyAndHoldReturnPct",
    "maxDrawdownPct",
    "sharpe",
    "exposurePct",
    "trades",
    "winRatePct",
    "tradeList",
    "equityCurve",
    "method",
    "source",
    "asOf",
    "note"
  ]
}