Skip to main content

Data Providers

The Charts SDK includes three data providers that connect to polynode endpoints. All are optional. The chart itself works with any data source.

PolynodeProvider

Full-featured REST provider for market data, candles, search, events, and multi-outcome charts.

Top Markets

Response:

Search Markets

Fetch Candles

The first call fetches trades and caches them locally. After that, switching resolution is instant — the SDK rebuilds candles client-side from the cached trades. Supported resolutions: '1m', '5m', '15m', '1h', '4h', '1d' Options:
Response shape (OhlcData[]):

Price History (Line/Area Charts)

For simple {time, value} points (faster than candles — one HTTP call, no pagination):
Supported ranges: '1h', '6h', '1d', '7d', '30d', 'all'
candles() fetches trades and builds OHLCV locally. Best for candlestick charts where you need resolution switching.priceHistory() hits the CLOB prices-history endpoint directly. Best for line/area charts where you just need price points over time.

Get Event (Multi-Outcome)

Returns EventInfo | null. The method searches your loaded markets, groups by shared question pattern, and returns all outcomes with prices and colors. Response:
Colors are assigned automatically from OUTCOME_COLORS (a 20-color palette).

Multi-Outcome Price History (Batch)

Fetch price history for all outcomes in parallel:
outcomePrices() is much faster than fetching candles per outcome — one HTTP call each, no trade pagination. For candlestick data per outcome, use outcomeCandles() instead:

Orderbook Snapshot

Poll for Live Updates

For multi-outcome polling:

Market Resolution

All methods accept flexible market identifiers:
  • token_id — direct lookup (fastest)
  • slug — matched against loaded markets (e.g. 'bitcoin-above-64k')
  • condition_id — hex string starting with 0x

Clear Cache

MarketInfo


PolynodeOBProvider

WebSocket-based orderbook streaming with automatic zlib decompression (uses the native DecompressionStream API, no dependencies).

Methods

The provider handles reconnection automatically with exponential backoff (1s to 30s).

Message Types

The provider processes three message types from the orderbook WebSocket:
  • snapshot_batch — initial full book for all subscribed tokens
  • book_snapshot — full book replacement for a single token
  • book_update — incremental update (add/remove/change levels)
All are normalized to BookData before calling your callback.

ShortFormProvider

Discovers short-form crypto markets (5-minute, 15-minute, and hourly up/down markets) and provides live odds rotation. HTTP-only, no WebSocket required.

One-Shot Discovery

Auto-Rotation with Live Odds

startRotation() discovers the current window, emits immediately, then polls for updated odds every second and re-discovers at each window boundary.

Supported Coins

Supported Intervals

ShortFormMarket

RotationEvent

Options