DimaKudosh / pydfs-lineup-optimizer

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

How can I set a minimum ownership to all players in my player group? #336

Closed kryptickevin closed 2 years ago

kryptickevin commented 2 years ago

Hello friends, quick question. Say I run the below block of code over 50 lineups - I want to ensure that all players in the group have a minimum of say, 10% ownership. How would I do this? I tried writing a simple for loop but it says that PlayersGroup cannot be iterated.

Any thoughts?

pool = optimizer.player_pool
topplays = PlayersGroup(
    pool.get_players('poole',
                     'dillon brooks',
                     'brandon ingram',
                     'marcus morris',
                     'mikal bridges',
                     'jaren jackson',
                     'nemanja',),

    min_from_group=2,
    max_from_group=7,
)
optimizer.add_players_group(topplays)