{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/foresea-ink/json-schema/foresea-ink-market-quote-schema.json",
  "title": "MarketQuote",
  "description": "A live prediction-market quote, normalised for use with `/predict`.",
  "x-generated": "2026-11-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/foresea-ink-openapi.json#/components/schemas/MarketQuote",
  "properties": {
    "platform": {
      "type": "string",
      "title": "Platform",
      "description": "Venue: 'Polymarket' or 'Kalshi'."
    },
    "ident": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ident",
      "description": "Venue market identifier."
    },
    "question": {
      "type": "string",
      "title": "Question",
      "description": "Market question/title.",
      "default": ""
    },
    "market_url": {
      "type": "string",
      "title": "Market Url",
      "description": "Canonical market URL.",
      "default": ""
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Description",
      "description": "Venue-provided background context."
    },
    "resolution_criteria": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Resolution Criteria",
      "description": "Complete venue rules used to resolve the market."
    },
    "venue_news_articles": {
      "items": {
        "$ref": "#/$defs/NewsArticle"
      },
      "type": "array",
      "title": "Venue News Articles",
      "description": "Articles supplied by the prediction-market venue."
    },
    "outcome": {
      "type": "string",
      "title": "Outcome",
      "description": "Primary outcome (prefers 'Yes').",
      "default": ""
    },
    "probability": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Probability",
      "description": "Market-implied probability for `outcome` (0..1)."
    },
    "outcomes": {
      "items": {
        "$ref": "#/$defs/MarketOption"
      },
      "type": "array",
      "title": "Outcomes",
      "description": "All outcomes with their probabilities."
    },
    "close_time": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Close Time"
    },
    "created_time": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Created Time"
    },
    "volume": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Volume"
    },
    "liquidity": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Liquidity"
    },
    "price_change_24h": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Price Change 24H"
    },
    "price_change_7d": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Price Change 7D"
    },
    "yes_bid": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Yes Bid"
    },
    "yes_ask": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Yes Ask"
    },
    "last_trade_price": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Trade Price"
    },
    "resolution_source": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Resolution Source"
    },
    "no_sub_title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "No Sub Title"
    },
    "expected_expiration_time": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Expected Expiration Time"
    },
    "floor_strike": {
      "anyOf": [
        {},
        {
          "type": "null"
        }
      ],
      "title": "Floor Strike"
    },
    "cap_strike": {
      "anyOf": [
        {},
        {
          "type": "null"
        }
      ],
      "title": "Cap Strike"
    },
    "category": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Category"
    },
    "fetched_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Fetched At",
      "description": "ISO 8601 UTC time this quote was actually fetched from the venue (not when it was served from cache)."
    },
    "series_ticker": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Series Ticker",
      "description": "Kalshi series ticker -- the 'extra' id /market/batch needs for candlesticks."
    },
    "token_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Token Id",
      "description": "Polymarket YES-outcome CLOB token id -- the 'extra' id /market/batch needs for order book/price history."
    },
    "event_title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Event Title",
      "description": "For an event link (one market per option): the event's title."
    },
    "event_exclusive": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Event Exclusive",
      "description": "For an event link: whether exactly one option can win."
    },
    "event_options": {
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "type": "array",
      "title": "Event Options",
      "description": "For an event link: each open option's `label`, market `question` and `probability`; the quoted market has `quoted` set."
    }
  },
  "type": "object",
  "required": [
    "platform"
  ],
  "$defs": {
    "MarketOption": {
      "properties": {
        "label": {
          "type": "string",
          "title": "Label",
          "description": "Outcome label, e.g. 'Yes' or 'No'."
        },
        "probability": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Probability",
          "description": "Market-implied probability (0..1), or null when unpriced."
        }
      },
      "type": "object",
      "required": [
        "label"
      ],
      "title": "MarketOption",
      "description": "One outcome of a fetched prediction market and its implied probability."
    },
    "NewsArticle": {
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 500
            },
            {
              "type": "null"
            }
          ],
          "title": "Title",
          "description": "Article headline."
        },
        "summary": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4000
            },
            {
              "type": "null"
            }
          ],
          "title": "Summary",
          "description": "Short human-written summary."
        },
        "summary_llm": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 4000
            },
            {
              "type": "null"
            }
          ],
          "title": "Summary Llm",
          "description": "LLM-generated summary."
        },
        "text": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 20000
            },
            {
              "type": "null"
            }
          ],
          "title": "Text",
          "description": "Full article body text."
        },
        "source": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 200
            },
            {
              "type": "null"
            }
          ],
          "title": "Source",
          "description": "Publisher name (e.g. Reuters)."
        },
        "credibility": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Credibility",
          "description": "Credibility score breakdown."
        },
        "frs": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Frs",
          "description": "Future-Resolution Statement metadata."
        },
        "url": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 2000
            },
            {
              "type": "null"
            }
          ],
          "title": "Url",
          "description": "Canonical article URL."
        },
        "authors": {
          "anyOf": [
            {},
            {
              "type": "null"
            }
          ],
          "title": "Authors",
          "description": "Author name(s)."
        },
        "publish_date": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 100
            },
            {
              "type": "null"
            }
          ],
          "title": "Publish Date",
          "description": "ISO 8601 publish timestamp."
        },
        "keywords": {
          "anyOf": [
            {},
            {
              "type": "null"
            }
          ],
          "title": "Keywords",
          "description": "Extracted keywords."
        },
        "relevance_score": {
          "anyOf": [
            {
              "type": "number",
              "maximum": 1.0,
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Relevance Score",
          "description": "Cosine similarity to the question (0–1)."
        },
        "search_query": {
          "anyOf": [
            {
              "type": "string",
              "maxLength": 500
            },
            {
              "type": "null"
            }
          ],
          "title": "Search Query",
          "description": "Query used to retrieve this article."
        }
      },
      "type": "object",
      "title": "NewsArticle",
      "description": "A news article passed as evidence context for the prediction."
    }
  }
}