Query API
Ask anything about prediction markets
Natural language in, structured data out. Live prices from Kalshi and Polymarket, matching thesis and content, LLM-synthesized answer. One call.
Natural language query
# CLI
$ sf query "iran oil prices"
# REST
$ curl "https://simplefunctions.dev/api/public/query?q=iran+oil+prices"
# MCP
query({ q: "iran oil prices" })Your agent asks a question. The runtime searches Kalshi, Polymarket, and internal content in parallel, then synthesizes a structured answer.
Parallel retrieval across 3 sources
Retrieving "iran oil prices"...
Kalshi series search → 9000 series → keyword match → live prices
Polymarket Gamma API search → events + markets + prices
Content blog, weekly, thesis, opinions, technicals, glossary
3 parallel calls → ~2 secondsKalshi: keyword grep on 9000+ series, fetch live prices for matches. Polymarket: Gamma API search with live prices. Content: ILIKE search across 6 database tables. All parallel.
Structured response
{
"query": "iran oil prices",
"answer": "Crude oil hitting $100 by end-March trades
at 49¢ on Polymarket (vol: $10.6M). Related thesis at 89%
confidence with 49 edges. Multiple blog analyses cover
Hormuz disruption and sanctions impact."
"markets": [
{ "title": "Crude Oil $100 March", "venue": "polymarket",
"price": 49, "volume": 10600000 },
{ "title": "Crude Oil $150 March", "venue": "polymarket",
"price": 2, "volume": 7534770 },
...
],
"thesis": {
"title": "Iran War Oil Thesis",
"slug": "iran-war",
"confidence": 89,
"edges": 49
},
"content": [
{ "type": "blog", "title": "US-Iran War and Oil...",
"slug": "us-iran-war-oil..." },
{ "type": "opinion", "title": "Prediction Markets Are
Underpriced Insurance", ... },
...
],
"keyFactors": [
"Crude oil $100 March: 49% (vol $10.6M)",
"Hormuz Strait disruption risk elevated",
"Related thesis at 89% confidence"
],
"sources": ["polymarket", "simplefunctions"]
}Answer + live markets + matching thesis + related content + key factors. Your agent gets everything in one structured response, not scattered across API calls.
Why not just call Kalshi + Polymarket directly?
Two APIs, two auth schemes, two price formats. Kalshi uses cents (0-100) with RSA auth. Polymarket uses decimals (0-1) with EIP-712 signing. Query handles both and returns normalized data.
No search endpoint on either exchange. Kalshi's API requires you to know the series ticker. Polymarket's Gamma API search returns events, not prices. Query searches both by keyword and returns prices.
Raw data vs context. Exchange APIs return prices. Query returns prices + what they mean — synthesized with thesis data, blog analysis, and key factors. Your agent gets context, not just numbers.