Repository navigation
Releases
v1.5.1
Container image for Orchard hosted mode.
ghcr.io/query-farm/vgi-kalshi:1.5.1(also:1.5,:latest), multi-arch (amd64 + arm64), published by.github/workflows/docker-publish.ymlafter CI passes.- One image, two transports: HTTP on
$PORT(default 8000) by default,stdiofor on-host use. Runs as a non-root user with a writable home; HEALTHCHECK usesHEAD /health. - Hosted mode (
VGI_ORCHARD_HOSTED=1) is built into vgi-python 0.55 (VGI protocol 3.4). Credentials come from DuckDB secrets.
docker run --rm -p 8000:8000 ghcr.io/query-farm/vgi-kalshi:1.5.1
v1.5.0
v1.4.2
v1.4.1
- Bump vgi-python to 0.52.2.
Full Changelog: v1.4.0...v1.4.1
v1.4.0
Added
- Ed25519 API keys. The
kalshisecret now accepts an Ed25519 private key as
well as RSA; Ed25519 keys sign the request message directly, RSA keys keep
RSA-PSS/SHA-256. Anything else (an EC key, say) is still rejected by name. - Your perps account, read-only, behind the
kalshisecret:
margin_positions(),margin_balance(),margin_risk()and
margin_funding_history()— positions, equity and margin, leverage and
Kalshi's estimated liquidation price, and funding actually paid or received.
They are signed GETs of four allowlisted/marginpaths, never sent
unsigned, and uncached. Account money isDECIMAL(20,6). - A new
accountfunction category, and two agent test tasks covering it.
Changed
- The read-only guard now pins the credentialed surface: any
/margin/path in
the source must be one of the four allowlisted reads. - Requires
vgi-python0.52.0 or newer (pyproject and both entry-point scripts). - README's pinned-install example now pins v1.4.0.
v1.3.1
Fixed
historical_candlesticksreturned no rows for almost every archived market.
Withoutend_tsits window was the 30 days before the archive cutoff, which
misses any market that settled earlier; each market's window now ends at its
ownclose_time(one/historical/markets?tickers=lookup per 100 tickers).historical_markets(series, event_ticker => ...), and a pushed-down
WHERE event_ticker = ..., failed with a 400: the archive endpoint rejects
series_tickerandevent_tickertogether. An event now replaces the series
in the request.- Published examples that timed out or drew a 429 under
vgi-lint --execute:
theevents()andevent_metadata()examples that scanned every event in
the series now ask for open events, andhistorical_markets()'s first
example takes the newest archive page instead of sorting the whole archive. - The
candlesticks()example that fed every market in the series into
candlesticks()now feeds only open markets, and the whole-exchange open
interest rollup onmarkets()(a ~60 s scan of ~200k markets) is replaced by
the series' largest open-interest markets. vgi-lint --execute is now clean. - Example descriptions that called a
LIMIT 1pick "the busiest open market"
now say "an actively traded open market": nothing orders by volume there.
Documentation
- Composed examples: an event rollup joining
events()tomarkets()with the
implied median from each strike ladder, and settled markets'
volume-weighted traded price fromhistorical_trades()next to what
historical_markets()says they paid. New agent tasksettled_event_vwap. - The catalog comment is one plain sentence-level paragraph (VGI107) instead of
a list of object names; the overview stays invgi.doc_md/vgi.doc_llm. - The catalog docs link to the upstream service and its documentation (VGI183):
kalshi.com, the Kalshi Trade API docs, the historical-data, rate-limit and
API-key pages. - The terms notice now links the Kalshi Data Terms of Use and the Kalshi
Developer Agreement (in the catalog docs,vgi.copyright, NOTICE and the
README), and states the Developer Agreement's limits on API use. The old
kalshi.com/termslink returns 404. - README's pinned-install example now pins v1.3.1.
v1.3.0
Speaks VGI protocol 3.3 (vgi-python 0.51.0) and requires the current VGI DuckDB extension; 3.2 extensions are incompatible. The SQL surface is unchanged. The worker now depends on numpy (vgi-python 0.51 needs it to bind pushed-down filters), and the kalshi secret type documents its fields and links to the Kalshi API-key guide.
v1.2.0
Speaks VGI protocol 3.2. The SQL surface is unchanged, but the vgi extension matches the protocol's major and minor version exactly, so an older worker is refused at ATTACH.
ATTACH 'kalshi' (TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-kalshi@v1.2.0 vgi-kalshi');Operational
- Requires
vgi-python>=0.50.0andvgi-rpc>=0.53.1(were 0.37.3 and 0.47.2), inpyproject.tomland both PEP-723 headers. - The
seriesandexchange_statuskeys are declared as canonicalPRIMARY_KEY/NOT_NULLconstraint records, the form vgi.v3 sends. - CI lints with
vgi-lint-check==2.2.0(0.81.1 speaks only vgi.v2). The catalog passes its structural tier at--fail-on warning: agent-task graders moved tovgi-agent-tests.yaml, the catalog gains avgi.subtitle,historical_cutoffis titled "Archive Boundary", and the wide market result shapes carry a documented VGI417 waiver.
Fixed
- A
kalshisecret was only used if it was literally namedkalshi. Secrets are now selected by type, whatever their name, soCREATE SECRET my_key (TYPE kalshi, ...)and the unnamed__default_kalshiform work. - With several
kalshisecrets,SCOPEchooses between them by API base URL, so a production and a demo key can coexist.
See CHANGELOG.md.
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.
v1.0.0
First release considered production-ready.
Attach it
INSTALL vgi FROM community;
LOAD vgi;
ATTACH 'kalshi' (TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/vgi-kalshi@v1.0.0 vgi-kalshi');
SELECT ticker, strike_type, floor_strike, yes_bid_dollars, yes_ask_dollars
FROM kalshi.main.markets('KXBTCD')
WHERE status = 'active';No credentials required — Kalshi's market-data surface is public, and this
worker exposes none of the portfolio, order, or account endpoints.
There are no release assets. This package is not published to PyPI and is not
intended to be; uvx installs it from this repository, and its dependencies
resolve from PyPI normally.
What's in it
- Live market data:
markets,market,orderbook,candlesticks,trades,
events,event,event_metadata. - Catalog tables:
series,exchange_status,historical_cutoff. - The settled archive:
historical_markets,historical_trades,
historical_candlesticks. strike_type,floor_strikeandcap_strike, so a strike ladder can be
analysed without regexing the threshold out of the ticker.- Filter and projection pushdown, batch endpoints (100 markets in 0.13s against
5.89s one at a time), and response caching. - Optional API-key authentication via a DuckDB secret. It is not a
throughput win at Kalshi's entry tier — see the rate-limit table in the README.
See CHANGELOG.md for the full list.