DimaKudosh / pydfs-lineup-optimizer

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

Restrict players from same team #435

Open u1tra7 opened 3 weeks ago

u1tra7 commented 3 weeks ago

Any chance we can have a this rule added, where we can specify on optimizer the number of players from the same team, but any team without specifying a position.

the documents have:

Restrict players from same team

In some cases you would want to restrict creating of lineup with players from same team, for example prevent of 2 RB from same team. For this you can use restrict_positions_for_same_team method of optimizer, it takes tuples with 2 positions.

optimizer.restrict_positions_for_same_team(('RB', 'RB')) optimizer.restrict_positions_for_same_team(('QB', 'DST'), ('RB', 'DST'))

but say in NBA, where we may just want to set a limit per team (not position based, it would be cool to be able to do:

optimizer.set_max_players_from_team(2)

lightninglarry commented 3 weeks ago

you can do this is another round about way, forgot the exact syntax I have but essentially put minimum teams to 4 or 5(depending on site you are playing on), and it wont allow you to put more than 2 players from a given team.

u1tra7 commented 3 weeks ago

@lightninglarry, appreciate the input. I believe I saw your thread related to this. Will see if I could figure it out. Hoping we could get an enhancement, but its not detrimental. Appreciate it.