Test our prediction API

Project presentation

This project develops a flexible quantitative trading pipeline for Kalshi event markets. Its objective is to build a generic framework capable of ingesting multiple contract series from the Kalshi API, transforming raw market activity into predictive features, and producing systematic trading signals from statistical learning models.

Kalshi markets are well suited to this approach because they provide structured data on prices, traded volumes, and contract-level market states, which support feature engineering and short-horizon prediction. The current implementation uses a LightGBM model trained on engineered features, with hyperparameter tuning via Optuna, experiment tracking through MLflow, and temporal validation to preserve chronological consistency and limit information leakage. The deployed API exposes both single-observation predictions and portfolio-oriented outputs for daily trading analysis.

As a first example, we focus on the Kalshi serie KXCPI https://kalshi.com/markets/kxcpi/ which is linked to the current month CPI release. This market is composed of binary event contracts defined on different inflation thresholds. Each contract resolves against the official Bureau of Labor Statistics publication, making the market a structured and transparent source of inflation expectations.

Methodology & Architecture

This API exposes the final layer of an end-to-end quantitative research pipeline designed for Kalshi event markets.

The architecture relies on the following sequential process:

  1. Data Ingestion: Extraction of historical candlestick data and volume imbalance for binary event contracts.

  2. Feature Engineering: Computation of time-series features such as rolling price momentum, volatility, and liquidity metrics.

  3. Modelization: A LightGBM regressor optimized via Bayesian search (Optuna) and validated through strict walk-forward cross-validation to prevent future data leakage.

  4. Signal Generation: The model predicts short-term directional returns. The raw outputs are L1-normalized. This translates predictions into a strict capital allocation vector, dictating the exact portfolio weight assigned to each contract daily.

We can query our deployed model through the API below.

Example prediction

Loading data from the API may take a few seconds.

Daily prediction table

The table below presents the model performance from yesterday’s trading session on a specific trading market.

Loading data from the API may take a few seconds.

Try it yourself

The endpoint accepts one market observation through query parameters and returns a prediction as JSON.

Parameters omitted from the request are treated as missing values.

curl "https://kalshi-predictor.lab.sspcloud.fr/predict?RET_1=-0.01636&VOL_YES_1=0.0&VOL_NO_1=0.0&DIST_50=0.4066&DIST_MIN_20=0.0&DIST_MAX_20=1.0"

To retrieve the daily output of the PnL computation pipeline, you can call:

curl "https://kalshi-predictor.lab.sspcloud.fr/predict/pnl"

API documentation

https://kalshi-predictor.lab.sspcloud.fr/docs

Source code and further development

The full source code for this project is available on GitHub:

MaxCoppa/MLOps-Prediction-Market