KALSHI TRADE-TAPE QUOTING LAB — VERSION 2
Independent AI-assisted research, Ingyu Koh, 6 October 2026

Purpose
Replace formula-generated execution labels with a replay based on actual public
KXBTC15M contracts, trade prices, aggressor directions, sizes, timestamps and settlements.
This is historical counterfactual replay, not a record of our maker orders.

Reproduce
python3 -m venv .venv
.venv/bin/pip install numpy scikit-learn requests
.venv/bin/python download.py
.venv/bin/python evaluate.py
python3 -m unittest test_replay -v
Model training uses scikit-learn; exported inference uses Python's standard library.
Exported tree/logistic predictions are checked against scikit-learn predictions.
The source bundle contains code, model, reports and API examples; download.py retrieves
raw data separately. Raw API files are hashed in data/manifest.json.

Sampling and validation
The latest 1,000 archived KXBTC15M markets are cached. Eight complete UTC days are
selected, with six evenly spaced available markets per day, before reading trade tapes.
First four days train, next two validate, last two test. Omit one complete market at
each split boundary. Decisions every minute from opening+60s to closing-60s.
An entire market stays in one split. No tuning on held-out test metrics.
Small sample: two test days cannot give a robust regime-diverse profitability claim.
Day-block bootstrap uses 2,000 resamples, fixed seed; resolution is weak with two blocks.
No annualized Sharpe is claimed without a documented capital/return series.

Market semantics
YES bid = buy YES, YES ask = sell YES. taker_outcome_side=yes implies buying YES
(or economically equivalent selling NO). no implies selling YES (buying NO).
Deprecated taker_side is fallback only. Block trades excluded.
Market price_ranges determines valid ticks. Clip quote prices to .001–.999.
Net YES inventory limit +/-20. Inventory shifts fair center by -0.001*inventory.
Inventory carries through every quote in a market and settles at its actual result.
Contracts in this sample are disjoint; settled exposure ends before the next contract.

Execution assumptions
Post quote at decision+250ms, cancel at next decision. Strict scenario requires trades
strictly through bid/ask in the matching aggressor direction. Touch also allows equal
price. Fill quantity never exceeds eligible tape volume or remaining quote quantity.
A quote can partially fill. The same print is not reused for the same order.
Queue100 and 1-second activation scenarios show sensitivity.
No historical book: cannot prove quotes would be post-only, queue position, available
liquidity ahead, cancellation efficacy, or lack of market impact. These are assumed
counterfactual fills, not reliable conservative/optimistic bounds on actual fills.

Fair value
A Gaussian spot-digital approximation uses log spot/strike, trailing 30-minute volatility
and time left. Only already-closed Binance candles enter. The opening BRTI strike is
used to anchor Binance at contract opening. This corrects the initial level only;
it is NOT a measured contemporaneous BRTI basis model. Actual settlement uses a
60-second BRTI average. No historical full BRTI series was supplied, so exact settlement
pricing and continuous index correction remain unestablished. Unadjusted comparison
and near-expiry failure results remain visible. Historical strike-publication latency
also needs client verification.

Models and policies
Logistic vs gradient-boosted classifiers predict any estimated fill over one minute.
Select by validation Brier. Separate boosted regression predicts expected filled fraction;
separate outcome classifier on filled opportunities is weighted by filled quantity.
The optimizer uses expected filled fraction and conditional settlement, not spread alone.
It evaluates 1/3/5-cent margins and sizes 1/5/20 with inventory capacity and price skew.
Fixed3c/size5 baseline and validation-selected best fixed action are compared.
LinUCB has a separate linear model per margin/size action, ridge prior I, alpha .1,
context [1,fair,time_fraction,vol*1000,flow,inventory/20]. Training feedback is delayed
until actual settlement; test parameters frozen. This is replay-based bandit evidence,
not an identified off-policy evaluation of real logged actions.
Hindsight chooses the best fixed action within each test market. It is not attainable
and is not an upper bound over arbitrary dynamic policies.

Fees
July 7 2026 official schedule: maker coefficient .0175 * M * C * P*(1-P), rounded so
fee plus position cost reaches a centicent. General maker multiplier defaults to zero.
KXBTC15M is not listed in that schedule's nonstandard maker list; current series API
reports fee_type=quadratic, multiplier1 (taker multiplier). Base replay maker multiplier0;
multiplier1 stress shows the price-dependent maker formula. Per-account and historical
series-specific deviations are not independently verified. No maker rebates assumed.
Source: https://kalshi.com/docs/kalshi-fee-schedule.pdf
API direction source: https://docs.kalshi.com/api-reference/market/get-trades
Market/trade source: https://docs.kalshi.com/api-reference/historical/get-historical-trades

Serving
Public API is an experimental calculator, not a live exchange engine. /api/quote returns
measured compute_ms. The browser measures end-to-end HTTPS roundtrip separately.
Public deployment retains the existing Lambda URL and reserved concurrency2.
A larger/provisioned service would introduce ongoing capacity costs and still require
real venue connectivity, stale-data controls and measured exchange latency.

Completed checks: 11 replay tests + 7 service tests passed. Docker built and returned health/quote 200, survived restart; observed memory 14.84 MiB. Public AWS checks and measured timing: results/aws-public-checks.json. This deployment uses on-demand Lambda, not ECS or provisioned concurrency. No new fixed-capacity billing was introduced.

Public URL: https://pz5l45g4wb77gg7q6idoazwaeq0eqvxn.lambda-url.us-east-1.on.aws/

Any-fill classifiers are compared and selected by validation Brier for diagnostics. The quoting objective uses the separate expected-fill-fraction regressor and quantity-weighted adverse-outcome model; it does not substitute classifier accuracy for trading value.
