A daily-fantasy-sports lineup engine that builds salary-cap-valid lineups with Google OR-Tools constraint optimization, then runs an Anthropic Claude reasoning layer over each build to explain it, rate it, and suggest swaps. Real-time data ingestion feeds player projections, matchups, and an ownership/leverage model.
- Constraint optimization (OR-Tools). Builds lineups that satisfy hard constraints — salary cap, roster slots/positions, and max players per team — while maximizing a custom projection score. Produces a 20-lineup portfolio, not just a single lineup.
- Custom player valuation ("AceScore"). Blends projections, matchup grades, and value, with an ownership/leverage model layered on top for tournament (GPP) play.
- LLM reasoning & explainability. An Anthropic Claude layer evaluates each finished lineup — strategy, strengths, risks, and realistic swaps — and scores it 0–100. The model is explicitly constrained to reason about the optimizer's output rather than invent new lineups: explainable AI over a deterministic optimizer, not freeform generation.
- Portfolio & exposure management. Builds a diversified set of lineups and reports player exposure across the whole portfolio.
- Real-time data ingestion. Scrapers and fetchers pull starters, matchup intel, and research context to feed the valuation model.
data ingestion → valuation (AceScore + ownership/leverage) → OR-Tools optimizer
→ portfolio builder → Claude reasoning / rating → platform-ready CSV export
main.py— pipeline entry point (load slate → value → optimize portfolio → validate → export).main_phase4.py— slate loading, AceScore scoring, and the single-lineup OR-Tools optimizer.advanced_optimizer.py— ownership & leverage model.portfolio_manager.py— builds the multi-lineup portfolio.output_formatter.py— formats lineups for upload and computes the exposure report.ai_reasoner.py— Anthropic Claude reasoning / rating layer.matchup_scraper.py,fetch_starters.py,fetch_research.py,lineup_generator.py— data ingestion + helpers.
pip install -r requirements.txt- Copy
.env.exampleto.envand add your own keys (ANTHROPIC_API_KEYplus the data-source keys). python main.py
Keys are loaded from environment variables via
python-dotenvand are never committed (.envis gitignored).
Python · Google OR-Tools · Anthropic Claude API · pandas · numpy · BeautifulSoup
Built by Edmund Gray.