simplefunctions.dev/api/public/*. The public API is for analytical objects and agent workflows. The data API is for fast market data.
Last verified: 2026-05-06.
Base URLs
REST:wss://data.simplefunctions.dev/v1/ws yet. It is the intended canonical data-domain WebSocket name, but current routing can return 426 Upgrade Required. Use wss://app.simplefunctions.dev/ws until the WS route is moved off Vercel or a direct WS CNAME is configured.
Data conventions
| Field | Convention |
|---|---|
| Prices | Probabilities in [0, 1], not cents. |
generated_at | Unix seconds. |
closeTime | Unix seconds. |
ts | Unix milliseconds. |
| Compression | Large REST responses are gzip-compressed by the origin. |
Coverage and hydration
The data API is backed by an in-memory market registry plus venue REST fallbacks.| Path | Coverage behavior |
|---|---|
Browse endpoints such as /v1/markets, /v1/snapshot, /v1/movers, and broad /v1/search | Use the warm registry and recent in-memory samples. They are fast and intentionally bounded. |
Exact Kalshi ticker reads such as /v1/markets/{ticker}, /v1/orderbook/{ticker}, /v1/candles/{ticker}, and exact ticker search | Attempt direct Kalshi hydration when the ticker missed the warm registry. |
| Trades | Return recent in-memory trade prints. Empty trades means no recent cached prints, not necessarily no historical volume. |
REST endpoints
| Endpoint | Use | Cache |
|---|---|---|
GET /v1/heartbeat | Health/status payload. | max-age=10 |
GET /v1/markets?q=&venue= | Top tracked markets or registry search. | max-age=3 |
GET /v1/markets/featured?n=50 | Heat-ranked featured markets. | max-age=3 |
GET /v1/markets/{ticker} | One market snapshot. | max-age=2 |
GET /v1/search?q=&limit=&venue=&strict= | Autocomplete-grade ticker/title search. | max-age=5 |
GET /v1/snapshot | Compact full active-universe price snapshot. | max-age=2 |
GET /v1/movers?window=&n=&minVol=&dir= | Top price movers over a recent window. | max-age=5 |
GET /v1/orderbook/{ticker} | Top-of-book/depth snapshot. | max-age=1 |
GET /v1/candles/{ticker}?tf=1h&limit=500 | OHLCV candles. | max-age=5 or 15 for 1d |
GET /v1/trades/{ticker}?limit=50 | Recent trade prints. | max-age=1 |
Heartbeat
Markets
Search
| Parameter | Values | Use |
|---|---|---|
q | string | Required query. |
limit | 1 to 50 | Result cap. Default 10. |
venue | kalshi, polymarket | Optional venue filter. |
strict | 1, 0 | strict=0 enables looser substring matching for short tokens. |
Raw snapshot
[0.01, 0.99] are excluded.
Movers
| Parameter | Values | Use |
|---|---|---|
window | 1m, 5m, 15m, 1h, 4h, 24h, 1d | Move window. Default 1h. |
n | 10 to 200 | Result cap. Default 50. |
minVol | number | 24h volume floor. Default 1000. |
dir | up, down, both | Direction filter. Default both. |
/v1/movers is powered by in-memory tick/trade samples. After deploy or reconnect, short windows can return count: 0 until samples accumulate.
Orderbook, candles, trades
WebSocket
WebSocket topics
| Topic | Frame type | Use |
|---|---|---|
featured | featured | Top-50 heat-ranked list. |
ticker:{ticker} | ticker_info | Latest price/quote metadata. |
orderbook:{ticker} | orderbook | Sorted book snapshot. |
trade:{ticker} | trade | Trade prints from venue WS. |
candle:{ticker}:{tf} | candle | Candle updates for one timeframe. |
{ticker} | mixed | Legacy topic with ticker/orderbook/trade/candle fan-out. |
ticker_info and orderbook frames if available.
Frame shapes
featured:
ticker_info:
orderbook, trade, and candle use the same shapes as the REST examples above, with a top-level type.
Operational notes
- Public REST callers use
https://data.simplefunctions.dev/v1; the edge proxy injects the internal origin token. - Direct origin routes at
https://app.simplefunctions.dev/api/data/v1/*are edge-token gated and return403without the internal token. - Anonymous WebSocket connections are capped per IP.
- The server pings WebSocket clients every 30 seconds and closes stale connections after a failed pong.
- Kalshi and Polymarket are normalized into one ticker namespace, but not all fields are available from both venues.
- A non-empty market response and an empty trades response can both be healthy: trades are process-local recent prints, while market metadata can be hydrated from venue REST.