DimaKudosh / pydfs-lineup-optimizer

Daily Fantasy Sports lineup optimzer for all popular daily fantasy sports sites
MIT License
418 stars 156 forks source link

problem with salary cap #199

Open vmactuarial opened 3 years ago

vmactuarial commented 3 years ago

When I run the simulation, I get lineups whose sum of player salaries exceeds the total of 50,000. This is my code:

import os os.chdir("C:/VM2/pydfs-lineup-optimizer-master") from pydfs_lineup_optimizer import get_optimizer, Site, Sport, CSVLineupExporter from pydfs_lineup_optimizer import * optimizer = get_optimizer(Site.DRAFTKINGS_CAPTAIN_MODE, Sport.BASKETBALL) os.chdir("C:/VM2/simulaciones") optimizer.load_players_from_csv("data_showdown_NBA_2020-09-15_DEN-LAC.csv") player = optimizer.get_player_by_name('Nikola Jokic') optimizer.add_player_to_lineup(player)
optimizer.set_max_repeating_players(4) exporter = CSVLineupExporter(optimizer.optimize(n=20,randomness=True)) exporter.export('lineups_showdown_NBA_09-15_DEN-LAC_overlap_4_n20_NikolaJokic.csv')

Thanks.

sansbacon commented 3 years ago

So, it looks like if you lock a player by name, it will be in the CPT slot, but the optimizer is using the FLEX salary. This is because the name for both players is the same. So, until this issue is resolved, you can use optimizer.get_player_by_id for this scenario because the CPT and FLEX player will have a different id.