Skip to main content

Price Candles

Returns OHLCV candlesticks. The price ticks come from Polymarket’s CLOB /prices-history endpoint — those arrive as {t, p} (single price per tick, not OHLC), so PolySimulator buckets them server-side into the requested interval and aggregates open (first tick), high (max), low (min), close (last tick) per bucket. Volume is sourced from your internal fills on PolySimulator, not Polymarket’s chain volume.
Each bucket aggregates every tick that falls within it, so candles show proper OHLC variation whenever the underlying tick stream has it. A bucket with a single tick reports O = H = L = C — see the note under Response.

Query Parameters

Available Intervals

Only 1h, 6h, 1d, 1w, and max are supported. Sub-hour intervals (1m, 5m, 15m) and any other unrecognised value return HTTP 400 with {"error": "INVALID_INTERVAL", "message": "...", "supported_intervals": ["1h", "6h", "1d", "1w", "max"]}. There is no silent fall-back to 1h — the request fails loudly so you don’t render an empty or mis-bucketed chart.Sub-hour granularity is unavailable because the upstream Polymarket CLOB /prices-history feed is hourly-granular — we can’t reconstruct 5-minute buckets from 1-hour samples. (Polymarket’s own /prices-history enum does include 1m and all, which PolySimulator does not support.)

Example


Response

The v field reflects your own simulated trade flow only. To measure Polymarket-wide volume on a market, query the underlying tokens via the Polymarket Gamma API directly. PolySimulator’s volume is meant for “did my own backtest fill?” sanity, not for liquidity proxies.
If a bucket has only a single tick, o == h == l == c — that’s correct behaviour for a slow-moving market, not a bug.

Backtesting Example


Migrating from Polymarket

Polymarket’s CLOB /prices-history returns the raw {t, p} tick stream without bucketing. If you’re porting a bot that does its own bucketing client-side, you can either:
  1. Trust ours — drop your bucketing code and use the t/o/h/l/c/v shape directly. The interval parameter behaves identically to a pandas resample("1H").agg({"o": "first", "h": "max", ...}).
  2. Keep yours — fetch raw ticks via Polymarket’s Gamma API, since PolySimulator does not (yet) expose the un-bucketed feed. Cross-host strategies that compare the two should bucket identically client-side.

Next Steps