{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hobbycardindex-com/json-schema/hobbycardindex-com-market-index-history-schema.json",
  "title": "MarketIndexHistory",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hobbycardindex-com-openapi.json#/components/schemas/MarketIndexHistory",
  "type": "object",
  "properties": {
    "index": {
      "$ref": "#/$defs/MarketIndex"
    },
    "days": {
      "type": "integer"
    },
    "history": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "description": "YYYY-MM-DD."
          },
          "value": {
            "type": [
              "number",
              "null"
            ],
            "description": "The index value that day."
          },
          "cardsPriced": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Basket cards with a price that day."
          },
          "basketSize": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Player indexes: cards in the basket."
          },
          "averageRawPrice": {
            "type": [
              "number",
              "null"
            ],
            "description": "Category indexes: average raw price across the basket."
          },
          "averagePsa10Price": {
            "type": [
              "number",
              "null"
            ],
            "description": "Category indexes: average PSA 10 price across the basket."
          },
          "sales": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Sales recorded that day (category: every card in the category; player: verified sales of the basket cards)."
          },
          "salesDollarVolume": {
            "type": [
              "number",
              "null"
            ],
            "description": "Those sales in US dollars."
          }
        },
        "required": [
          "date"
        ]
      }
    },
    "updatedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the indexes were last read."
    }
  },
  "required": [
    "index",
    "days",
    "history"
  ],
  "$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."
        }
      }
    },
    "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"
      ]
    }
  }
}