pydfs-lineup-optimizer icon indicating copy to clipboard operation
pydfs-lineup-optimizer copied to clipboard

Calls For Multiple Stacks Ignored

Open kryptickevin opened this issue 2 years ago • 12 comments

Hello, @DimaKudosh The following only acknowledges the first TeamStack call, and the second TeamStack is completely ignored. Does anyone know how I can I constrain this to use both stacks?

optimizer.add_stack(TeamStack(4, for_positions=['1B', '2B', '3B', 'SS', 'C', 'OF',], spacing=6, max_exposure=0.06, max_exposure_per_team={'NYY': 0.3, 'SFG': 0.2, 'MIA': 0.2, '': 0, '': 0, '': 0,})) optimizer.add_stack(TeamStack(3, for_positions=['1B', '2B', '3B', 'SS', 'C', 'OF',], spacing=5, max_exposure=0.07, max_exposure_per_team={'ATL': 0.25, 'PHIL': 0.25, 'TB': 0.25, '': 0, '': 0, '': 0,}))

kryptickevin avatar Apr 11 '22 22:04 kryptickevin

having the same issue. dont think this was happening last year with an older version.

lightninglarry avatar Apr 12 '22 11:04 lightninglarry

I had to add a for_teams clause.

            opto.add_stack(TeamStack(5, for_teams=teams,max_exposure=.35, for_positions=['C', 'SS', 'OF', '1B', '2B', '3B'])) 
            opto.add_stack(TeamStack(2, max_exposure=.5, for_positions=['C', 'SS', 'OF', '1B', '2B', '3B']))
            opto.add_stack(TeamStack(1, for_positions=['C', 'SS', 'OF', '1B', '2B', '3B']))

where teams is a list I'm passing in from elsewhere

norraist avatar Apr 13 '22 19:04 norraist

Can you show us that part @norraist

lightninglarry avatar Apr 15 '22 00:04 lightninglarry

    teams = stacks['Team'].tolist()
    cap = {teams[i]: stacks['Percent'].tolist()[i] for i in range(len(stacks['Team'].tolist()))}  #turn list of teams and percentages into dictionary
    runs = sum(stacks['Entries']) #calculate total number of lineups needed

I'll sub the ".35" for

opto.add_stack(TeamStack(5, for_teams=teams,max_exposure_per_team=cap, for_positions=['C', 'SS', 'OF', '1B', '2B', '3B']))

depending on the slate

norraist avatar Apr 15 '22 02:04 norraist

What is the run part doing?

Denwen12 avatar Apr 15 '22 04:04 Denwen12

    teams = stacks['Team'].tolist()
    cap = {teams[i]: stacks['Percent'].tolist()[i] for i in range(len(stacks['Team'].tolist()))}  #turn list of teams and percentages into dictionary
    runs = sum(stacks['Entries']) #calculate total number of lineups needed

I'll sub the ".35" for

opto.add_stack(TeamStack(5, for_teams=teams,max_exposure_per_team=cap, for_positions=['C', 'SS', 'OF', '1B', '2B', '3B']))

depending on the slate

I think im following you here @norraist , but im a noob when it comes to python coding. Can you show me one example from a past slate?

lightninglarry avatar Apr 21 '22 17:04 lightninglarry

What is the run part doing?

runs is just a variable for how many lineups I want.

norraist avatar Apr 29 '22 21:04 norraist

I think im following you here @norraist , but im a noob when it comes to python coding. Can you show me one example from a past slate?

It's a bit hard because I'm doing a lot of work in excel to define my pool and then passing it to here.

norraist avatar Apr 29 '22 22:04 norraist

@lightninglarry Do you think i can have your whole code for the stack setup cause i also use excel and i feed into the optimizer from excel and i also have stack ownership what not and id like to test it out

Denwen12 avatar May 03 '22 05:05 Denwen12

@Denwen12 I still havent got it to work with both stacks working I can get the first call no issue.

lightninglarry avatar May 03 '22 10:05 lightninglarry

@Denwen12 hit me up through email. We can collaborate what we have. [email protected]

lightninglarry avatar May 03 '22 18:05 lightninglarry

@lightninglarry, I sent you a msg

Denwen12 avatar May 04 '22 01:05 Denwen12