Repository navigation
v1.1.0
Four columns Kalshi already sent on every market, and that the schema dropped.
ATTACH 'kalshi' (TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-kalshi@v1.1.0 vgi-kalshi');price_ranges — the tick ladder
STRUCT("start", "end", step)[], in dollars. The step is not constant within
a book: KXPRESNOMR steps by 0.001 below 0.10 and above 0.90 but by 0.01 in
between, while KXFEDDECISION and KXBTCD step by 0.01 throughout. So a raw
spread is not comparable across markets.
SELECT (yes_ask_dollars - yes_bid_dollars) / list_filter(
price_ranges, r -> r.start <= yes_bid_dollars AND r."end" > yes_bid_dollars
)[1].step AS spread_in_ticks
FROM kalshi.markets('KXPRESNOMR', status => 'open')
WHERE yes_bid_dollars > 0;Normalised this way, KXPRESNOMR, KXFEDDECISION and KXBTCD all come back at
a median of exactly 1.0 ticks, against raw median spreads of 0.002, 0.010
and 0.010. The raw numbers say the political book is five times tighter. It
isn't — it is quoted on a finer grid.
custom_strike — the outcome when there is no number line
MAP(VARCHAR, VARCHAR). A strike_type = 'custom' market carries NULL in both
strike columns because the outcome is categorical. The key matters as much as
the value: KXFEDDECISION splits into {'Hike': '25'} and {'Cut': '25'},
opposite outcomes. On an ordinary numeric strike it holds contract metadata
instead (KXWTI sets front_month_contract and strike_date).
updated_time — staleness, directly
Volume only proxies it. KXPRESNOMR currently has open contracts whose row has
not changed in 55 days.
expiration_value — what the underlying resolved to
What a backtest scores against, since result only says which side won.
VARCHAR, not a number, because it is not always one: KXWTI settles to
'85.76', KXFEDDECISION to 'Fed maintains rate'.
All four are on historical_markets too.
Fixed
- Nested columns now coerce leaves to the declared type. Arrow refuses a decimal
string inside a struct and Kalshi sends every price as one, so
price_rangeswould have built as silently all-NULL. _sql_typerendersMAP, which it had no mapping for; declaring a map column
raisedValueErrorat catalog build time.