A Free NFL Lineup Optimizer for DraftKings and FanDuel

The NFL lineup optimizer is live. It is free, there is no account, no email, and no cap on how many lineups you can build. It works with DraftKings and FanDuel, and it hands you a CSV formatted for direct re-upload to whichever one you came from.

It is the football version of the baseball optimizer I put up in June, built on the same solver with a different set of rules on top.

NFL Lineup Optimizer rules screen showing QB stacking, bring-back, exposure cap, and cooldown settings

Continue reading “A Free NFL Lineup Optimizer for DraftKings and FanDuel”

Nine Named Ranges and a Macro Called alternate_qb

The football folder had twelve .xlsm files in it, all with the same file date because I had copied them off an old drive in one go. Windows was no help. The real dates were inside — every Office file carries its own modified timestamp in docProps/core.xml, and a spreadsheet is just a zip archive, so you can read it without opening Excel at all — which is how I tracked down the file that became this NFL lineup optimizer for DraftKings and FanDuel.

Eleven of them were from 2014 and 2015. One was from October 2021, had nineteen worksheets instead of five, and was called fanduel football 2021 fast.xlsm. That was the one worth porting.

Screenshot of the alternate_qb VBA macro from the original Excel workbook: eight named-range assignments shifting seventh_last_qb into eigth_last_qb and so on down to last_qb, then a loop over player_picked building a constraint string from every selected player whose position is QB.
The macro the post is named after — nine named ranges shuffled one slot along, and a constraint string built by walking the picked players. This is what the Python port replaced.
Continue reading “Nine Named Ranges and a Macro Called alternate_qb”

In Baseball You Stack a Team. In Football You Stack a Throw.

I have had a baseball lineup optimizer running on this site since June. Pointing it at football looked like a small job — swap ten roster slots for nine, swap a $50,000 cap for a $60,000 one, done. That part took an afternoon. The part that took actual thought was NFL DFS stacking: baseball and football are correlated in completely different ways, and correlation is the whole game.

In baseball, the correlation is sequential. Batters score in a chain: a single sets up the double that drives him in. That is why my MLB optimizer has a constraint forcing four hitters from one team into consecutive batting-order spots — 3-4-5-6, not 2-5-7-9. In football there is no batting order. The correlation is simultaneous, and it is much sharper.

NFL Lineup Optimizer site and player pool screen showing DraftKings salary CSV upload
Continue reading “In Baseball You Stack a Team. In Football You Stack a Throw.”

The Bug That Ate a Day: It Only Hung in Production

This is the last post in my series on rebuilding my daily fantasy lineup optimizer (it all starts here). The math was the easy part. This post is about the day I lost to a bug that didn’t exist on my computer and only showed up once the tool was on a real server — the kind of problem that makes you question your sanity before you find it.

Worked on my laptop, hung in production: the same code behaving differently on a server
Continue reading “The Bug That Ate a Day: It Only Hung in Production”

Porting My 20-Year-Old Excel Models to Python

This is part five of my series on rebuilding my old daily fantasy lineup optimizer (the series kicks off with how I got into this). The earlier posts were about the math. This one is about the move itself: taking a model that lived in an Excel workbook for over a decade and turning it into a web app anyone can use without installing anything. It’s the same journey I’m making with all my old Operations Research models, one at a time.

Diagram of porting an Excel and Solver model to a Python and Flask web app
Continue reading “Porting My 20-Year-Old Excel Models to Python”