SimpleFunctions

Quant.

Mid-price is not execution price.

Microstructure features for event contracts: top-5 depth, spread, depth ratio, flow toxicity proxy, regime label. Executable edge after slippage. Depth-adjusted Kelly. Same shape across Kalshi and Polymarket, streaming over WebSocket, persisted as time series, drop-in for your signal pipeline. JSON everywhere.

17019 markets trackedKalshi 3000Polymarket 14019· May 8, 06:02 PM
Munehisa Homma 本間宗久 at the Dojima Rice Exchange in 1750s Osaka, drawing red and black candlestick bars on washi paper — the world's first technical quant

本間宗久 · 堂島米会所 1750s — Munehisa Homma, the rice trader who invented candlestick charts, the world's first quant signal.

Live edges with orderbook depth

57¢Will Rand Paul vote for the next Fed Chair nominee?
72¢kalshi
57¢CPI year-over-year in Jul 2026?
9¢kalshi
55¢DOJ reopens Powell investigation by...?: June 30
6¢polymarket
55¢Will average **gas prices** be above or below $4.00 by Dec 3
8¢kalshi
55¢Will average **gas prices** be above $5.40 by Dec 31, 2026?
27¢kalshi
53¢What will Gold (XAUUSD) hit in May 2026?: ↓ $4,500
40¢polymarket
53¢Will the 7-day moving average of transit calls through the S
83¢kalshi
52¢Will average **gas prices** be above or below $5.60 by Dec 3
24¢kalshi
52¢Iran x Israel/US conflict ends by...?: June 30
87¢polymarket
52¢CPI year-over-year in Jul 2026?
9¢kalshi

Updated every 15 minutes · data from Kalshi and Polymarket

Microstructure features per contract

Seven fields. On every tick. On both venues.

Event-contract microstructure is not equity microstructure. Lot sizes, tick sizes, settlement, payout asymmetry — all of it shows up in the features. The runtime ships them all in one shape.

bidAskTopN

Top-5 bid + ask levels with size, refreshed on every venue tick.

executableEdge

thesisPrice − askPrice, walked through your size, debited for worst-case slippage.

depthRatio

Bid-side depth ÷ ask-side depth. Imbalance ≠ noise — it predicts mid revisions.

regimeLabel

Trending / ranging / dispersing — derived from spread persistence + cross-venue divergence.

flowToxicity

VPIN-style proxy on recent prints; modulates adverse-selection threshold.

kellySize

Half-Kelly on post-slippage edge, capped by 25% of cumulative depth at fill price.

whatIfDelta

Override any tree leaf, cascade through, get edge-shift vector — ~10ms, no LLM hop.

Why a normalized quant surface

ApproachWhat it gives youWhere it breaks

Venue SDKs (raw)

Tightest possible quotes per venue

No cross-venue normalization, no thesis loop, no edge math, no regime label

Generic algo platform

Familiar tooling (FIX, drop-copy)

Has zero understanding of event-contract structure or settlement

Notebook + cron

Total flexibility for ad-hoc research

No real-time depth, no kill chain, no audit trail, lifetime maintenance burden

SimpleFunctions Quant

Cross-venue depth + edge + regime + intent

Surfaces only when post-slippage edge clears floor and depth covers size

Who runs the quant loop

Six recurring quant shapes — same microstructure surface, different cadence and risk envelope.

Systematic shops

Microstructure features fed straight into your signal pipeline; depth + spread + regime + flow.

Stat-arb desks

Cross-venue divergence + matched-pair execution; same shape across Kalshi and Polymarket.

Discretionary quants

What-if engine for IC packs; override a leaf, see edge cascade across the tree.

Microstructure researchers

Per-tick orderbook history + flow toxicity proxy; backtest on parquet dumps.

Algo agents

MCP-driven thesis tree, intent declarations, kill conditions — runtime executes on heartbeat.

Risk teams

Audit trail per intent: edge-at-entry, kill chain, slippage realized, regime label at fill.

Quant endpoints

JSON everywhere. Pipe to your model in shell, Python, R, or Julia. Same shape across CLI, REST/API, and MCP adapter.

API reference

A quant tick, end-to-end

From orderbook pull to slippage-debited fill — five steps, JSON at every boundary.

1 · book pull
$ sf book KXFEDDEC-25DEC31 --json | jq .

{
  "ticker": "KXFEDDEC-25DEC31",
  "mid": 38.5, "spread": 1,
  "bids": [[38, 2400], [37, 1800], [36, 800]],
  "asks": [[39, 1500], [40, 1100], [41, 700]],
  "depthRatio": 1.78, "regime": "trending",
  "flowToxicity": 0.21, "venue": "kalshi"
}
2 · executable edge
$ sf edges --json --depth high \
    | jq '.[] | select(.execEdge > 8)'

