{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://polyhistorical.com/datasets/polyhistorical-dataset-schema.json",
  "title": "PolyHistorical Polymarket Order Book Snapshot",
  "type": "object",
  "required": ["timestamp", "market_slug", "asset", "market_type", "token_side", "best_bid", "best_ask"],
  "properties": {
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "Snapshot timestamp in ISO 8601 UTC format."
    },
    "market_slug": {
      "type": "string",
      "description": "Stable Polymarket market slug."
    },
    "asset": {
      "type": "string",
      "enum": ["BTC", "ETH", "SOL"],
      "description": "Underlying crypto asset for the Up/Down market."
    },
    "market_type": {
      "type": "string",
      "examples": ["5m", "15m", "1h", "4h", "24h"],
      "description": "Market duration or timeframe."
    },
    "token_side": {
      "type": "string",
      "enum": ["UP", "DOWN"],
      "description": "Polymarket outcome token side."
    },
    "reference_price": {
      "type": "number",
      "description": "Reference crypto price observed with the snapshot."
    },
    "best_bid": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "description": "Highest bid at the snapshot time."
    },
    "best_ask": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "description": "Lowest ask at the snapshot time."
    },
    "spread": {
      "type": "number",
      "description": "best_ask minus best_bid."
    },
    "mid_price": {
      "type": "number",
      "description": "Midpoint between best bid and best ask."
    },
    "bid_depth_1pct": {
      "type": "number",
      "description": "Bid-side liquidity within 1 percent of the top of book."
    },
    "ask_depth_1pct": {
      "type": "number",
      "description": "Ask-side liquidity within 1 percent of the top of book."
    },
    "total_bid_depth": {
      "type": "number",
      "description": "Total visible bid depth in the snapshot."
    },
    "total_ask_depth": {
      "type": "number",
      "description": "Total visible ask depth in the snapshot."
    }
  }
}
