Alright, so I’ve been messing around with fantasy football lately, and specifically, I wanted to see if I could build a tool to help pick a good FanDuel lineup. I’m no expert, but I figured, why not give it a shot? It’s called an “NFL FanDuel Optimizer,” but honestly, it’s just a fancy name for something I cobbled together.

Getting Started
First things first, I needed data. I’m talking player stats, salaries, projected points – the whole shebang. I found some free resources online that provide weekly projections, I am not going to mention them for sure. This part was crucial because, garbage in, garbage out, right? If I fed my optimizer bad data, I’d get useless lineups.
Building the Thing
Next, I had to actually build this “optimizer.” I’m not a programmer, let me be clear. But I know a little bit of Python, so I used that. It was messy, lots of trial and error. I found some example code online and basically just mashed it together, tweaking it until it kinda-sorta worked. I am pretty sure it’s not super efficient, but hey, it runs!
The basic idea is this: I wanted to maximize the total projected points of my lineup, while staying under the FanDuel salary cap. Sounds simple, but there are a ton of possible combinations of players. So the Python script I wrote uses something called “linear programming” to solve this. Basically I tried to find the best solution, I did not dig into how the algorithms work in depth. If I am interested I might share it next time.
The Process
- Load the Data: The script starts by reading in the player data from a CSV file (those spreadsheets I downloaded).
- Set Constraints: I tell the script what the salary cap is ($60,000 on FanDuel), and how many players I need at each position (QB, RB, WR, TE, K, DEF).
- Run the Optimization: This is where the “magic” happens. The script crunches the numbers and spits out a lineup that (hopefully) maximizes projected points while meeting the constraints.
- See the Results: I print out the lineup, showing the players, their positions, their salaries, and their projected points.
Testing and Tweaking
Of course, the first few lineups it generated were… interesting. Some star players, some total unknowns. I realized I needed to add some more rules, like maybe setting a minimum salary for certain positions, or limiting the number of players from the same team. It was a lot of back-and-forth, running the script, seeing the results, and then tweaking the code.
I did add minimum salary for certain position, I made sure the code could avoid making choices on injured players. But it will consume much time to deal with bugs.

Does it Actually Work?
Honestly, it’s hit or miss. Some weeks, the lineup does pretty well! Other weeks, not so much. It’s definitely not a guaranteed win, and I wouldn’t bet my house on it. But it’s been a fun project, and it has helped me learn a bit more about both fantasy football and a tiny bit about programming. Also, thinking about the strategy behind picking a lineup is interesting in itself.
So, that’s my experience building an “NFL FanDuel Optimizer.” It’s a work in progress, and probably always will be. I might add more features in the future, like incorporating weather data or opponent strength. Who knows? For now, it’s just a fun little tool to play around with on Sundays.