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 #397

Closed chrisbach1 closed 1 year ago

chrisbach1 commented 1 year ago

Hi all,

I have been having an issue trying to get the optimizer to not put 2 positions from the same team in a lineup. I have tried this:

optimizer.restrict_positions_for_same_team(('PG', 'PG'))

Does it not work because a player can be multiple positions technically? Jordan Poole can be a PG/SG. Is there anyway for it to work?

chrisbach1 commented 1 year ago

Anything will help. I have been trying to solve this issue for a few days and I'm starting to pull my hair out.

this is what I am trying to do:

optimizer.restrict_positions_for_same_team(('PG', 'PG')) optimizer.restrict_positions_for_same_team(('PF', 'PF')) optimizer.restrict_positions_for_same_team(('SG', 'SG'))

But once I add another position, it ignores the previous

Milkman9691 commented 1 year ago

If trying this on DraftKings you will probably have to include the alternate positions as well such as optimizer.restrict_positions_for_same_team(('PG', 'PG', 'PG/SG')) optimizer.restrict_positions_for_same_team(('PF', 'PF', 'PF/C')) and so forth but someone who has more knowledge than me could possibly explain it better

chrisbach1 commented 1 year ago

Thanks for your reply @Milkman9691

Unfortunately I have tried that before and it did not work. I mainly use Fanduel. That code generates an error. PG/SG does not work as a position name. It has to be ('PG', 'PG) and you cannot have 3 values in parenthesis

Milkman9691 commented 1 year ago

I would just restrict by name myself but if you are looking for an advantage though you need to build yourself a spreadsheet that you can reference players Floors & Ceilings along with that days salary value being I think I have attempted every positional strategy known to DFS and did not have much success doing so

Denwen12 commented 1 year ago
    optimizer.restrict_positions_for_same_team(('PG', 'PG'),('SG',

'SG'))

Check to see if this works for you

On Thu, Dec 29, 2022 at 7:10 PM G Dub D @.***> wrote:

I would just restrict by name myself but if you are looking for an advantage though you need to build yourself a spreadsheet that you can reference players Floors & Ceilings along with that days salary value being I think I have attempted every positional strategy known to DFS and did not have much success doing so

— Reply to this email directly, view it on GitHub https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/397#issuecomment-1367649185, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANBWO7SATFMNZGXCUT2QHRDWPYR65ANCNFSM6AAAAAATKZKNMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

--

ĵÖȘΈΦΗ

chrisbach1 commented 1 year ago

That works if I only use that restriction. But if my code looks like this, it cancels out the PG SG restriction.

optimizer.restrict_positions_for_same_team(('PG', 'PG'),('SG','SG')) optimizer.restrict_positions_for_same_team(('SF', 'SF'),('PF','PF'))

chrisbach1 commented 1 year ago

@Denwen12

optimizer.restrict_positions_for_same_team(('PG', 'PG'),('SG','SG'),('SF', 'SF'),('PF','PF'))

This worked

Denwen12 commented 1 year ago

Your welcome, you could probably use a loop to make it work also

On Thu, Dec 29, 2022, 10:49 PM Chris Bachmann @.***> wrote:

Closed #397 https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/397 as completed.

— Reply to this email directly, view it on GitHub https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/397#event-8128882622, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANBWO7TPJERSNCEVTI3QJETWPZLUZANCNFSM6AAAAAATKZKNMY . You are receiving this because you were mentioned.Message ID: @.*** .com>

Denwen12 commented 1 year ago

Or you could of the edited the rule to have 3 str in the ()

On Fri, Dec 30, 2022, 12:25 AM joseph offen @.***> wrote:

Your welcome, you could probably use a loop to make it work also

On Thu, Dec 29, 2022, 10:49 PM Chris Bachmann @.***> wrote:

Closed #397 https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/397 as completed.

— Reply to this email directly, view it on GitHub https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/397#event-8128882622, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANBWO7TPJERSNCEVTI3QJETWPZLUZANCNFSM6AAAAAATKZKNMY . You are receiving this because you were mentioned.Message ID: <DimaKudosh/pydfs-lineup-optimizer/issue/397/issue_event/8128882622@ github.com>