#DailyFantasySports #LineupOptimizer #LineupOptimization
Help me help you! -- Affiliate Links -- And yes, I do personally use every one of these products, feel free to reach out with any questions you have about them!
Patreon -- Help support the channel and get priority access to me for any questions, as well as access to the private discord with other members to discuss dfs in general!
Patreon - www.patreon.com/nicksniche
Solace Bands -- Need an Apple Watch band? Check out Solace bands. I have used them for a while now and they've recently welcomed me into their creator affiliate club so I can get y'all 10% off your order!
SolaceBands affiliate link - www.solacebands.com/nicksniche
SolaceBands Discount Code - NICKSNICHE - Use at checkout
Club EarlyBird -- I don't know about you, but I often times have trouble getting out of bed in the morning, and also staying asleep at night. Talk about a Lose-Lose. Until I found and tried this Earlybird concoction. In the morning it's some of the cleanest caffeine/energy I've ever experienced, and the nightcap keeps me asleep all night and waking up feeling more refreshed than ever. Highly recommend giving it a try with or without my affiliate link!
Club EarlyBird affiliate Link -- Use for 10% off --
[ Ссылка ]
DropFX -- Use for 15% off --
[ Ссылка ]
~~NEW OPTIMIZER TO WORK BETTER WITH DRAFTKINGS~~
[ Ссылка ]
Welcome Back Everyone!
Check me out on Patreon!
[ Ссылка ]
Today's video is a step-by-step walkthrough to creating your own daily fantasy sports lineup optimizer! Whether you want a single lineup, or are maxing out a 150 entry tournament, this video is for you!
Written Tutorial ----
[ Ссылка ]
***NOTE****
This video is going to be a fairly high level view of the code itself. Going forward my tutorial videos will be much more granular explaining what is happening, when, and why with demonstrations and examples for learning purposes. This video is just a preview of the end game to give everyone something to work toward!
Packages needed:
pandas
pulp
openpyxl
re
Order of tasks performed:
- we will need to do is import our necessary packages.
-open temporary excel workbook in background to write lineups to
- loading our fantasy player list csv into a pandas dataframe for manipulation.
- Regrouping dataframe by position and resetting index off of positions
-define empty salary and point dictionaries for storage by position
- loop through positions in our grouped dataframe to create dictionary with K:player id and V: salary/points
-update empty dictionaries with K:position, V:Player Id
------ This results in nested dictionary with the following logic {K1:V1}, {K2:V2} --- {K1:{K2:V2}} Where K2=V1 ---- K1=Position, V1=K2=Player ID, V2= Points/Salary
Define dictionary of positional constraints (how many player we need from each position)
Define Salary Cap
Establish lineup creation loop:
Create pulp variable to track whether player is chosen or not, (Binary = yes/no)
Define problem, maximize function because we want max fantasy points
Create empty lists to track rewards, costs and positional constraints
Iterate over each player to populate previously created tracking lists for solving.
Solve lineup
Make variables a little cleaner prior to writing to excel
Write each lineup to excel
Save excel workbook once lineup creation loop is completed.
With this export format a little cleanup will be required prior to uploading to fanduel:
-Remove Position and following Underscore from player ID
----- PF_PLAYERID == PLAYERID
Then find and replace interior underscore with hyphen to match format of fanduel download.
Can write a simple vlookup function in excel to return the player name from the fanduel download if you want to review lineups prior to uploading.
If you would like to see a more efficient method of reviewing lineups, or want further explanations of some of the content covered here, be sure to SUBSCRIBE AND HIT THAT NOTIFICATION BELL TO STAY UP TO DATE WITH THIS SERIES!
Ещё видео!