{"database":"tradehouse","schema":"DATABASE: tradehouse  (ClickHouse SQL dialect)\n\nOnly these tables/columns exist. Use ONLY these. Impersonal public market data.\n\nTABLE tradehouse.market_history_kalshi   -- Kalshi market snapshots (~14.2M rows)\n  ticker String            -- market ticker, e.g. 'PRES-2024-DJT'\n  event_ticker String\n  series_ticker String\n  title String             -- human-readable market title\n  category String          -- e.g. 'Politics', 'Economics', 'Climate'\n  status String            -- 'active' | 'settled' | 'closed'\n  open_ts DateTime\n  close_ts DateTime\n  yes_settle Nullable(UInt8)   -- 1 if YES won, 0 if NO, null if unsettled\n  last_price Nullable(Float64) -- last trade, 0..1 (probability)\n  volume UInt64            -- cumulative contracts traded\n  open_interest UInt64\n  liquidity Nullable(Float64)\n  pulled_at DateTime\n\nTABLE tradehouse.market_history_polymarket  -- Polymarket markets (~13.9M rows)\n  condition_id String\n  market_slug String\n  question String          -- the market question\n  category String\n  open_ts Nullable(DateTime)\n  close_ts Nullable(DateTime)\n  closed UInt8             -- 1 if market closed\n  settlement_outcome Nullable(UInt8)  -- 1 YES won, 0 NO won\n  last_price Nullable(Float64)\n  volume_num Float64       -- total volume (USD-denominated)\n  liquidity_num Float64\n  pulled_at DateTime\n\nTABLE tradehouse.price_history_polymarket  -- price ticks (~1.5M rows)\n  condition_id String\n  token_id String\n  ts DateTime\n  price Float64            -- 0..1 probability\n  source String\n\nTABLE tradehouse.calibration_history  -- forecast vs realized outcome (~521k rows)\n  market_id String\n  platform String          -- 'kalshi' | 'polymarket' | 'limitless' | 'overtime'\n  predicted_prob Float64   -- model's forecast probability 0..1\n  outcome UInt8            -- realized: 1 = YES happened, 0 = NO\n  resolved_at DateTime64(3)\n\nTABLE tradehouse.calibration_signals  -- calibrated vs raw probabilities (~50k rows)\n  market_id String\n  platform String\n  calibrated_prob Float64\n  raw_prob Float64\n  calibration_model String\n  pulled_at DateTime\n\nTABLE tradehouse.l2_ladder  -- order-book top-of-book snapshots (~680k rows)\n  ts DateTime64(3)\n  platform LowCardinality(String)\n  ticker String\n  best_bid Nullable(Float64)\n  best_ask Nullable(Float64)\n  mid Nullable(Float64)\n  spread_bps Nullable(Float64)   -- bid/ask spread in basis points\n  ladder_levels UInt16\n  book_kind LowCardinality(String)\n\nGLOSSARY:\n  - \"platform\"/\"venue\" = the prediction-market exchange.\n  - prices/probs are in [0,1]; multiply by 100 for cents/percent.\n  - \"resolved YES\" = outcome=1 (calibration_history) or settlement_outcome=1\n    (polymarket) or yes_settle=1 (kalshi).\n  - For \"how a market resolved\", use calibration_history.outcome (cleanest),\n    or yes_settle (kalshi) / settlement_outcome (polymarket).\n  - ClickHouse dialect: toStartOfDay(), toStartOfHour(), now(), countIf(cond),\n    avgIf(x,cond), sumIf(); handle Nullable with x IS NOT NULL. Date math via\n    INTERVAL N DAY. Prefer GROUP BY + ORDER BY + LIMIT. Never SELECT *.\n  - Aggregating \"YES vs NO\": SELECT outcome, count() ... GROUP BY outcome.","_meta":{"product":"TradeHouse Query AI","pattern":"A","disclaimer":"Impersonal market data only. AI-generated SQL is shown for inspection and may require review. Not financial, investment, legal, or trading advice. No individualized recommendations.","fork":"F1904"}}