{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/resolvedmarkets-com/json-schema/resolvedmarkets-com-snapshot-schema.json",
  "title": "Snapshot",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/resolvedmarkets-com-openapi.json#/components/schemas/Snapshot",
  "type": "object",
  "properties": {
    "market_id": {
      "type": "string"
    },
    "token_id": {
      "type": "string"
    },
    "token_side": {
      "type": "string",
      "enum": [
        "UP",
        "DOWN"
      ]
    },
    "crypto": {
      "type": "string"
    },
    "timeframe": {
      "type": "string"
    },
    "timestamp": {
      "type": "string",
      "format": "date-time"
    },
    "crypto_price": {
      "type": [
        "number",
        "null"
      ]
    },
    "best_bid": {
      "type": "number"
    },
    "best_ask": {
      "type": "number"
    },
    "mid_price": {
      "type": "number"
    },
    "spread": {
      "type": "number"
    },
    "bid_depth_total": {
      "type": "number"
    },
    "ask_depth_total": {
      "type": "number"
    },
    "event_timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "When Polymarket emitted the orderbook event (their clock)."
    },
    "capture_timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "When we processed/stored it (our clock). capture - event = ingestion latency."
    },
    "sequence_number": {
      "type": "integer",
      "description": "Per-token count of orderbook events the collector APPLIED. Capture stores at most one row per 50ms per token and drops unchanged books, so a jump between adjacent rows is normal sampling (98.4% of pairs), NOT a dropped update. Resets on re-subscribe; 0 on backfilled rows. Do not build gap detection on it."
    },
    "crypto_price_age_ms": {
      "type": "integer",
      "description": "Age in ms of the spot crypto_price at capture (-1 when not tracked). Absent on interval/OHLC rows."
    },
    "bids": {
      "type": "array",
      "description": "Only present when `includebook=true`.",
      "items": {
        "$ref": "#/$defs/OrderbookLevel"
      }
    },
    "asks": {
      "type": "array",
      "description": "Only present when `includebook=true`.",
      "items": {
        "$ref": "#/$defs/OrderbookLevel"
      }
    }
  },
  "$defs": {
    "OrderbookLevel": {
      "type": "object",
      "properties": {
        "price": {
          "type": "number"
        },
        "size": {
          "type": "number"
        }
      }
    }
  }
}