This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Bonus Hedge Finder — finds optimal hedging opportunities for sportsbook bonus bets using real-time odds from The Odds API. Given a bonus bet on one book, it identifies the best counter-bet on another book to guarantee a locked profit.
Important: Profit calculations apply to bonus bets only, not cash bets.
python3 main.py \
--api-key YOUR_API_KEY \
--bonus-book fanduel \
--books draftkings,betrivers \
--sports nba,ncaab \
--stake 250 \
--min-eff 0.0python3 gui.pyOnly one external dependency:
pip install requestsTwo entry points, one shared core:
main.py— core logic + CLI. Can be imported bygui.py.gui.py— Tkinter GUI that calls intomain.py's functions directly (collect_all_odds,find_all_opportunities). Runs searches on a background thread with a progress callback.
parse_arguments()
→ parse_books() [resolve aliases e.g. "caesars" → "williamhill_us"]
→ get_regions_needed() [US vs US2 API endpoint]
→ collect_all_odds() [fetch_odds_for_sport() per sport/region → parse_event_odds()]
→ find_all_opportunities() [find_hedge_for_bonus() → calculate_hedge()]
→ select_best_opportunity() + log_best_opportunity()
OddsRow— a single odds line: event, selection, opposite side, book, odds (American)HedgeOpportunity— a matched pair: bonus book/odds, hedge book/odds, calculated stake, profit, efficiency
efficiency = guaranteed_profit / bonus_stake (0.0–1.0). Typical good conversions are 70–90%.
- US: fanduel, draftkings, williamhill_us (caesars), betrivers, fanatics, betmgm
- US2: ballybet, espnbet, betparx, fliff, hardrockbet
Region is auto-detected from the books list. Cross-region searches make API calls to both endpoints.
config.json (gitignored) stores API key, allowed books, and sports for the GUI. See config.json.example for the format.
All activity is logged to debug.log (cleared on each run). Check this file when:
- No opportunities are found
- API errors occur (each run uses 2 API calls per sport per region)
- Investigating which bookmakers were available for a given event