DEV Community

Lucas Gragg
Lucas Gragg

Posted on

Kalshi bot: finding edge in prediction markets

I've been working on kalshi/polymarket prediction market bot for a while and wanted to share what I learned.

The problem

Automated prediction market trading bot. Scans Kalshi and Polymarket for mispriced events, calculates edge, and executes trades automatically. Includes position tracking, P&L dashboard, and Telegram alerts.

What I built

Here are the main features I ended up shipping:

  • Kalshi API integration
  • Polymarket support
  • Edge detection algorithm
  • Auto-entry with configurable filters
  • Position management and exit logic
  • Web dashboard with live P&L

Code sample

# Basic structure
class Bot:
    def __init__(self, config):
        self.config = config

    def run(self):
        while True:
            self.scan()
            self.execute()
Enter fullscreen mode Exit fullscreen mode

If you want the full working version with all the battle-tested edge cases
handled, I packaged it here: Kalshi/Polymarket Prediction Market Bot

Happy to answer questions about the architecture in the comments.

Top comments (0)