Skip to main content
The Simple Kalshi Bot implements multiple automated trading strategies for KXBTC15M markets (Bitcoin price direction over 15-minute windows). Each strategy uses different signals and risk management approaches.

Available Strategies

Core Strategies

PREVIOUS

Trend-following strategy that bets on the same outcome as the previous market

MOMENTUM

Directional strategy based on Bitcoin spot price movement over 60 seconds

CONSENSUS

Combined strategy that only trades when PREVIOUS and MOMENTUM signals agree

MOMENTUM_15

Extended momentum strategy using the full 15-minute window

Enhanced Variants

PREVIOUS_2

Value-seeking variant that waits for favorable prices (≤ $0.45)

CONSENSUS_2

Enhanced consensus with dynamic position sizing and loss limits

ARBITRAGE

Market-making strategy that captures edge through two-leg execution

Strategy Comparison

StrategySignal SourceEntry TimingRisk ManagementBest For
PREVIOUSPrevious market resultImmediate on new marketFixed stakeStrong trends
MOMENTUMBTC price (60s)Immediate on new marketFixed stakeShort-term volatility
CONSENSUSBoth signals agreeWhen signals alignPosition sizing + loss capsHigh conviction trades
MOMENTUM_15BTC price (15min)Immediate on new marketFixed stakeLonger trends
PREVIOUS_2Previous resultWait for price ≤ $0.45Fixed stakeValue opportunities
CONSENSUS_2Both signals agreeWait for price ≤ $0.45Dynamic sizing + loss capsRisk-managed consensus
ARBITRAGEMarket inefficiencyImmediate two-legCapped at $10Market spreads

Implementation Details

Market Lifecycle

All strategies operate on the same market lifecycle:
  1. Market Detection: Bot polls for open KXBTC15M markets every 5 seconds
  2. Signal Generation: Strategies compute their signals when a new market opens
  3. Trade Execution: Eligible strategies place orders based on their rules
  4. Settlement: Bot monitors markets for results and updates P&L

Data Sources

def get_btc_price():
    """Get current BTC price from Coinbase."""
    resp = requests.get(
        "https://api.coinbase.com/v2/prices/BTC-USD/spot",
        timeout=10
    )
    resp.raise_for_status()
    return float(resp.json()["data"]["amount"])

Performance Tracking

The bot tracks performance metrics for each strategy:
def calc_stats(trades, strategy=None):
    """Calculate stats from trades, optionally filtered by strategy."""
    total_staked = 0.0
    total_profit = 0.0
    wins = 0
    losses = 0
    pending = 0
    
    for t in trades:
        if strategy and t.get("strategy") != strategy:
            continue
        total_staked += float(t.get("stake_usd", 0))
        profit = t.get("profit_usd", "")
        if profit != "":
            p = float(profit)
            total_profit += p
            if p > 0:
                wins += 1
            else:
                losses += 1
        else:
            pending += 1
    
    return {
        "total_staked": total_staked,
        "total_profit": total_profit,
        "wins": wins,
        "losses": losses,
        "pending": pending,
    }

Configuration

Key configuration parameters in bot.py:
SERIES_TICKER = "KXBTC15M"              # Market series
POLL_SECONDS = 5                        # Polling interval
STAKE_USD = 5.0                         # Fixed stake for simple strategies
MOMENTUM_WINDOW_SECONDS = 60            # Momentum lookback period
MOMENTUM_15_WINDOW_SECONDS = 15 * 60    # Extended momentum period
DEAL_MAX_PRICE = 0.45                   # Max price for _2 variants
ARBITRAGE_MAX_BET_USD = 10.0            # Arbitrage position limit
All trades are logged to data/mock_trades.csv with full execution details including entry price, contracts, outcome, and realized P&L.

Next Steps

PREVIOUS Strategy

Learn about trend-following with market results

MOMENTUM Strategy

Understand BTC price direction signals

CONSENSUS Strategy

Explore the combined signal approach

Configuration

Configure strategy parameters

Build docs developers (and LLMs) love