# jacksondorazio/kalshi-weather-bot architecture

> Architecture diagram of the GitHub repository jacksondorazio/kalshi-weather-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jacksondorazio/kalshi-weather-bot
- Repository: https://github.com/jacksondorazio/kalshi-weather-bot

## Overview

The README’s primary product is a daily Kalshi weather-betting workflow: settle prior bets, recalibrate, find markets, rank and size picks, then email them. The tree also contains a separate, broader weather-trading application with scheduled collection, ensemble prediction, market analysis, risk checks, execution, persistence, and alerts. Edges reflect documented workflow steps or relationships visible in the supplied excerpts; unsampled implementations and wiring are not inferred.

Main entry points: [`daily_workflow.py`](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/daily_workflow.py) (Daily workflow), [`weather_betting/trading/execution_engine.py`](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/trading/execution_engine.py) (Execution engine), [`weather_betting/models/ensemble_model.py`](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/models/ensemble_model.py) (Ensemble prediction), [`weather_betting/data/weather_collector.py`](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/data/weather_collector.py) (Weather collection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_daily["Daily Kalshi workflow"]
  node_workflow["Daily workflow<br/>[daily_workflow.py]"]
  node_settlement["Bet settlement<br/>[check_results.py]"]
  node_recommender["Pick recommendations"]
  node_tracker[("Bet and calibration state<br/>[daily_workflow.py]")]
  node_email["Email picks<br/>[daily_workflow.py]"]
end

subgraph group_forecast["Weather and prediction"]
  node_collector["Weather collection"]
  node_weatherapis{{"Weather APIs"}}
  node_features["Feature building<br/>[feature_builder.py]"]
  node_ensemble["Ensemble prediction<br/>[ensemble_model.py]"]
  node_lstm["LSTM model<br/>[lstm_model.py]"]
  node_xgb["XGBoost model<br/>[xgboost_model.py]"]
  node_statistical["Statistical model"]
end

subgraph group_trading["Market trading"]
  node_markets["Market client<br/>[market_client.py]"]
  node_polymarket["Polymarket weather discovery"]
  node_strategy["Signal strategy<br/>[strategy_engine.py]"]
  node_risk["Risk manager<br/>[risk_manager.py]"]
  node_execution["Execution engine"]
  node_externalmarkets{{"Prediction market APIs"}}
end

subgraph group_operations["Persistence and operations"]
  node_app["Service entry point<br/>[main.py]"]
  node_database[("Weather and trade database<br/>[database.py]")]
  node_alerts["Alert manager<br/>[alert_manager.py]"]
  node_notify{{"Email and Slack"}}
end

node_user(("Operator"))

node_user -->|"starts"| node_workflow
node_workflow -->|"settles bets"| node_settlement
node_workflow -->|"updates state"| node_tracker
node_workflow -->|"requests picks"| node_recommender
node_workflow -->|"sends picks"| node_email
node_app -->|"starts pipeline"| node_execution
node_app -->|"checks alerts"| node_alerts
node_execution -->|"collects weather"| node_collector
node_collector -->|"fetches forecasts"| node_weatherapis
node_collector -->|"stores readings"| node_database
node_execution -->|"places orders"| node_markets
node_execution -->|"reports failures"| node_alerts
node_ensemble -->|"trains"| node_lstm
node_ensemble -->|"trains"| node_xgb
node_ensemble -->|"combines"| node_statistical
node_strategy -->|"checks trade"| node_risk
node_risk -->|"records trades"| node_database
node_execution -->|"reads history"| node_database
node_markets -->|"queries markets"| node_externalmarkets
node_polymarket -->|"scans markets"| node_externalmarkets
node_alerts -->|"sends alerts"| node_notify

click node_workflow "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/daily_workflow.py"
click node_settlement "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/check_results.py"
click node_recommender "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/kalshi_recommender.py"
click node_tracker "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/daily_workflow.py"
click node_email "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/daily_workflow.py"
click node_app "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/main.py"
click node_collector "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/data/weather_collector.py"
click node_features "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/models/feature_builder.py"
click node_ensemble "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/models/ensemble_model.py"
click node_lstm "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/models/lstm_model.py"
click node_xgb "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/models/xgboost_model.py"
click node_statistical "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/models/statistical_model.py"
click node_markets "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/trading/market_client.py"
click node_polymarket "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/trading/polymarket_weather_client.py"
click node_strategy "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/trading/strategy_engine.py"
click node_risk "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/risk/risk_manager.py"
click node_execution "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/trading/execution_engine.py"
click node_database "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/data/database.py"
click node_alerts "https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/monitoring/alert_manager.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_workflow,node_settlement,node_recommender,node_tracker,node_email toneBlue
class node_collector,node_weatherapis,node_features,node_ensemble,node_lstm,node_xgb,node_statistical toneAmber
class node_markets,node_polymarket,node_strategy,node_risk,node_execution,node_externalmarkets toneMint
class node_app,node_database,node_alerts,node_notify toneRose
class node_user toneIndigo
```

## Components

### Daily Kalshi workflow

- [Daily workflow](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/daily_workflow.py): `daily_workflow.py`
- [Bet settlement](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/check_results.py): `check_results.py`
- [Pick recommendations](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/kalshi_recommender.py): `kalshi_recommender.py`
- [Bet and calibration state](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/daily_workflow.py): `daily_workflow.py`
- [Email picks](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/daily_workflow.py): `daily_workflow.py`

### Weather and prediction

- [Weather collection](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/data/weather_collector.py): `weather_betting/data/weather_collector.py`
- **Weather APIs**
- [Feature building](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/models/feature_builder.py): `weather_betting/models/feature_builder.py`
- [Ensemble prediction](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/models/ensemble_model.py): `weather_betting/models/ensemble_model.py`
- [LSTM model](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/models/lstm_model.py): `weather_betting/models/lstm_model.py`
- [XGBoost model](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/models/xgboost_model.py): `weather_betting/models/xgboost_model.py`
- [Statistical model](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/models/statistical_model.py): `weather_betting/models/statistical_model.py`

### Market trading

- [Market client](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/trading/market_client.py): `weather_betting/trading/market_client.py`
- [Polymarket weather discovery](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/trading/polymarket_weather_client.py): `weather_betting/trading/polymarket_weather_client.py`
- [Signal strategy](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/trading/strategy_engine.py): `weather_betting/trading/strategy_engine.py`
- [Risk manager](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/risk/risk_manager.py): `weather_betting/risk/risk_manager.py`
- [Execution engine](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/trading/execution_engine.py): `weather_betting/trading/execution_engine.py`
- **Prediction market APIs**

### Persistence and operations

- [Service entry point](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/main.py): `weather_betting/main.py`
- [Weather and trade database](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/data/database.py): `weather_betting/data/database.py`
- [Alert manager](https://github.com/jacksondorazio/kalshi-weather-bot/blob/main/weather_betting/monitoring/alert_manager.py): `weather_betting/monitoring/alert_manager.py`
- **Email and Slack**

### Other components

- **Operator**

## Connections

- Operator → Daily workflow: starts (evidence: `README.md`)
- Daily workflow → Bet settlement: settles bets (evidence: `README.md`)
- Daily workflow → Bet and calibration state: updates state (evidence: `README.md`)
- Daily workflow → Pick recommendations: requests picks (evidence: `README.md`)
- Daily workflow → Email picks: sends picks (evidence: `README.md`)
- Service entry point → Execution engine: starts pipeline (evidence: `weather_betting/main.py`)
- Service entry point → Alert manager: checks alerts (evidence: `weather_betting/main.py`)
- Execution engine → Weather collection: collects weather (evidence: `weather_betting/trading/execution_engine.py`)
- Weather collection → Weather APIs: fetches forecasts (evidence: `weather_betting/data/weather_collector.py`)
- Weather collection → Weather and trade database: stores readings (evidence: `weather_betting/data/weather_collector.py`)
- Execution engine → Market client: places orders (evidence: `weather_betting/trading/execution_engine.py`)
- Execution engine → Alert manager: reports failures (evidence: `weather_betting/trading/execution_engine.py`)
- Ensemble prediction → LSTM model: trains (evidence: `weather_betting/models/ensemble_model.py`)
- Ensemble prediction → XGBoost model: trains (evidence: `weather_betting/models/ensemble_model.py`)
- Ensemble prediction → Statistical model: combines (evidence: `weather_betting/models/ensemble_model.py`)
- Signal strategy → Risk manager: checks trade (evidence: `weather_betting/trading/strategy_engine.py`)
- Risk manager → Weather and trade database: records trades (evidence: `weather_betting/risk/risk_manager.py`)
- Execution engine → Weather and trade database: reads history (evidence: `weather_betting/trading/execution_engine.py`)
- Market client → Prediction market APIs: queries markets (evidence: `weather_betting/trading/market_client.py`)
- Polymarket weather discovery → Prediction market APIs: scans markets (evidence: `weather_betting/trading/polymarket_weather_client.py`)
- Alert manager → Email and Slack: sends alerts (evidence: `weather_betting/monitoring/alert_manager.py`)
