A robust Python tool for collecting and analyzing market data from Kalshi.
- Python 3.8+
- Required packages: Install using
pip install -r requirements.txt
- Create
private_key.pem
in project root directory - Add your Kalshi private key to this file
- Update
key_id
in configuration
open_events_collector.py
: Fetches open events from Kalshiopen_market_collector.py
: Collects detailed market dataprocess_open_events.py
: Processes and formats event dataprocess_market_details.py
: Analyzes and processes market detailspipeline_all_kalshi.py
: Main pipeline orchestrator
historical_data/
├── open_events/ # Raw event data
├── open_markets/ # Raw market data
├── open_markets_individual/ # Individual market details
├── processed_events/ # Processed event data (CSV)
└── processed_markets/ # Processed market data (CSV)
To execute the entire data collection and processing pipeline:
python pipeline_all_kalshi.py
This will:
- Collect all open events
- Gather market data
- Process events into CSV format
- Process market details with statistics
The pipeline generates:
- JSON files containing raw data
- CSV files with processed data
- Summary statistics for markets
- Event Collection: Fetches current open events
- Market Collection: Gathers detailed market data
- Event Processing: Converts events to structured format
- Market Processing: Analyzes market details and statistics