backtrader
Event-driven backtesting with bar-by-bar execution, complex order types, multiple analyzers,…
Kalshi daily and hourly range markets on crypto prices (BTC, ETH) and equity indices (S&P 500, Nasdaq-100) — bracket structure, Gaussian P(YES) modeling on price/vol, close-offset decision timing, longshot-sell edge with honest evidence bounds
$ npx -y skills add agiprolabs/claude-trading-skills --skill kalshi-crypto-index-markets --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/kalshi-crypto-index-marketsContext preview
The summary Claude sees to decide when to auto-load this skill.
Kalshi daily and hourly range markets on crypto prices (BTC, ETH) and equity indices (S&P 500, Nasdaq-100) — bracket structure, Gaussian P(YES) modeling on price/vol, close-offset decision timing, longshot-sell edge with honest evidence bounds
name: kalshi-crypto-index-markets description: Kalshi daily and hourly range markets on crypto prices (BTC, ETH) and equity indices (S&P 500, Nasdaq-100) — bracket structure, Gaussian P(YES) modeling on price/vol, close-offset decision timing, longshot-sell edge with honest evidence bounds
Kalshi lists daily (and for crypto, hourly) **range bracket markets** on the level of four liquid underlyings: S&P 500, Nasdaq-100, Bitcoin, and Ethereum. The math is the same partition-and-Gaussian framework as weather brackets — the variable is just price/return and σ comes from the underlying's realized or implied volatility, not a temperature model.
> Cross-references: for Kalshi API mechanics see `kalshi-api`; for the strategy, sizing, and backtesting framework see `prediction-market-strategy`; for the temperature counterpart see `kalshi-weather-markets`; for the shared bracket/overround formulas see `prediction-markets/references/brackets-and-settlement.md`.
---
SERIES_MARKET = {
"KXINX": "index", # S&P 500 index level
"KXNASDAQ100": "index", # Nasdaq-100 index level
"KXBTC": "crypto", # Bitcoin price (USD)
"KXETH": "crypto", # Ethereum price (USD)
}Cadence is higher than weather: crypto hourlies open and settle throughout the day; daily markets open the prior session and settle at the reference close.
---
Each event is a **mutually exclusive, collectively exhaustive** partition of the underlying's possible values at settlement:
The overround (sum of all YES prices) is typically > 1.0. The excess is concentrated in the cheap tails — the same favorite–longshot bias seen in weather markets. See `prediction-markets/references/brackets-and-settlement.md` for the overround formula.
---
Given a price forecast distribution `N(μ, σ)` for the underlying at settlement, with bracket covering `[floor, cap]`:
# interior bracket P(YES) = Φ((cap − μ) / σ) − Φ((floor − μ) / σ) # open-tail, "greater than cap" P(YES) = 1 − Φ((cap − μ) / σ) # open-tail, "less than floor" P(YES) = Φ((floor − μ) / σ)
`Φ` is the standard normal CDF. Unlike temperature brackets (which settle on integers), price brackets settle on a continuous reference price — the half-integer continuity correction used for weather is **not applicable here**. Do not add ±0.5.
For daily markets, a simple log-return diffusion gives `σ_daily ≈ σ_annual / √252` for index, or the equivalent annualized vol / √365 for crypto. Express in price units (not %) before inserting into the formula.
---
**This is the key difference from weather markets.**
Weather settles on a daily extreme that occurs at some unknown intraday time. The decision book is read near the likely peak/trough (a city-local hour).
Crypto and index markets settle at a **fixed reference close**:
The practical convention used in production:
DECISION_OFFSET_MINUTES = 120 # read book ~2h before settlement close decision_ts = settlement_close_ts - timedelta(minutes=DECISION_OFFSET_MINUTES)
This offset balances information freshness (IV and order-book signal) against the risk of being front-run by news that drops in the final window. Tune per-series based on your fill-rate observations.
---
Settlement is on Kalshi's own `result` field. **Do not re-derive from an external feed.** The exact reference price for each series (e.g., official SPX close vs. a crypto composite) is specified per-market in the Kalshi rulebook.
Honest caveat: the exact reference price spec was not pinned for every series during development. Before trading any new series, read the market's rulebook and confirm: 1. The settlement price source (exchange, composite, or Kalshi-computed). 2. The settlement time and timezone. 3. Whether the bracket is inclusive/exclusive at the boundary.
Backtesting against a price feed that differs from the true settlement source is the primary way to manufacture fake edge in these markets.
---
The **favorite–longshot bias** generalizes from weather to index and crypto brackets. Tail brackets are systematically overpriced relative to a Gaussian model calibrated to realized/implied vol; interior brackets near the current underlying level are fairly priced or underpriced.
From production testing with a ro
A comprehensive collection of 68 ready-to-use trading, DeFi, and quantitative finance Agent Skills. Works with Claude Code, Cursor, Codex, Gemini CLI, and 30+ other tools.
Repo: agiprolabs/claude-trading-skills
Event-driven backtesting with bar-by-bar execution, complex order types, multiple analyzers,…
Solana token market data via Birdeye — prices, OHLCV, trades, token metadata, security…
Broad crypto market data from CoinGecko covering 13,000+ tokens. Global market stats,…
Cointegration testing for pairs trading using Engle-Granger, Johansen, and rolling stability…
Wallet evaluation, monitoring, and copy-trade strategy design for Solana DEX trading
Cross-asset correlation analysis including rolling correlation, hierarchical clustering, tail…