{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/vibekast-xyz/json-schema/vibekast-xyz-market-detail-schema.json",
  "title": "MarketDetail",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/vibekast-xyz-openapi.json#/components/schemas/MarketDetail",
  "type": "object",
  "properties": {
    "address": {
      "$ref": "#/$defs/Address"
    },
    "index": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991,
      "description": "Position in the market registry, 0 = first market."
    },
    "label": {
      "type": "string",
      "description": "ISO week label, e.g. \"2026-W43\"."
    },
    "question": {
      "type": "string"
    },
    "status": {
      "$ref": "#/$defs/MarketStatus"
    },
    "closeTime": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991,
      "description": "Unix time in seconds."
    },
    "closeTimeIso": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
      "description": "ISO 8601 time in UTC."
    },
    "collateral": {
      "description": "The tUSDC token this market trades in. It changes every week.",
      "$ref": "#/$defs/Address"
    },
    "grid": {
      "type": "object",
      "properties": {
        "n": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "description": "Number of price ranges."
        },
        "lo": {
          "description": "Lowest edge, USD.",
          "$ref": "#/$defs/Decimal"
        },
        "hi": {
          "description": "Highest edge, USD.",
          "$ref": "#/$defs/Decimal"
        },
        "width": {
          "description": "Width of each range, USD.",
          "$ref": "#/$defs/Decimal"
        }
      },
      "required": [
        "n",
        "lo",
        "hi",
        "width"
      ],
      "additionalProperties": false
    },
    "settlement": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "value": {
              "description": "Settlement price in USD: Chainlink BTC/USD, time-weighted over the final 2 hours before close.",
              "$ref": "#/$defs/Decimal"
            },
            "range": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "description": "Index of the winning price range."
            },
            "rangeLo": {
              "$ref": "#/$defs/Decimal"
            },
            "rangeHi": {
              "$ref": "#/$defs/Decimal"
            }
          },
          "required": [
            "value",
            "range",
            "rangeLo",
            "rangeHi"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ],
      "description": "Set once the market has settled."
    },
    "volume": {
      "description": "Trading volume in tUSDC, fee excluded, buys and sells.",
      "$ref": "#/$defs/Decimal"
    },
    "trades": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "fees": {
      "description": "Fees collected in tUSDC.",
      "$ref": "#/$defs/Decimal"
    },
    "chainId": {
      "type": "number",
      "const": 84532
    },
    "open": {
      "type": "boolean",
      "description": "True while trades are accepted."
    },
    "feeBps": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991,
      "description": "Current fee in basis points. Rises from 100 to 300 over the final 6 hours before close."
    },
    "b": {
      "description": "LMSR liquidity parameter. The house's worst-case loss is b * ln(n).",
      "$ref": "#/$defs/Decimal"
    },
    "ranges": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "lo": {
            "$ref": "#/$defs/Decimal"
          },
          "hi": {
            "$ref": "#/$defs/Decimal"
          },
          "label": {
            "type": "string",
            "description": "Readable range. The first range also counts prices below the grid, the last one prices above it."
          },
          "probability": {
            "description": "The market's current price for this range, which is its implied probability. All ranges sum to 1.",
            "$ref": "#/$defs/Decimal"
          }
        },
        "required": [
          "index",
          "lo",
          "hi",
          "label",
          "probability"
        ],
        "additionalProperties": false
      }
    },
    "spot": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "price": {
              "description": "USD.",
              "$ref": "#/$defs/Decimal"
            },
            "updatedAt": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
              "description": "ISO 8601 time in UTC."
            },
            "source": {
              "type": "string"
            }
          },
          "required": [
            "price",
            "updatedAt",
            "source"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ],
      "description": "Latest Chainlink BTC/USD price. Only set for the newest market."
    },
    "settlementRule": {
      "type": "string"
    },
    "notes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "mintTestUsdc": {
      "description": "Mints 10,000 tUSDC of this market's collateral to the sender.",
      "$ref": "#/$defs/Transaction"
    }
  },
  "required": [
    "address",
    "index",
    "label",
    "question",
    "status",
    "closeTime",
    "closeTimeIso",
    "collateral",
    "grid",
    "settlement",
    "volume",
    "trades",
    "fees",
    "chainId",
    "open",
    "feeBps",
    "b",
    "ranges",
    "spot",
    "settlementRule",
    "notes",
    "mintTestUsdc"
  ],
  "additionalProperties": false,
  "$defs": {
    "Address": {
      "type": "string",
      "pattern": "^0x[0-9a-fA-F]{40}$",
      "description": "0x-prefixed 20-byte address."
    },
    "Decimal": {
      "type": "string",
      "pattern": "^-?\\d+(\\.\\d+)?$",
      "description": "Exact decimal number as a string, e.g. \"0.0279\" or \"77000\". Converted directly from the 18-decimal on-chain integer, never through a float."
    },
    "MarketStatus": {
      "type": "string",
      "enum": [
        "open",
        "closed",
        "settled",
        "voided"
      ],
      "description": "open: trading. closed: past close, waiting for settlement. settled: resolved on the Chainlink price; winning shares pay 1 tUSDC. voided: could never settle; positions redeem at final market prices."
    },
    "Transaction": {
      "type": "object",
      "properties": {
        "to": {
          "$ref": "#/$defs/Address"
        },
        "data": {
          "type": "string",
          "pattern": "^0x[0-9a-fA-F]*$",
          "description": "ABI-encoded calldata."
        },
        "value": {
          "type": "string",
          "const": "0",
          "description": "ETH to send with the call. Always zero."
        },
        "description": {
          "type": "string"
        }
      },
      "required": [
        "to",
        "data",
        "value",
        "description"
      ],
      "additionalProperties": false,
      "description": "An unsigned transaction. Sign and send it from your own wallet on chain 84532."
    }
  }
}