A Go trading bot for Kalshi prediction markets, with analysis and tools for the LA High Temperature market.
Tools and backtesting for the KXHIGHLAX (Highest Temperature in LA) market.
π Full documentation: docs/LAHIGH-STRATEGY.md
After testing 20+ strategies, we found one that works:
| Metric | Value |
|---|---|
| Win rate | 81.8% (9/11 trades) |
| Total profit (21 days) | +$27.00 |
| Sharpe ratio | 4.52 (excellent!) |
| Kelly fraction | +40% (real edge!) |
Trade only when 2+ signals agree:
1. Market favorite (highest first price)
2. METAR prediction (rounded to bracket)
3. 2nd best bracket
If 2+ agree β BUY that bracket
If no consensus β SKIP the day (48% of days)
| Date | METAR | Predicted | Winner | Correct | Profit |
|---|---|---|---|---|---|
| Dec 25 | 66Β°F | 66-67Β° | 66-67Β° | β | -$0.84 |
| Dec 24 | 64Β°F | 64-65Β° | 64-65Β° | β | -$1.50 |
| Dec 23 | 63Β°F | 64-65Β° | 64-65Β° | β | +$26.60 |
| Dec 22 | 64Β°F | 64-65Β° | 64-65Β° | β | +$0.06 |
| Dec 21 | 64Β°F | 64-65Β° | 64-65Β° | β | +$3.41 |
| Dec 20 | 65Β°F | 65-66Β° | 65-66Β° | β | +$1.49 |
| Dec 19 | 69Β°F | 69-70Β° | 71-72Β° | β | -$9.69 |
| ... | |||||
| Total | 50% | $0.77 |
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β FOR LEARNING / THESIS TESTING β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β 1. Use small position sizes ($5-15) β
β 2. Hedge across 2-3 brackets β
β 3. Track predictions vs outcomes β
β 4. Iterate and improve model β
β β
β This is DATA COLLECTION, not guaranteed profit. β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Get today's trading recommendation
go run ./cmd/3signal/recommend/
# Run the validated ensemble strategy backtest
go run ./cmd/3signal/strategy/
# Run Monte Carlo simulation (10,000 runs)
go run ./cmd/3signal/montecarlo/
# Monitor today's temperature
go run ./cmd/lahigh-monitor/kalshi-go/
βββ cmd/
β βββ 3signal/ # π PRODUCTION STRATEGY
β β βββ recommend/ # Get daily trade recommendation
β β βββ strategy/ # Run backtest
β β βββ montecarlo/ # Monte Carlo simulation
β β βββ edge-finder/ # Edge discovery
β βββ kalshi-bot/ # Generic WebSocket bot
β βββ lahigh-optimizer/ # Strategy optimizer (20+ strategies)
β βββ lahigh-4signal-test/ # 4-5 signal experiments
β βββ lahigh-autorun/ # Automated trading bot
β βββ lahigh-trader/ # Manual trading bot
β βββ lahigh-monitor/ # Real-time temperature monitor
β βββ lahigh-*/ # Other analysis tools
βββ pkg/
β βββ ws/ # WebSocket client
β βββ rest/ # REST API client
βββ docs/
β βββ LAHIGH-STRATEGY.md # Full strategy documentation
βββ results/ # Backtest output files
βββ go.mod
go mod downloadCreate a .env file with your Kalshi API credentials:
KALSHI_API_KEY=your-api-key-id
KALSHI_PRIVATE_KEY=-----BEGIN RSA PRIVATE KEY-----
...your private key...
-----END RSA PRIVATE KEY-----
# Run rigorous backtest (simulates predictions, honest results)
go run ./cmd/lahigh-backtest-rigorous/
# Run real trade data backtest (shows price evolution)
go run ./cmd/lahigh-backtest-real/
# Monitor real-time temperature at LAX
go run ./cmd/lahigh-monitor/
# Run the trading bot
go run ./cmd/lahigh-trader/ -event KXHIGHLAX-25DEC27
# Run with Docker
docker-compose up --build -d# Connect and subscribe to a market
go run ./cmd/kalshi-bot -market "KXBTC-25DEC31-T50000" -channel "ticker"Full-featured WebSocket client for Kalshi's streaming API.
client := ws.New(
ws.WithAPIKeyOption("your-api-key", privateKey),
)
client.Connect(ctx)
client.Subscribe(ctx, "MARKET-TICKER", ws.ChannelTicker)REST client for order placement and market data.
client := rest.New(apiKey, privateKey)
// Get balance
balance, _ := client.GetBalance()
// Place an order
order, _ := client.BuyYes("KXHIGHLAX-25DEC27-B62.5", 10, 50)
// Get positions
positions, _ := client.GetPositions()| Source | Data | Used For |
|---|---|---|
| Iowa State ASOS | Historical METAR | Backtesting |
| Aviation Weather Center | Real-time METAR | Live monitoring |
| NWS API | Forecasts | Predictions |
| Kalshi API | Trade history, prices | Validation |
# Run unit tests
go test ./pkg/ws/...
# Run integration tests (requires credentials)
go test -tags=integration ./pkg/ws/...- Cheap brackets DON'T win: Brackets with first trade <30Β’ have 0% win rate
- Market IS efficient: High-priced brackets are priced high because they're likely to win
- Single signals fail: +1Β°F calibration alone only works ~50% of the time
- Signal consensus works: When 2+ signals agree, win rate jumps to 82%
- Skip uncertain days: No trade is better than a bad trade
β ENSEMBLE STRATEGY WORKS
- Win rate: 81.8%
- Sharpe ratio: 4.52
- Kelly fraction: +40% (real edge)
- Trade only when market + METAR + 2nd agree
The key insight: Don't fight the market. Use METAR to confirm the market's pick.
MIT