Documentation Index
Fetch the complete documentation index at: https://mintlify.com/DeweyMarco/simple-kalshi-bot/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Simple Kalshi Bot uses environment variables for configuration. Store these in a.env file in the project root.
Required Variables
KALSHI_API_KEY_ID
Your Kalshi API key ID from account profile
- Log in to Kalshi
- Go to Profile → API Keys
- Create new API key
- Copy the key ID
KALSHI_PRIVATE_KEY_PATH
Path to RSA private key file for API authentication
- Generate RSA key pair when creating API key in Kalshi
- Download private key file
- Store securely (e.g.,
~/.key/kalshi/key) - Set path in environment variable
API Configuration
KALSHI_USE_DEMO
Use demo API (“true”) or production API (“false”)
"true": https://demo-api.kalshi.co/trade-api/v2 (paper trading)"false": https://api.elections.kalshi.com/trade-api/v2 (real money)
KALSHI_EVENT_TICKER_PREFIX
Market series ticker to monitor
KXBTC15M: 15-minute Bitcoin price predictionKXBTC-24H: 24-hour Bitcoin price- Custom series ticker
Trading Configuration
DRY_RUN
Simulate orders without executing (“true” or “false”)
"true": Generate order IDs but don’t send to API"false": Execute real orders
STAKE_USD
Stake amount per trade for simple strategies (USD)
POLL_SECONDS
Polling interval between market checks (seconds)
MOMENTUM_WINDOW_SECONDS
BTC price lookback window for momentum strategy (seconds)
Consensus Strategy Configuration
INITIAL_BANKROLL_USD
Initial bankroll for consensus strategies (USD)
CONSENSUS_RISK_PCT
Risk percentage per trade for consensus strategies (0.01 = 1%)
CONSENSUS_MAX_RISK_PCT
Maximum risk per trade (0.02 = 2%)
CONSENSUS_MAX_PRICE
Maximum contract price for consensus trades (USD)
CONSENSUS_FEE_PCT
Trading fee percentage to subtract from profit (0.0 = 0%)
CONSENSUS_ROLLING_WINDOW
Number of recent trades to analyze for win rate
CONSENSUS_DAILY_LOSS_CAP_R
Daily loss limit in R multiples (3.0 = 3× risk amount)
CONSENSUS_WEEKLY_LOSS_CAP_R
Weekly loss limit in R multiples (8.0 = 8× risk amount)
File Paths
MOCK_TRADES_CSV_PATH
CSV file path for bot.py trade history
CONSENSUS_TRADES_CSV
CSV file path for consensus.py trade history
Complete Example .env File
Loading Environment Variables
All modules usepython-dotenv to load variables:
Security Best Practices
-
Never commit
.envto git -
Use
.env.examplefor documentation -
Protect private key file
-
Start with demo + dry run
-
Test thoroughly before production
- Run demo API for days/weeks
- Verify P&L calculations
- Test all edge cases
- Only then switch to production