{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hobbycardindex-com/json-schema/hobbycardindex-com-market-index-schema.json",
  "title": "MarketIndex",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hobbycardindex-com-openapi.json#/components/schemas/MarketIndex",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "The index id the other index endpoints take: a category id (`pokemon`) or `player-` plus the player (`player-shohei-ohtani`)."
    },
    "type": {
      "type": "string",
      "description": "`category` or `player`.",
      "enum": [
        "category",
        "player"
      ]
    },
    "name": {
      "type": "string",
      "description": "The category or player name."
    },
    "category": {
      "type": [
        "string",
        "null"
      ],
      "description": "The category id; a player's is the category of the top card in the basket."
    },
    "date": {
      "type": "string",
      "description": "The day of the latest value (YYYY-MM-DD)."
    },
    "value": {
      "type": "number",
      "description": "The latest index value."
    },
    "change": {
      "$ref": "#/$defs/IndexChange"
    },
    "basketSize": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Cards in the basket."
    },
    "sales": {
      "anyOf": [
        {
          "$ref": "#/$defs/IndexSales"
        },
        {
          "type": "null"
        }
      ]
    },
    "methodology": {
      "type": [
        "string",
        "null"
      ],
      "description": "How the index is built, in one sentence."
    }
  },
  "required": [
    "id",
    "type",
    "name",
    "date",
    "value",
    "change"
  ],
  "$defs": {
    "IndexChange": {
      "type": "object",
      "properties": {
        "1d": {
          "type": [
            "number",
            "null"
          ],
          "description": "Percent change from the newest value on or before 1 day before `date`; null when the index is younger."
        },
        "7d": {
          "type": [
            "number",
            "null"
          ],
          "description": "Percent change over 7 days."
        },
        "30d": {
          "type": [
            "number",
            "null"
          ],
          "description": "Percent change over 30 days."
        }
      }
    },
    "IndexSales": {
      "type": "object",
      "properties": {
        "last7d": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Sales in the 7 days through `throughDate`."
        },
        "last30d": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Sales in the 30 days through `throughDate`."
        },
        "dollarVolume7d": {
          "type": [
            "number",
            "null"
          ],
          "description": "Those 7 days' sales in US dollars."
        },
        "dollarVolume30d": {
          "type": [
            "number",
            "null"
          ],
          "description": "Those 30 days' sales in US dollars."
        },
        "throughDate": {
          "type": [
            "string",
            "null"
          ],
          "description": "The last day counted (YYYY-MM-DD). Verified sold sales by the day they sold; the counts grow as we add marketplaces."
        }
      }
    }
  }
}