Skip to main content
Get started with Simple Kalshi Bot and see your first simulated trades in under 5 minutes.

Prerequisites

Before you begin, make sure you have:
  • Python 3.7 or higher installed
  • pip (Python package installer)
  • Basic command line familiarity

Quick Setup

1

Clone or Download the Repository

Get the source code on your machine:
git clone https://github.com/DeweyMarco/simple-kalshi-bot.git
cd simple-kalshi-bot
Or download and extract the ZIP file, then navigate to the directory.
2

Install Dependencies

Install the required Python packages:
pip install -r requirements.txt
This installs:
  • requests - for API calls to Kalshi and Coinbase
  • python-dotenv - for environment configuration
  • cryptography - for secure operations
3

Create Your Configuration

Copy the example environment file:
cp .env.example .env
The default settings work out of the box for paper trading:
.env
KALSHI_USE_DEMO=true
KALSHI_EVENT_TICKER_PREFIX=KXBTC15M
POLL_SECONDS=5
STAKE_USD=5
You don’t need to edit .env for basic paper trading. The defaults use Kalshi’s demo API and simulate $5 stakes per trade.
4

Run the Bot

Start the paper trading bot:
python3 bot.py
You’ll see output like:
Watching KXBTC15M markets with 7 strategies:
  1. PREVIOUS:  Buy same side as previous market result
  2. MOMENTUM:  Buy based on BTC price direction in last 60s
  3. CONSENSUS: Buy only when PREVIOUS and MOMENTUM agree
  4. MOMENTUM_15: Buy based on BTC direction over 900s
  5. PREVIOUS_2: Wait for PREVIOUS side at <= $0.45
  6. CONSENSUS_2: Wait for CONSENSUS side at <= $0.45
  7. ARBITRAGE: Buy immediately, then hedge opposite side if profitable
Stake: $5.0 per trade | Polling: 5s | CSV: data/mock_trades.csv

[14:32:15] KXBTC15M-24MAR05-T1445 (847s) | yes=$0.52 no=$0.51 | BTC=94,234
5

Watch It Trade

The bot will monitor markets and execute paper trades when conditions are met:
-> [PREVIOUS] BUY yes $5.0 @ $0.5200
-> [MOMENTUM] BTC +0.142% -> BUY yes (UP) $5.0 @ $0.5200
-> [CONSENSUS] Both agree yes (UP) -> BUY 12 ($6.24) @ $0.52
When markets settle, you’ll see results:
** [PREVIOUS] SETTLED KXBTC15M-24MAR05-T1430: WIN $+4.20
** [MOMENTUM] SETTLED KXBTC15M-24MAR05-T1430: WIN $+4.20
** [CONSENSUS] SETTLED KXBTC15M-24MAR05-T1430: WIN $+5.76
6

Stop and View Results

Press Ctrl+C to stop the bot gracefully. It will display final statistics:
^C
Stopped.
=== FINAL STATS ===
PREVIOUS:  $+12.40 | 8W/5L | 2 pending
MOMENTUM:  $+8.75 | 7W/6L | 2 pending
CONSENSUS: $+15.20 | 9W/4L | 1 pending
MOMENTUM_15: $-2.50 | 5W/7L | 1 pending
PREVIOUS_2:  $+3.10 | 4W/2L | 0 pending
CONSENSUS_2: $+6.80 | 5W/2L | 0 pending
ARBITRAGE:   $+1.25 | 3W/1L | 1 pending
TOTAL:     $+45.00 | 41W/27L

View Trade History

All trades are logged to a CSV file at data/mock_trades.csv. Open it in Excel, Google Sheets, or any spreadsheet program to analyze:
time,strategy,previous_ticker,previous_result,buy_ticker,buy_side,stake_usd,price_usd,contracts,fee_usd,gross_profit_usd,outcome,payout_usd,profit_usd
2024-03-05T14:32:15+00:00,PREVIOUS,KXBTC15M-24MAR05-T1430,yes,KXBTC15M-24MAR05-T1445,yes,5.0,0.52,9.6154,0.0,4.6154,WIN,9.6154,4.6154
The CSV updates in real-time as trades are placed and settled. You can open it while the bot is running to see live results.

Understanding the Output

Status Line Format

[14:32:15] KXBTC15M-24MAR05-T1445 (847s) | yes=$0.52 no=$0.51 | BTC=94,234 | P:$-2.50 M:$+1.75 C:$+3.20
  • [14:32:15] - Current time
  • KXBTC15M-24MAR05-T1445 - Active market ticker
  • (847s) - Seconds until market closes
  • yes=$0.52 no=$0.51 - Current ask prices for both sides
  • BTC=94,234 - Current Bitcoin spot price
  • P:$-2.50 - PREVIOUS strategy profit/loss
  • M:$+1.75 - MOMENTUM strategy profit/loss
  • C:$+3.20 - CONSENSUS strategy profit/loss
  • Additional columns show other strategy performance

Trade Notifications

-> [STRATEGY_NAME] Trade details
Indicates a new paper trade was placed.
** [STRATEGY_NAME] SETTLED ticker: WIN/LOSS $±amount
Indicates a pending trade was settled with the outcome.

Next Steps

Installation Guide

Learn about detailed configuration options and customization

Configuration

Customize strategies, risk parameters, and market selection
Remember: This is paper trading only. No real money is at risk. All trades are simulated based on real market prices.

Build docs developers (and LLMs) love