{
  "ticker": "KXFEDDEC-25DEC31",
  "thesisPrice": 52, "ask": 39,
  "execEdge": 13, "slippage": 0.4,
  "kelly": 350, "regime": "trending",
  "depthAtFill": 24500
}
3 · what-if cascade
$ sf whatif --thesis fed-cuts \
    --override 'recession_prob:0.45'

CASCADE 11ms · 6 markets touched
KXFEDDEC-25DEC31    +13¢ → +18¢
KXFED-26-T2          -3¢ →   0¢
KXRECESSION-26      +20¢ → +27¢
KXGDP-26             +5¢ → +12¢
KXCPI-MAY-T4         -1¢ →  -2¢
KXTREASURY-10Y       +4¢ →  +7¢
4 · arm + audit
$ sf intent buy KXFEDDEC-25DEC31 350 \
    --price 39 --kelly 0.5 \
    --regime-gate trending \
    --kill above:48 --kill flow:>0.4

✓ armed · trail intents/i_8a2f4c
  fired 11:14 UTC, fill 350 @ 38¢
  exec edge realized +14¢, slippage 0.2¢
  regime at fill: trending

Client + pipelines

Python client

pip install simplefunctions-ai

import simplefunctions as sf

book   = sf.book("KXFEDDEC-25DEC31", depth=5)
edges  = sf.edges(min_edge=8, depth="high")
delta  = sf.whatif("fed-cuts",
                   override={"recession_prob": 0.45})
sf.intent.buy("KXFEDDEC-25DEC31", 350,
              price=39, kelly=0.5)

Shell pipeline

# regime-gated edges, sized by depth
sf edges --json --depth high \
  | jq '.[] | select(.regime=="trending")' \
  | jq '.[] | select(.execEdge > 10)' \
  | sf size --kelly 0.5 \
  | sf intent.bulk

# stream tick-level depth
sf ws subscribe orderbook KXFEDDEC-25DEC31

FAQ

What microstructure data does SimpleFunctions expose?

Top-5 bid/ask levels, mid, spread, total depth (both sides), depth ratio (imbalance), trade-flow toxicity proxy, recent print VWAP, time-since-last-trade, and per-tick spread + depth time series. Persisted on every heartbeat snapshot for both venues; queryable via /v1/orderbook, /v1/candles, /api/public/markets, or sf book --json.

How is executable edge computed?

YES buyer: thesisPrice − askPrice; NO buyer: bidPrice − thesisPrice. Then walked through the orderbook for your size to get post-slippage realized edge. Then debited for the worst-case price-impact scenario. The model edge minus half-spread shortcut is also exposed for sanity-checking, but intent triggers gate on the post-slippage number.

What about regime detection?

Three regimes are tracked per topic group: trending (depth ratio persistently > 1.5x one side), ranging (mid stable within 2¢ over 24h), and dispersing (cross-venue divergence > 5¢ for 1h+). Regime labels feed into per-topic Kelly multipliers and adverse-selection thresholds. Exposed as a derived field on every edge.

Depth-adjusted Kelly sizing — what does that mean?

Half-Kelly on the post-slippage edge, capped by a fraction of cumulative orderbook depth at your fill price (default 25%, configurable). The runtime returns a recommended size with each surfaced edge; per-thesis caps and per-venue caps stack on top.

What-if engine, in concrete terms?

Override any leaf in your causal tree (e.g., "Hormuz reopens with prob 30% instead of 12%"); the runtime cascades the change through the tree, recomputes thesis-implied prices for every matched contract, and emits a delta vector showing edge shifts. Pure computation — no LLM hop, ~10ms per scenario.

Python client / R / Julia support?

pip install simplefunctions-ai for the preview Python client over the HTTP/Data API. R can use httr2 around /api/public/*; Julia can use HTTP.jl. The CLI supports --json for shell pipelines. WebSocket streaming for sub-second tick data is exposed through /v1/ws.

How is this different from a Kalshi or Polymarket SDK?

A venue SDK ships endpoints; SimpleFunctions ships cross-venue normalized data, thesis loops, and an intent layer. Same shape across both venues, with depth/spread/regime/edge/kill computed on top. The CLI and HTTP/Data API are the source of truth; SDKs are wrappers around those contracts.

Latency profile?

Heartbeat 15-min default for the curated context; orderbook snapshots refresh on every venue tick (sub-second on Kalshi, ~1s Polymarket via Gamma). WebSocket /v1/ws streams tick-level updates. Out-of-band ticks fire on FOMC / CPI / NFP releases and major exchange events.

Backtest pipeline?

Daily Hugging Face dump under SimpleFunctions/markets and SimpleFunctions/edges (CC-BY-4.0). Per-tick orderbook history via /v1/candles?tf=1m. Both expose ticker, side, depth, spread, mid, edge, regime label — drop straight into pandas / vectorbt / Polars.

Cost?

Public endpoints free, no auth, CC-BY-4.0. Authenticated execution endpoints (intents, orders, BYOK) are metered by call. WebSocket /v1/ws is free for read; authenticated writes are metered. Heartbeat ticks are bundled into the metered quota.

Related surfaces