DimaKudosh / pydfs-lineup-optimizer

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

max from one team #338

Closed holmes72 closed 2 years ago

holmes72 commented 2 years ago

I want to limit the number of players from a single team in any lineup. I'm currently grouping players by team and setting a max_from_group on each group. Is there a more elegant/simpler way to do this? I see the attribute "max_from_one_team" but don't see how to modify this value.

holmes72 commented 2 years ago

Sorry...this has been asked and answered. It looks like if you want to adjust this value on the fly, this is as good as it gets. Has anyone added a setter for this value?

holmes72 commented 2 years ago

Looks like I added a setter.

In lineup_optimizer.py, within class LineupOptimizer add:

    def set_max_from_one_team(self, max: int):
        self.settings.max_from_one_team = max

Then you can call this when you're setting up your optimizer: opt.set_max_from_one_team(maxStack)

Denwen12 commented 2 years ago

I'm not sure how I can get this to work I want to limit the max players for 1 team to 3 from thunders today

holmes72 commented 2 years ago

If you're saying "I want no more than three OKC players in any given line": players = optimizer.player_pool.get_players(PlayerFilter(teams=['OKC'])) group = PlayersGroup(players, max_from_group=3) optimizer.add_players_group(group)

Denwen12 commented 2 years ago

Cam I use multiple group settings for every team

On Tue, Jan 11, 2022, 3:57 PM holmes72 @.***> wrote:

If you're saying "I want no more than three OKC players in any given line": players = optimizer.player_pool.get_players(PlayerFilter(teams=['OKC'])) group = PlayersGroup(players, max_from_group=3) optimizer.add_players_group(group)

— Reply to this email directly, view it on GitHub https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/338#issuecomment-1010353260, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANBWO7RAY4CYINJ77C2DAPLUVSKTRANCNFSM5LQYP3UQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

holmes72 commented 2 years ago

I'm not a fan of "RTFM" responses, but it seems to apply here. The answer is "yes", and I encourage you to check out the readthedocs site: https://pydfs-lineup-optimizer.readthedocs.io/en/latest/index.html

Denwen12 commented 2 years ago

Thanks, I'll check it out.

On Tue, Jan 11, 2022, 4:46 PM holmes72 @.***> wrote:

I'm not a fan of "RTFM" responses, but it seems to apply here. The answer is "yes", and I encourage you to check out the readthedocs site: https://pydfs-lineup-optimizer.readthedocs.io/en/latest/index.html

— Reply to this email directly, view it on GitHub https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/338#issuecomment-1010388008, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANBWO7QMSB36FDEAWF7ZFLDUVSQM5ANCNFSM5LQYP3UQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

Denwen12 commented 2 years ago

I I got a question, why do I get this

Traceback (most recent call last): File "Fanduel2Finish2.py", line 62, in players = optimizer.player_pool.get_players(PlayerFilter(teams=['MIN'])) NameError: name 'PlayerFilter' is not defined

On Tue, Jan 11, 2022, 5:04 PM joseph offen @.***> wrote:

Thanks, I'll check it out.

On Tue, Jan 11, 2022, 4:46 PM holmes72 @.***> wrote:

I'm not a fan of "RTFM" responses, but it seems to apply here. The answer is "yes", and I encourage you to check out the readthedocs site: https://pydfs-lineup-optimizer.readthedocs.io/en/latest/index.html

— Reply to this email directly, view it on GitHub https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/338#issuecomment-1010388008, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANBWO7QMSB36FDEAWF7ZFLDUVSQM5ANCNFSM5LQYP3UQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>