Join prediction markets to games
Betting and prediction-market rows reference an underlying event through a polymorphic (league_code, competition_id) pair. competition_id points at a team sport's games.id (or golf.tournaments.id). Here's how to connect a Kalshi market to the NBA game it settles on.
1. List Kalshi markets
Each market row carries league_code and competition_id identifying the event it pays out on.
curl -sS \ -H 'Authorization: Bearer YOUR_API_KEY' \ 'https://api.stat-api.com/api/v1/kalshi/markets?limit=10'2. Resolve the event
For a market with league_code 'nba', competition_id is the nba.games id. Fetch that game directly:
curl -sS \ -H 'Authorization: Bearer YOUR_API_KEY' \ 'https://api.stat-api.com/api/v1/nba/games/122'3. Why it's polymorphic
The same (league_code, competition_id) shape covers every sport — nba/nfl/ mlb/nhl games and golf tournaments — so one join resolves any market to its event. The Data Dictionary documents the main.competitions view that unifies them. Polymarket markets follow the same pattern via their events.