pydfs-lineup-optimizer
pydfs-lineup-optimizer copied to clipboard
Calls For Multiple Stacks Ignored
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,}))
having the same issue. dont think this was happening last year with an older version.
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
Can you show us that part @norraist
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
What is the run part doing?
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?
What is the run part doing?
runs is just a variable for how many lineups I want.
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.
@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 I still havent got it to work with both stacks working I can get the first call no issue.
@Denwen12 hit me up through email. We can collaborate what we have. [email protected]
@lightninglarry, I sent you a msg