Skip to content

brianeide/kalshi-mm

Repository files navigation

kalshi-mm

Simple market-making algorithm for Kalshi prediction markets. Provides two-way quotes for a single contract. Uses the fastest Python libraries and the Avellaneda-Stoikov model.

Warnings

  • This is a minimal example and does not include risk checks or robust error handling. Many unexpected situations can arise in automated trading, especially on Kalshi. I do not recommend using this in production.
  • This is an open-source project. It is not intended to be profitable.

Setup

  1. Install uv if you do not already have it installed. It is a very good Python package manager.

  2. Create a virtual environment and install dependencies:

uv venv
uv sync
  1. Create a config file:
cp config.json.sample config.json

Edit config.json with your Kalshi API key ID, private key path, and target market ticker.

Run

uv run main.py

The script will check exchange status, load positions and resting orders, and begin quoting.

Configuration

config.json fields:

  • key_id: Kalshi API key ID.
  • key_path: path to your private key file.
  • market_ticker: Kalshi market ticker to trade.

Strategy parameters live near the top of strategy.py:

  • POSITION_LIMIT: max inventory
  • ORDER_SIZE: size per quote
  • GAMMA, DAILY_PRICE_VARIANCE, KAPPA: Avellaneda-Stoikov parameters

Technical Notes

This project makes use of the fastest Python libraries I could find:

Credit to @BeatzXBT. I discovered picows and msgspec through his mm-toolbox repo.

About

Simple Kalshi market making script

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages