kalshi-ai-trading-bot  by ryanfrigo

Autonomous AI trading for prediction markets

Created 8 months ago
347 stars

Top 80.0% on SourcePulse

GitHubView on GitHub
Project Summary

This project provides an advanced AI-powered trading system for Kalshi prediction markets, designed for educational and research purposes. It leverages a sophisticated multi-model AI ensemble to automate trading decisions, incorporating robust risk management and portfolio optimization features, offering users a powerful tool to explore algorithmic trading strategies.

How It Works

The core approach utilizes a five-model AI ensemble, including Grok-3, Claude 3.5 Sonnet, GPT-4o, Gemini Flash 1.5, and DeepSeek R1, each assigned a specialized role (forecaster, news analyst, bull, bear, risk manager). These models engage in a "debate" to reach a consensus on trading opportunities, with trades executed only when a configurable confidence threshold is met. This multi-agent debate and consensus gating mechanism aims to enhance decision robustness. The system operates through a four-stage pipeline: data ingestion from Kalshi APIs and news feeds, AI-driven decision-making, trade execution, and performance tracking logged locally in an SQLite database.

Quick Start & Requirements

To get started, clone the repository and run python setup.py to create a virtual environment and install dependencies. Configure API keys (Kalshi, xAI, OpenRouter) in the .env file. Paper trading can be initiated with python cli.py run --paper. Prerequisites include Python 3.12+, a Kalshi account with API access, an xAI API key, and an OpenRouter API key. Links to relevant API documentation are provided.

Highlighted Details

  • AI Ensemble: Features five frontier LLMs with role-based specialization and consensus gating for decision-making.
  • Trading Strategies: Includes directional trading (Kelly Criterion sizing), market making, and arbitrage detection.
  • Risk Management: Implements fractional Kelly sizing (0.75x), hard daily loss limits (15%), a drawdown circuit breaker (50%), sector concentration caps (90%), and a daily AI cost budget ($50).
  • Observability: Offers a real-time Streamlit dashboard, paper trading simulation, and detailed SQLite telemetry for performance tracking.
  • Trading Modes: Supports Disciplined (default, with guardrails), Safe Compounder (conservative NO-side strategy), and Beast Mode (aggressive, not recommended).
  • Category Scoring: A system that evaluates Kalshi market categories to enforce allocation limits based on ROI, trend, sample size, and win rate.

Maintenance & Community

The project shows recent activity with active commits and a healthy number of GitHub stars and forks, indicating community interest. No specific community channels (like Discord/Slack) or notable contributors/sponsorships are detailed in the README.

Licensing & Compatibility

This project is licensed under the MIT License, which is permissive and generally compatible with commercial use and closed-source linking.

Limitations & Caveats

The software is explicitly designated for "educational and research purposes only" and carries substantial trading risk. The "Beast Mode" is strongly discouraged due to historical losses associated with its aggressive, unguarded settings. Users may need to update AI model names if the underlying providers change them. Compatibility issues with Python 3.14 may require specific environment variable settings or using Python 3.13.

Health Check
Last Commit

6 days ago

Responsiveness

Inactive

Pull Requests (30d)
11
Issues (30d)
30
Star History
190 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.