Back to Portfolio
Case StudyIn Progress

KalBot

An autonomous, multi-platform trading bot that routes market decisions through a five-model LLM ensemble — built and operated end to end.

2,500+ commits|5-model ensemble|7 market categories

The Problem

Prediction markets like Kalshi price real-world outcomes — weather, inflation prints, GDP, Fed decisions, crypto ranges. Trading them well means digesting a lot of noisy, time-sensitive data and being disciplined about position sizing. A single LLM is too expensive to run on every market and too confident on its own.

The goal was a system that could scan markets continuously, reason about them with strong models only where it matters, and never let an over-eager model blow up the bankroll.

The Approach

A tiered ensemble. A local Ollama model does the cheap first pass, screening out markets that aren't worth a paid API call. Survivors escalate through Gemini Flash, then Claude and DeepSeek for the hard reasoning, with Perplexity pulled in for live research. Cost scales with conviction, not with volume.

On top of the models sits a Wang Transform risk-premium calibration that sizes positions structurally — independent of how confident any single model feels. A temporal match gate keeps time-series feeds (like nowcasts) from being applied to the wrong settlement period, a class of bug that silently corrupts decisions.

The Build

The runtime is a set of supervised processes, each doing one job:

Local Ollama pre-filter (qwen2.5:32b) to screen markets cheaply
Tiered ensemble: Gemini Flash → Claude → DeepSeek → Perplexity research
Wang Transform risk-premium calibration (independent of model opinion)
Temporal match gate to prevent nowcast contamination
Multi-persona synthesizer before any trade
Threshold, trailing-stop, and predictive exit systems
Watchdog process monitor with crash alerts
Telegram commander — 11 commands + automated 8AM briefing

Ten live data feeds back the analysis — NWS weather, Cleveland Fed and GDPNow nowcasts, FedWatch, EIA gas prices, Zillow home values, derivatives funding/OI, and FRED macro series. A watchdog supervises the workers and fires crash alerts; a pipeline-coverage monitor catches scanner gaps within 24 hours after a five-day blind spot taught that lesson the hard way.

The Result

KalBot runs as a continuously-supervised system with paper and live modes, magnitude-weighted performance scoring, and a full audit trail of every decision. Simulated strategies are gated on win-rate before deployment — weather (94%) and CPI (84%) are live; categories that don't clear the bar stay out. It's the project I develop most actively, and the testbed for the ensemble-routing patterns I reuse across other builds.

Stack

Python 3.12Ollama (qwen2.5:32b)Claude APIGeminiDeepSeekPerplexityFastAPITelegram Bot APIKalshi API

Want something like this?

I ship production-ready applications fast. Let's talk about your project.

FL

FormationLabs

AI Assistant

Hey! I'm the Formation Labs AI assistant. How can I help you today?

Quick questions:

Powered by FormationLabs