{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/livetennisapi-com/json-schema/livetennisapi-com-market-schema.json",
  "title": "Market",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/livetennisapi-com-markets-api-openapi.yml#/components/schemas/Market",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    },
    "question": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "active",
        "resolved",
        "closed",
        null
      ]
    },
    "volume": {
      "type": [
        "number",
        "null"
      ]
    },
    "liquidity": {
      "type": [
        "number",
        "null"
      ]
    },
    "end_date": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "prices": {
      "type": "array",
      "description": "Prices endpoint / match detail only; newest first",
      "items": {
        "$ref": "#/$defs/Price"
      }
    }
  },
  "$defs": {
    "Price": {
      "type": "object",
      "description": "Prediction-market top-of-book quote (probability-like, [0,1]); reflects market trading, not an official line, and can lag live scores. Tagged so a synthesised quote is never mistaken for a live book.",
      "properties": {
        "side": {
          "type": [
            "integer",
            "null"
          ],
          "description": "1 = players.p1's outcome, 2 = players.p2's - decided by our name-verified match-market mapping, never by the venue's own display order (the venue lists roughly half of all pairings the other way round). Fixed 2026-09-09: ticks served before that date followed the venue's display order, so on those markets side was reversed; the mapping is stored, so re-reading any tick now returns the correct side."
        },
        "bid": {
          "type": [
            "number",
            "null"
          ]
        },
        "ask": {
          "type": [
            "number",
            "null"
          ]
        },
        "mid": {
          "type": [
            "number",
            "null"
          ],
          "description": "The venue's observed midpoint at the instant we polled or streamed it - never a model estimate. Only mid is always real; see synthetic."
        },
        "spread": {
          "type": [
            "number",
            "null"
          ]
        },
        "price_source": {
          "type": [
            "string",
            "null"
          ],
          "description": "Feed category, e.g. prediction_market"
        },
        "synthetic": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "true = bid/ask are estimated from mid (mid +/- 0.005, not a live order book) - mid itself is the venue's observed midpoint, never a model estimate; false = real top-of-book from the live order-book stream; null = unknown (older ticks). The live stream attaches when a match goes live, so pre-match ticks are synthetic: true by design."
        },
        "timestamp": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When we observed this quote (UTC) - our observation clock, not a venue publication time."
        }
      }
    }
  }
}