Use Cases

Sentiment Analysis Using Polymarket Order Book Data

How to derive market sentiment signals from Polymarket order book depth and historical bid-ask patterns.

Order Books as Sentiment Indicators

Polymarket order books contain rich sentiment information that goes beyond simple price data. By analyzing the depth, imbalance, and dynamics of bids and asks, you can extract actionable sentiment signals using historical data from PolyHistorical.

Key Sentiment Metrics from Order Book Data

MetricFormulaInterpretation
Bid-Ask Imbalance(Bid Volume - Ask Volume) / Total VolumePositive = bullish sentiment, negative = bearish
Depth RatioBid Depth within 5% / Ask Depth within 5%Higher ratio = stronger buying interest
Spread TrendChange in bid-ask spread over timeNarrowing = increasing confidence, widening = uncertainty
Large Order PresenceOrders > 2x average sizeInstitutional interest or informed trading

Bid-Ask Imbalance Analysis

The bid-ask imbalance is one of the most powerful sentiment signals available in order book data. When the bid side is significantly deeper than the ask side, it suggests more participants want to buy the outcome — a bullish signal. PolyHistorical's sub-second snapshots let you track how this imbalance evolves in real time.

How to Calculate It

  • Fetch order book snapshots at regular intervals using the PolyHistorical API
  • Sum bid volume within a defined price range (e.g., top 10 levels)
  • Sum ask volume within the same range
  • Compute the ratio: (bid_vol - ask_vol) / (bid_vol + ask_vol)
  • Track this ratio over time to identify sentiment shifts

Spread as a Confidence Indicator

The bid-ask spread in prediction markets reflects market uncertainty. A tight spread (e.g., 0.01-0.02) indicates strong consensus on the outcome probability. A wide spread (e.g., 0.05+) suggests disagreement or low liquidity. Tracking spread trends with PolyHistorical data reveals how sentiment is crystallizing over time.

Order Flow Sentiment

By comparing consecutive order book snapshots, you can infer net order flow — whether new orders are predominantly bids or asks. A sustained period of bid-side order flow typically precedes price increases in prediction markets.

Practical Applications

  • Build a sentiment dashboard tracking bid-ask imbalance across all Polymarket markets
  • Create alerts when sentiment metrics cross predefined thresholds
  • Combine order book sentiment with external news events for trading signals
  • Use historical sentiment patterns to improve prediction accuracy

Getting Started with Sentiment Analysis

PolyHistorical's free tier gives you access to BTC market order book history — enough to prototype sentiment analysis models. Upgrade to Pro at $11/month for multi-market coverage and build a comprehensive sentiment analysis pipeline across all Polymarket prediction markets.

Related Resources