Problem
Quant and discretionary trading loops need the same visual primitives that FX, gold, index, and crypto traders use: OHLCV candles, timeframes, recent range, momentum, volatility, and volume. A market search result is not enough to decide whether a contract is tradeable right now. Kalshi and Polymarket also expose large long-tail universes. A bot that scans every market on every tick is too slow and noisy. The SDK needs a first-class K-line surface so users can build watchlist-first scanners and agentic trading loops without touching venue-specific candle APIs.Product surface
Canonical contract:Semantics
- Timeframes:
1m,5m,15m,1h,1d. - Venue is optional; explicit values are
kalshiandpolymarket. - Candle fields:
t,o,h,l,c,v. - Prediction-market prices are normally probabilities in
0..1. market.candlesis read-only, but markedcostEffect: "venue_request_cost"because cache misses can lazy-load venue history.- No live-trade side effects.
- No CLI dependency.
Routing
- SDK and Agent SDK calls go to the configured SimpleFunctions API base URL. Default:
https://simplefunctions.devon Vercel. - Agent SDK tools use the SDK client; they do not shell out to the CLI and do not call a user-local daemon for reads.
market.inspectis the contract-info path for price, orderbook depth, spread, and liquidity score. It runs on the SimpleFunctions API server and may use DB/cache, the configured Kalshi orderbook proxy, server-side Kalshi credentials, or Polymarket CLOB depending on venue and deployment config.market.candlesenters through the Vercel API route, then proxies to the terminal/Fly candle engine (TERMINAL_BASE, defaulthttps://app.simplefunctions.dev).- Local execution only happens when the user explicitly sets
baseUrlorSF_API_URLto a local or self-hosted SimpleFunctions API.
Screening metrics
screenCandles() computes one signal per ticker/timeframe:
returnPctabsReturnPctrangePctrealizedVolatilityPctvolumetrendbreakoutscore
continueOnError lets production bots keep ranking the rest of a watchlist when one ticker/timeframe is stale, unsupported, or temporarily unavailable.
Non-goals
- No automatic order placement.
- No broker-style chart UI in the SDK package.
- No guarantee that candle screening is alpha.
- No unbounded venue-wide polling loop inside SDK consumers.
Future work
- Batch candle endpoint for server-side watchlist scans.
- Cursor/delta support for candle updates.
- Server-side liquidity index for
venue + timeframe + volume + rangefilters. - Agent recipes that combine candles, orderbook depth, external spot feeds, and execution safety gates.