Skip to main content
market.candles is the SDK and Agent SDK contract for trader-style OHLCV bars. It is read-only, but it may lazy-load venue candle history, so SDK callers need SF_API_KEY. Supported timeframes:

Read one chart

Each candle uses compact trading-terminal fields:
For prediction markets, price values are usually probabilities in 0..1. Convert to cents with price * 100 when you want venue-style cent display. Omit venue for server-side auto-resolution, or pass kalshi or polymarket when the market id is ambiguous.

Screen multiple timeframes

Use screenCandles() when you already have a watchlist and want a trader-style scan for movement, range, volatility, and volume.
screenCandles() is a client-side SDK helper. It calls market.candles for each ticker and timeframe, then computes:
  • returnPct
  • absReturnPct
  • rangePct
  • realizedVolatilityPct
  • volume
  • trend
  • breakout
  • score
This is a screening layer, not a trading signal. A live bot should pair it with venue depth, settlement rules, external price feeds, and policy gates before execution. screenCandles() runs with bounded concurrency. Use concurrency to tune watchlist scans and continueOnError: true when one stale or unsupported market should not stop the whole scan.

Agent SDK

Direct Agent SDK callers can use the same canonical tool:
The ergonomic wrapper is:

API mapping

The SDK does not call the CLI. The hosted API proxies the same candle engine used by the terminal and normalizes the endpoint into the strict SDK and Agent SDK contract map. By default, SDK and Agent SDK callers send this request to https://simplefunctions.dev, the Vercel API surface. That route proxies candle reads to the terminal/Fly data service at TERMINAL_BASE or https://app.simplefunctions.dev. Set baseUrl or SF_API_URL only when you want to target a local or self-hosted SimpleFunctions API.