Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Creating FANDUEL FOOTBALL Optimized Lineups. #402

Open
dexter1964 opened this issue Jan 24, 2023 · 0 comments
Open

Error Creating FANDUEL FOOTBALL Optimized Lineups. #402

dexter1964 opened this issue Jan 24, 2023 · 0 comments

Comments

@dexter1964
Copy link

dexter1964 commented Jan 24, 2023

I'm using "optimizer.player_pool.load_players(FDplayers)" function to load the players from a database query.

It appears to be loading the FandDuel players correctly, but when I try "lineup_generator = optimizer.optimize(3)"
-- How can I check to see if the data has loaded into the Optimizer correctly?

Here's my issue, I'm Getting these errors:
pydfs_lineup_optimizer.solvers.exceptions.SolverInfeasibleSolutionException: ['positions_D', 'budget', 'total_players', '_C1']

pydfs_lineup_optimizer.exceptions.GenerateLineupException: Can't generate lineups. Following constraints are not valid: positions_D,budget,total_players

My code is fairly generic:

Data returned from DB Query consists of: (Team, PlayerName, Position, Salary, FantasyPoints)

[('SFO', 'Brock Purdy', 'QB', 6900.0, 15.43), ('SFO', 'Christian McCaffrey', 'RB', 9000.0, 18.03), ('SFO', 'Elijah Mitchell', 'RB', 5600.0, 6.56),etc...]

optimizer = get_optimizer(Site.FANDUEL, Sport.FOOTBALL)
allPlayerInfo=mF.getNFLPlayerInfo('FanDuel')  ## Query database and return Player Data.

FDplayers = []
for i, player_info in enumerate(allPlayerInfo):
     name = player_info[1].split(' ')
     FDplayers.append(Player(
         int(i),
         name[0],        #First Name
         name[1],        #Last name
         player_info[2].split('-'),    # Split Positions: for Fanduel use '-' for Draftkings use '/'
         player_info[0],                 # This should be TeamShort name.
         float(player_info[3]),       #This should be Fantasy Salary
         float(player_info[4])        #This should be Fantasy Points
     ))
optimizer.player_pool.load_players(FDplayers)
lineup_generator = optimizer.optimize(3)

Can someone, Please help and thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant