DimaKudosh / pydfs-lineup-optimizer

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

Does Anyone know is there a way? #426

Open Milkman9691 opened 7 months ago

Milkman9691 commented 7 months ago

@DimaKudosh is there a way to form stacks this way?

I have my roster order columns and batting orders before I run the opt but I was trying to eliminate the 7,8,9 hitters from my stack consideration but not for overall lineup consideration. If "optimizer.set_spacing_for_positions(['1B', '2B', '3B'], 3)" is used it could use a 9,1,2 wrap or 8,9,1 wrap to which i am trying to avoid. The "spacing=" argument could also give a wrap around. For MLB the 7,8,9 roster positions are pretty much useless but you will still need to be able to let them be in the selection process but wantig the core of stacks to come from the 1-6 positions. In 2023 82.7% of the top fantasy points scored came from batting positions 1-6 So far in 2024 that number is 79%. This is the importance of wanting to try to find a way.

optimizer.add_stack(TeamStack(3, for_teams=['ATL'], for_roster_order=['1', '2', '3', '4', '5','6'])) or optimizer.add_stack(TeamStack(3, for_teams=['ATL'], for_roster_order=['1-6']))

Thx beforehand

Denwen12 commented 7 months ago

I did a quick look in the team stack function so this may be possible but may need further discussion

To achieve your goal of stacking primarily from batting positions 1-6 while still allowing the 7,8,9 hitters to be in the selection process, you can use the "for_batting_order" parameter in the TeamStack constructor. This parameter allows you to specify the range of batting positions you want to include in the stack.

Here is an example of how you can modify your code to achieve this:

optimizer.add_stack(TeamStack(3, for_teams=['ATL'], for_batting_order=(1, 6)))

This code will create a stack for the Atlanta Braves that includes players from batting positions 1 through 6. The 7, 8, and 9 hitters will still be considered for selection, but the core of the stack will come from the top 6 positions.

By using the "for_batting_order" parameter, you can customize the selection process to prioritize players from specific batting positions while still allowing for flexibility in the overall lineup construction.

On Tue, Apr 9, 2024, 11:55 PM G Dub D @.***> wrote:

@DimaKudosh https://github.com/DimaKudosh is there a way to form stacks this way?

I have my roster order columns and batting orders before I run the opt but I was trying to eliminate the 7,8,9 hitters from my stack consideration but not for overall lineup consideration. If "optimizer.set_spacing_for_positions(['1B', '2B', '3B'], 3)" is used it could use a 9,1,2 wrap or 8,9,1 wrap to which i am trying to avoid. The "spacing=" argument could also give a wrap around. For MLB the 7,8,9 roster positions are pretty much useless but you will still need to be able to let them be in the selection process but wantig the core of stacks to come from the 1-6 positions. In 2023 82.7% of the top fantasy points scored came from batting positions 1-6 So far in 2024 that number is 79%. This is the importance of wanting to try to find a way.

optimizer.add_stack(TeamStack(3, for_teams=['ATL'], for_roster_order=['1', '2', '3', '4', '5','6'])) or optimizer.add_stack(TeamStack(3, for_teams=['ATL'], for_roster_order=['1-6']))

Thx beforehand

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

Milkman9691 commented 7 months ago

Thanks bunches. You are awesome for creating this btw.

Milkman9691 commented 7 months ago

TypeError Traceback (most recent call last) Cell In[58], line 1 ----> 1 optimizer.add_stack(TeamStack(3, for_teams=['ATL'], for_batting_order=(1,6)))

TypeError: TeamStack.init() got an unexpected keyword argument 'for_batting_order'

Now I am lost

Denwen12 commented 7 months ago

It didn't work so disregard that I'll look more into it

On Wed, Apr 10, 2024, 1:27 AM G Dub D @.***> wrote:


TypeError Traceback (most recent call last) Cell In[58], line 1 ----> 1 optimizer.add_stack(TeamStack(3, for_teams=['ATL'], for_batting_order=(1,6)))

TypeError: TeamStack.init() got an unexpected keyword argument 'for_batting_order'

Now I am lost

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

Denwen12 commented 7 months ago

Try this

Here's an example of how you can set the spacing parameter for positions 7, 8, and 9:

optimizer.add_stack(TeamStack(3, for_teams=['ATL'], for_positions=['7', '8', '9'], spacing=9999))

By setting a high spacing value for positions 7, 8, and 9, you are essentially reducing the chances of these players being included in the stack while still allowing them to be part of the overall lineup consideration. This can be a workaround to achieve your goal without directly modifying the class or filtering players before adding them to the optimizer.

On Wed, Apr 10, 2024, 2:01 AM joseph offen @.***> wrote:

It didn't work so disregard that I'll look more into it

On Wed, Apr 10, 2024, 1:27 AM G Dub D @.***> wrote:


TypeError Traceback (most recent call last) Cell In[58], line 1 ----> 1 optimizer.add_stack(TeamStack(3, for_teams=['ATL'], for_batting_order=(1,6)))

TypeError: TeamStack.init() got an unexpected keyword argument 'for_batting_order'

Now I am lost

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

Milkman9691 commented 7 months ago

Got this Error LineupOptimizerIncorrectPositionName Traceback (most recent call last) Cell In[201], line 1 ----> 1 optimizer.add_stack(TeamStack(3, for_teams=['ATL'], for_positions=['7', '8', '9'], spacing=9999))

File ~\anaconda3\Lib\site-packages\pydfs_lineup_optimizer\lineup_optimizer.py:342, in LineupOptimizer.add_stack(self, stack) 341 def add_stack(self, stack: BaseStack) -> None: --> 342 stack.validate(self) 343 self.stacks.append(stack)

File ~\anaconda3\Lib\site-packages\pydfs_lineup_optimizer\stacks.py:210, in TeamStack.validate(self, optimizer) 208 for position in self.for_positions or []: 209 if position not in optimizer.player_pool.available_positions: --> 210 raise LineupOptimizerIncorrectPositionName('%s is incorrect position name.' % position)

LineupOptimizerIncorrectPositionName: 7 is incorrect position name.

Milkman9691 commented 7 months ago

Tried it as roster_order and got

TypeError Traceback (most recent call last) Cell In[212], line 1 ----> 1 optimizer.add_stack(TeamStack(3, for_teams=['ATL'], for_roster_order=['7', '8', '9'], spacing=9999))

TypeError: TeamStack.init() got an unexpected keyword argument 'for_roster_order'

Denwen12 commented 7 months ago

Instead of positions change it to for_roster_order

See what that will do

On Wed, Apr 10, 2024, 2:11 AM G Dub D @.***> wrote:

Got this Error LineupOptimizerIncorrectPositionName Traceback (most recent call last) Cell In[201], line 1 ----> 1 optimizer.add_stack(TeamStack(3, for_teams=['ATL'], for_positions=['7', '8', '9'], spacing=9999))

File ~\anaconda3\Lib\site-packages\pydfs_lineup_optimizer\lineup_optimizer.py:342, in LineupOptimizer.add_stack(self, stack) 341 def add_stack(self, stack: BaseStack) -> None: --> 342 stack.validate(self) 343 self.stacks.append(stack)

File ~\anaconda3\Lib\site-packages\pydfs_lineup_optimizer\stacks.py:210, in TeamStack.validate(self, optimizer) 208 for position in self.for_positions or []: 209 if position not in optimizer.player_pool.available_positions: --> 210 raise LineupOptimizerIncorrectPositionName('%s is incorrect position name.' % position)

LineupOptimizerIncorrectPositionName: 7 is incorrect position name.

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

Milkman9691 commented 7 months ago

TypeError Traceback (most recent call last) Cell In[234], line 1 ----> 1 optimizer.add_stack(TeamStack(3, for_teams=['ATL'], for_roster_order=['7', '8', '9'], spacing=9999))

TypeError: TeamStack.init() got an unexpected keyword argument 'for_roster_order'

Denwen12 commented 7 months ago

Still looking into it

On Wed, Apr 10, 2024, 2:16 AM G Dub D @.***> wrote:

TypeError Traceback (most recent call last) Cell In[234], line 1 ----> 1 optimizer.add_stack(TeamStack(3, for_teams=['ATL'], for_roster_order=['7', '8', '9'], spacing=9999))

TypeError: TeamStack.init() got an unexpected keyword argument 'for_roster_order'

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

Denwen12 commented 7 months ago

Try this

Sort players based on roster order

players.sort(key=lambda x: x.roster_order)

Select players for positions 1-6

selected_players = [player for player in players if player.roster_order in ['1', '2', '3', '4', '5', '6']]

Add selected players for stacking

optimizer.add_stack(TeamStack(3, for_teams=['ATL'], for_positions=None, spacing=None).build_stacks(selected_players, optimizer))

On Wed, Apr 10, 2024, 2:17 AM joseph offen @.***> wrote:

Still looking into it

On Wed, Apr 10, 2024, 2:16 AM G Dub D @.***> wrote:

TypeError Traceback (most recent call last) Cell In[234], line 1 ----> 1 optimizer.add_stack(TeamStack(3, for_teams=['ATL'], for_roster_order=['7', '8', '9'], spacing=9999))

TypeError: TeamStack.init() got an unexpected keyword argument 'for_roster_order'

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

Milkman9691 commented 7 months ago

NameError Traceback (most recent call last) Cell In[259], line 1 ----> 1 players.sort(key=lambda x: x.roster_order)

NameError: name 'players' is not defined

Denwen12 commented 7 months ago

I'll look into it more this weekend for you

On Wed, Apr 10, 2024, 2:26 AM G Dub D @.***> wrote:

NameError Traceback (most recent call last) Cell In[259], line 1 ----> 1 players.sort(key=lambda x: x.roster_order)

NameError: name 'players' is not defined

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

Milkman9691 commented 7 months ago

I am trying multiple things over here between msgs but I am not being much help but I appreciate evrything you are doing to assist. If I somehow get it I will let you know also. Thx again

Denwen12 commented 7 months ago

Can you send your config to @.***

On Wed, Apr 10, 2024, 2:27 AM joseph offen @.***> wrote:

I'll look into it more this weekend for you

On Wed, Apr 10, 2024, 2:26 AM G Dub D @.***> wrote:

NameError Traceback (most recent call last) Cell In[259], line 1 ----> 1 players.sort(key=lambda x: x.roster_order)

NameError: name 'players' is not defined

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

Milkman9691 commented 7 months ago

You want me to send the Excel file along with the Notebook?

Milkman9691 commented 7 months ago

pip install pydfs-lineup-optimizer

from pydfs_lineup_optimizer import get_optimizer, Site, Sport from pydfs_lineup_optimizer import TeamStack, PlayersGroup from pydfs_lineup_optimizer.stacks import GameStack, TeamStack, PositionsStack, NestedPlayersGroup, OptimizerStack, Stack

optimizer = get_optimizer(Site.DRAFTKINGS, Sport. BASEBALL)

optimizer.load_players_from_csv(r"C:\Users\Greg\Downloads\MLB DFS.csv")

optimizer.restrict_positions_for_opposing_team(['SP', 'RP'], ['1B', '1B/2B', '1B/3B', '1B/OF','1B/C','1B/SS', '2B', '2B/C', '2B/3B', '2B/OF', '2B/SS', '3B', '3B/OF', '3B/SS', 'C', 'C/1B', 'C/2B', 'C/OF', 'OF', 'SS','OF/SS', 'SS/OF'])

optimizer.add_stack(TeamStack(4, for_teams=['ATL'], for_positions=['1B', '2B', '3B', 'OF', 'SS'])) #smallest slate <5 games use 5 man stacks

optimizer.add_stack(TeamStack(3, for_teams=['LAA'], for_positions=['1B', '2B', '3B', 'OF', 'SS']))

optimizer.add_stack(TeamStack(2, for_teams=['ATL'], for_positions=['1B', '2B', '3B', 'OF', 'SS']))

SP1 = optimizer.player_pool.get_player_by_name("Nathan Eovaldi") SP1.min_exposure = .9 SP1.max_exposure = 1

SP2 = optimizer.player_pool.get_player_by_name("Carlos Rodon") SP2.min_exposure = .9 SP2.max_exposure = 1

SP2 = optimizer.player_pool.get_player_by_name("Tyler Alexander")

SP2.min_exposure = .2

SP2.max_exposure = .2

lineups = optimizer.optimize(n=20)

lineups

lineups = list(optimizer.optimize(20))

lineups

optimizer.export(r'C:\Users\Greg\Downloads\MLB Starters.csv') for lineup in lineups: print(lineup)

optimizer.print_statistic()

Denwen12 commented 7 months ago

Just the code

On Wed, Apr 10, 2024, 2:35 AM G Dub D @.***> wrote:

You want me to send the Excel file along with the Notebook?

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

Milkman9691 commented 7 months ago

The only additonal column I have in my csv is the Roster Order In that code I did not have any of the code for the Roster Order because it was not doing what I was wanting.

Denwen12 commented 7 months ago

No problem I'll trouble shoot

On Wed, Apr 10, 2024, 2:49 AM G Dub D @.***> wrote:

The only additonal column I have in my csv is the Roster Order In that code I did not have any of the code for the Roster Order because it was not doing what I was wanting.

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

Denwen12 commented 7 months ago

Can you see if this runs since I'm not home ,

from pydfs_lineup_optimizer import get_optimizer, Site, Sport from pydfs_lineup_optimizer import TeamStack, PlayersGroup from pydfs_lineup_optimizer.stacks import GameStack, PositionsStack, NestedPlayersGroup, OptimizerStack, Stack from typing import List, Optional, Dict

class CustomTeamStack(TeamStack): def build_stacks(self, players: List[Player], optimizer: 'LineupOptimizer') -> List[OptimizerStack]: players = [player for player in players if player.roster_order not in [7, 8, 9] if player.roster_order is not None] return super().build_stacks(players, optimizer)

optimizer = get_optimizer(Site.DRAFTKINGS, Sport.BASEBALL)

Load players and set restrictions as before

optimizer.add_stack(CustomTeamStack(4, for_teams=['ATL'], for_positions=['1B', '2B', '3B', 'OF', 'SS']))

optimizer.add_stack(CustomTeamStack(3, for_teams=['LAA'], for_positions=['1B', '2B', '3B', 'OF', 'SS']))

optimizer.add_stack(CustomTeamStack(2, for_teams=['ATL'], for_positions=['1B', '2B', '3B', 'OF', 'SS']))

Set player exposures for SP1 and SP2 as before

lineups = optimizer.optimize(n=20)

On Wed, Apr 10, 2024, 2:50 AM joseph offen @.***> wrote:

No problem I'll trouble shoot

On Wed, Apr 10, 2024, 2:49 AM G Dub D @.***> wrote:

The only additonal column I have in my csv is the Roster Order In that code I did not have any of the code for the Roster Order because it was not doing what I was wanting.

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

Denwen12 commented 7 months ago

optimizer = get_optimizer(Site.DRAFTKINGS, Sport. BASEBALL)

optimizer.load_players_from_csv(r"C:\Users\Greg\Downloads\MLB DFS.csv")

I didn't add this like before

On Wed, Apr 10, 2024, 3:01 AM joseph offen @.***> wrote:

Can you see if this runs since I'm not home ,

from pydfs_lineup_optimizer import get_optimizer, Site, Sport from pydfs_lineup_optimizer import TeamStack, PlayersGroup from pydfs_lineup_optimizer.stacks import GameStack, PositionsStack, NestedPlayersGroup, OptimizerStack, Stack from typing import List, Optional, Dict

class CustomTeamStack(TeamStack): def build_stacks(self, players: List[Player], optimizer: 'LineupOptimizer') -> List[OptimizerStack]: players = [player for player in players if player.roster_order not in [7, 8, 9] if player.roster_order is not None] return super().build_stacks(players, optimizer)

optimizer = get_optimizer(Site.DRAFTKINGS, Sport.BASEBALL)

Load players and set restrictions as before

optimizer.add_stack(CustomTeamStack(4, for_teams=['ATL'], for_positions=['1B', '2B', '3B', 'OF', 'SS']))

optimizer.add_stack(CustomTeamStack(3, for_teams=['LAA'], for_positions=['1B', '2B', '3B', 'OF', 'SS']))

optimizer.add_stack(CustomTeamStack(2, for_teams=['ATL'], for_positions=['1B', '2B', '3B', 'OF', 'SS']))

Set player exposures for SP1 and SP2 as before

lineups = optimizer.optimize(n=20)

On Wed, Apr 10, 2024, 2:50 AM joseph offen @.***> wrote:

No problem I'll trouble shoot

On Wed, Apr 10, 2024, 2:49 AM G Dub D @.***> wrote:

The only additonal column I have in my csv is the Roster Order In that code I did not have any of the code for the Roster Order because it was not doing what I was wanting.

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

Milkman9691 commented 7 months ago

Got this but i may have something incorrect on my end I kinda rushed

NameError Traceback (most recent call last) Cell In[4], line 1 ----> 1 class CustomTeamStack(TeamStack): 2 def build_stacks(self, players: List[Player], optimizer: 3 'LineupOptimizer') -> List[OptimizerStack]: 4 players = [player for player in players if player.roster_order not 5 in [7, 8, 9] if player.roster_order is not None]

Cell In[4], line 2, in CustomTeamStack() 1 class CustomTeamStack(TeamStack): ----> 2 def build_stacks(self, players: List[Player], optimizer: 3 'LineupOptimizer') -> List[OptimizerStack]: 4 players = [player for player in players if player.roster_order not 5 in [7, 8, 9] if player.roster_order is not None] 6 return super().build_stacks(players, optimizer)

NameError: name 'Player' is not defined

Milkman9691 commented 7 months ago

Had a misalignment but still got same Error

NameError Traceback (most recent call last) Cell In[30], line 1 ----> 1 class CustomTeamStack(TeamStack): 2 def build_stacks(self, players: List[Player], optimizer:'LineupOptimizer') -> List[OptimizerStack]: 3 players = [player for player in players if player.roster_order not in [7, 8, 9] if player.roster_order is not None]

Cell In[30], line 2, in CustomTeamStack() 1 class CustomTeamStack(TeamStack): ----> 2 def build_stacks(self, players: List[Player], optimizer:'LineupOptimizer') -> List[OptimizerStack]: 3 players = [player for player in players if player.roster_order not in [7, 8, 9] if player.roster_order is not None] 4 return super().build_stacks(players, optimizer)

NameError: name 'Player' is not defined

Denwen12 commented 7 months ago

from pydfs_lineup_optimizer import Player

Add that to the top to see

On Wed, Apr 10, 2024, 3:16 AM G Dub D @.***> wrote:

Had a misalignment but still got same Error

NameError Traceback (most recent call last) Cell In[30], line 1 ----> 1 class CustomTeamStack(TeamStack): 2 def build_stacks(self, players: List[Player], optimizer:'LineupOptimizer') -> List[OptimizerStack]: 3 players = [player for player in players if player.roster_order not in [7, 8, 9] if player.roster_order is not None]

Cell In[30], line 2, in CustomTeamStack() 1 class CustomTeamStack(TeamStack): ----> 2 def build_stacks(self, players: List[Player], optimizer:'LineupOptimizer') -> List[OptimizerStack]: 3 players = [player for player in players if player.roster_order not in [7, 8, 9] if player.roster_order is not None] 4 return super().build_stacks(players, optimizer)

NameError: name 'Player' is not defined

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

Milkman9691 commented 7 months ago

That ran perfect with one exception it no longer is showing the lineup order beside the player like it was

*New

  1. P Zack Wheeler SP PHI PHI@STL 21.89 9600.0$
  2. P Merrill Kelly SP ARI ARI@COL 19.19 8400.0$
  3. C J.T. Realmuto C PHI PHI@STL 9.19 4700.0$
  4. 1B Nolan Schanuel 1B LAA TB@LAA 6.71 3600.0$
  5. 2B Ozzie Albies 2B ATL NYM@ATL 8.63 5500.0$
  6. 3B Anthony Rendon 3B LAA TB@LAA 5.83 3400.0$
  7. SS Orlando Arcia SS ATL NYM@ATL 6.31 3600.0$
  8. OF Jarred Kelenic OF ATL NYM@ATL 6.93 3600.0$
  9. OF Michael Harris II OF ATL NYM@ATL 8.54 4400.0$
    1. OF Mickey Moniak OF LAA TB@LAA 7.23 3200.0$

*Old

  1. P Zack Wheeler SP PHI PHI@STL 21.89 9600.0$
    1. P Merrill Kelly SP ARI ARI@COL 19.19 8400.0$
    2. C Gabriel Moreno(2) C ARI ARI@COL 8.0 4100.0$
    3. 1B Jake Cronenworth(3) 1B SD CHC@SD 8.75 4100.0$
    4. 2B Xander Bogaerts(1) 2B SD CHC@SD 8.97 4900.0$
    5. 3B Tyler Wade(9) 3B SD CHC@SD 6.84 2600.0$
    6. SS Jace Peterson(6) SS ARI ARI@COL 8.51 3100.0$
    7. OF Corbin Carroll(1) OF ARI ARI@COL 11.96 5700.0$
    8. OF Joc Pederson(3) OF ARI ARI@COL 10.55 4200.0$
  2. OF Jackson Merrill(8) OF SD CHC@SD 7.57 3200.0$
Denwen12 commented 7 months ago

I'm not sure why that changed

On Wed, Apr 10, 2024, 3:27 AM G Dub D @.***> wrote:

That ran perfect with one exception it no longer is showing the lineup order beside the player like it was

*New

  1. P Zack Wheeler SP PHI @.*** 21.89 9600.0$
  2. P Merrill Kelly SP ARI @.*** 19.19 8400.0$
  3. C J.T. Realmuto C PHI @.*** 9.19 4700.0$
  4. 1B Nolan Schanuel 1B LAA @.*** 6.71 3600.0$
  5. 2B Ozzie Albies 2B ATL @.*** 8.63 5500.0$
  6. 3B Anthony Rendon 3B LAA @.*** 5.83 3400.0$
  7. SS Orlando Arcia SS ATL @.*** 6.31 3600.0$
  8. OF Jarred Kelenic OF ATL @.*** 6.93 3600.0$
  9. OF Michael Harris II OF ATL @.*** 8.54 4400.0$
  10. OF Mickey Moniak OF LAA @.*** 7.23 3200.0$

*Old

  1. P Zack Wheeler SP PHI @.*** 21.89 9600.0$
  2. P Merrill Kelly SP ARI @.*** 19.19 8400.0$
  3. C Gabriel Moreno(2) C ARI @.*** 8.0 4100.0$
  4. 1B Jake Cronenworth(3) 1B SD @.*** 8.75 4100.0$
  5. 2B Xander Bogaerts(1) 2B SD @.*** 8.97 4900.0$
  6. 3B Tyler Wade(9) 3B SD @.*** 6.84 2600.0$
  7. SS Jace Peterson(6) SS ARI @.*** 8.51 3100.0$
  8. OF Corbin Carroll(1) OF ARI @.*** 11.96 5700.0$
  9. OF Joc Pederson(3) OF ARI @.*** 10.55 4200.0$
  10. OF Jackson Merrill(8) OF SD @.*** 7.57 3200.0$

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

Denwen12 commented 7 months ago

Is the code working like you wanted?

On Wed, Apr 10, 2024, 3:58 AM joseph offen @.***> wrote:

I'm not sure why that changed

On Wed, Apr 10, 2024, 3:27 AM G Dub D @.***> wrote:

That ran perfect with one exception it no longer is showing the lineup order beside the player like it was

*New

  1. P Zack Wheeler SP PHI @.*** 21.89 9600.0$
  2. P Merrill Kelly SP ARI @.*** 19.19 8400.0$
  3. C J.T. Realmuto C PHI @.*** 9.19 4700.0$
  4. 1B Nolan Schanuel 1B LAA @.*** 6.71 3600.0$
  5. 2B Ozzie Albies 2B ATL @.*** 8.63 5500.0$
  6. 3B Anthony Rendon 3B LAA @.*** 5.83 3400.0$
  7. SS Orlando Arcia SS ATL @.*** 6.31 3600.0$
  8. OF Jarred Kelenic OF ATL @.*** 6.93 3600.0$
  9. OF Michael Harris II OF ATL @.*** 8.54 4400.0$
  10. OF Mickey Moniak OF LAA @.*** 7.23 3200.0$

*Old

  1. P Zack Wheeler SP PHI @.*** 21.89 9600.0$
  2. P Merrill Kelly SP ARI @.*** 19.19 8400.0$
  3. C Gabriel Moreno(2) C ARI @.*** 8.0 4100.0$
  4. 1B Jake Cronenworth(3) 1B SD @.*** 8.75 4100.0$
  5. 2B Xander Bogaerts(1) 2B SD @.*** 8.97 4900.0$
  6. 3B Tyler Wade(9) 3B SD @.*** 6.84 2600.0$
  7. SS Jace Peterson(6) SS ARI @.*** 8.51 3100.0$
  8. OF Corbin Carroll(1) OF ARI @.*** 11.96 5700.0$
  9. OF Joc Pederson(3) OF ARI @.*** 10.55 4200.0$
  10. OF Jackson Merrill(8) OF SD @.*** 7.57 3200.0$

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

Milkman9691 commented 7 months ago

Still getting multiple 7,8, 9 batters with it

Denwen12 commented 7 months ago

Darn

On Wed, Apr 10, 2024, 4:00 AM G Dub D @.***> wrote:

Still getting multiple 7,8, 9 batters with it

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

Denwen12 commented 7 months ago

class CustomTeamStack(TeamStack):

def build_stacks(self, players, optimizer) -> List[OptimizerStack]:
    filtered_players = [player for player in players if

player.roster_order not in [7, 8, 9] or player.roster_order is None] return super().build_stacks(filtered_players, optimizer)

Replace the old code to this I added or instead of if

On Wed, Apr 10, 2024, 4:01 AM joseph offen @.***> wrote:

Darn

On Wed, Apr 10, 2024, 4:00 AM G Dub D @.***> wrote:

Still getting multiple 7,8, 9 batters with it

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

Milkman9691 commented 7 months ago

Here is the breakdown for this MLB season so far as to how they score I only count them if they were in the top 20 scorers on the slates I added by positions how they breakdown below also You can see after 5th it drops nearly in half and by positions the OF is by far the leading position

*By Batting Order 1 | 15.9% 2 | 14.6% 3 | 15.9% 4 | 12.4% 5 | 12.0% 6 | 8.2% 7 | 7.7% 8 | 7.7% 9 | 5.6%

*Positions OF | 43.8% 1B | 10.0% 1B/OF | 3.8% 2B/OF | 0.4% 3B | 8.3% 1B/2B | 0.4% C | 7.1% 2B | 10.0% SS | 11.7% 2B/3B | 0.4% 2B/SS | 1.7% 3B/SS | 0.8% 3B/OF | 0.4% 1B/3B | 0.8% 1B/C | 0.4% OF/SS | 0.0% 1B/SS | 0.0% 2B/C | 0.0% C/OF | 0.0% 3B/C | 0.0%

Denwen12 commented 7 months ago

If we can't figure something out we will try Friday or sat

On Wed, Apr 10, 2024, 4:08 AM G Dub D @.***> wrote:

Here is the breakdown for this MLB season so far as to how they score I only count them if they were in the top 20 scorers on the slates I added by positions how they breakdown below also You can see after 5th it drops nearly in half and by positions the OF is by far the leading position

*By Batting Order 1 | 15.9% 2 | 14.6% 3 | 15.9% 4 | 12.4% 5 | 12.0% 6 | 8.2% 7 | 7.7% 8 | 7.7% 9 | 5.6%

*Positions OF | 43.8% 1B | 10.0% 1B/OF | 3.8% 2B/OF | 0.4% 3B | 8.3% 1B/2B | 0.4% C | 7.1% 2B | 10.0% SS | 11.7% 2B/3B | 0.4% 2B/SS | 1.7% 3B/SS | 0.8% 3B/OF | 0.4% 1B/3B | 0.8% 1B/C | 0.4% OF/SS | 0.0% 1B/SS | 0.0% 2B/C | 0.0% C/OF | 0.0% 3B/C | 0.0%

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

Denwen12 commented 7 months ago

Can you send the players-list to my email address?

On Wed, Apr 10, 2024, 4:10 AM joseph offen @.***> wrote:

If we can't figure something out we will try Friday or sat

On Wed, Apr 10, 2024, 4:08 AM G Dub D @.***> wrote:

Here is the breakdown for this MLB season so far as to how they score I only count them if they were in the top 20 scorers on the slates I added by positions how they breakdown below also You can see after 5th it drops nearly in half and by positions the OF is by far the leading position

*By Batting Order 1 | 15.9% 2 | 14.6% 3 | 15.9% 4 | 12.4% 5 | 12.0% 6 | 8.2% 7 | 7.7% 8 | 7.7% 9 | 5.6%

*Positions OF | 43.8% 1B | 10.0% 1B/OF | 3.8% 2B/OF | 0.4% 3B | 8.3% 1B/2B | 0.4% C | 7.1% 2B | 10.0% SS | 11.7% 2B/3B | 0.4% 2B/SS | 1.7% 3B/SS | 0.8% 3B/OF | 0.4% 1B/3B | 0.8% 1B/C | 0.4% OF/SS | 0.0% 1B/SS | 0.0% 2B/C | 0.0% C/OF | 0.0% 3B/C | 0.0%

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

Milkman9691 commented 7 months ago

yeah no problem

Milkman9691 commented 7 months ago

Here is the Excel file in xlsx that way you can see everything that I use. May be easier that way.

On Wed, Apr 10, 2024 at 3:41 AM Denwen12 @.***> wrote:

Can you send the players-list to my email address?

On Wed, Apr 10, 2024, 4:10 AM joseph offen @.***> wrote:

If we can't figure something out we will try Friday or sat

On Wed, Apr 10, 2024, 4:08 AM G Dub D @.***> wrote:

Here is the breakdown for this MLB season so far as to how they score I only count them if they were in the top 20 scorers on the slates I added by positions how they breakdown below also You can see after 5th it drops nearly in half and by positions the OF is by far the leading position

*By Batting Order 1 | 15.9% 2 | 14.6% 3 | 15.9% 4 | 12.4% 5 | 12.0% 6 | 8.2% 7 | 7.7% 8 | 7.7% 9 | 5.6%

*Positions OF | 43.8% 1B | 10.0% 1B/OF | 3.8% 2B/OF | 0.4% 3B | 8.3% 1B/2B | 0.4% C | 7.1% 2B | 10.0% SS | 11.7% 2B/3B | 0.4% 2B/SS | 1.7% 3B/SS | 0.8% 3B/OF | 0.4% 1B/3B | 0.8% 1B/C | 0.4% OF/SS | 0.0% 1B/SS | 0.0% 2B/C | 0.0% C/OF | 0.0% 3B/C | 0.0%

— Reply to this email directly, view it on GitHub < https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/426#issuecomment-2046839207>,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/ANBWO7TOWHMOMM2B6D7YIQLY4TXQXAVCNFSM6AAAAABF7VX7GCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBWHAZTSMRQG4>

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

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

Denwen12 commented 7 months ago

Send it via email @.***

On Wed, Apr 10, 2024, 4:47 AM G Dub D @.***> wrote:

Here is the Excel file in xlsx that way you can see everything that I use. May be easier that way.

On Wed, Apr 10, 2024 at 3:41 AM Denwen12 @.***> wrote:

Can you send the players-list to my email address?

On Wed, Apr 10, 2024, 4:10 AM joseph offen @.***> wrote:

If we can't figure something out we will try Friday or sat

On Wed, Apr 10, 2024, 4:08 AM G Dub D @.***> wrote:

Here is the breakdown for this MLB season so far as to how they score I only count them if they were in the top 20 scorers on the slates I added by positions how they breakdown below also You can see after 5th it drops nearly in half and by positions the OF is by far the leading position

*By Batting Order 1 | 15.9% 2 | 14.6% 3 | 15.9% 4 | 12.4% 5 | 12.0% 6 | 8.2% 7 | 7.7% 8 | 7.7% 9 | 5.6%

*Positions OF | 43.8% 1B | 10.0% 1B/OF | 3.8% 2B/OF | 0.4% 3B | 8.3% 1B/2B | 0.4% C | 7.1% 2B | 10.0% SS | 11.7% 2B/3B | 0.4% 2B/SS | 1.7% 3B/SS | 0.8% 3B/OF | 0.4% 1B/3B | 0.8% 1B/C | 0.4% OF/SS | 0.0% 1B/SS | 0.0% 2B/C | 0.0% C/OF | 0.0% 3B/C | 0.0%

— Reply to this email directly, view it on GitHub <

https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/426#issuecomment-2046839207>,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ANBWO7TOWHMOMM2B6D7YIQLY4TXQXAVCNFSM6AAAAABF7VX7GCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBWHAZTSMRQG4>

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

— Reply to this email directly, view it on GitHub < https://github.com/DimaKudosh/pydfs-lineup-optimizer/issues/426#issuecomment-2046920655>,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/AWNNK4FYPKA7NPAEXCUQJWDY4T3M7AVCNFSM6AAAAABF7VX7GCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBWHEZDANRVGU>

. You are receiving this because you authored the thread.Message ID: @.***>

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

Milkman9691 commented 7 months ago

why is the email showing up as a bunch of ***. Or am i not savvy enuf to know how to see them yet

Denwen12 commented 7 months ago

J o f f e n 1 2 @ g m a i l . C o m

Without spaces

On Wed, Apr 10, 2024, 4:53 AM G Dub D @.***> wrote:

why is the email showing up as a bunch of ***. Or am i not savvy enuf to know how to see them yet

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

Milkman9691 commented 7 months ago

I believe that is what you were wanting. Let me know if that is correct. It is from last nights Draftkings slate

Denwen12 commented 7 months ago

Yes, that's it. I'll try to get something working

On Wed, Apr 10, 2024, 4:58 AM G Dub D @.***> wrote:

I believe that is what you were wanting. Let me know if that is correct. It is from last nights Draftkings slate

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

Milkman9691 commented 7 months ago

Thx for all the help and I am signing off for a bit

lightninglarry commented 7 months ago

Here is the breakdown for this MLB season so far as to how they score I only count them if they were in the top 20 scorers on the slates I added by positions how they breakdown below also You can see after 5th it drops nearly in half and by positions the OF is by far the leading position

*By Batting Order 1 | 15.9% 2 | 14.6% 3 | 15.9% 4 | 12.4% 5 | 12.0% 6 | 8.2% 7 | 7.7% 8 | 7.7% 9 | 5.6%

*Positions OF | 43.8% 1B | 10.0% 1B/OF | 3.8% 2B/OF | 0.4% 3B | 8.3% 1B/2B | 0.4% C | 7.1% 2B | 10.0% SS | 11.7% 2B/3B | 0.4% 2B/SS | 1.7% 3B/SS | 0.8% 3B/OF | 0.4% 1B/3B | 0.8% 1B/C | 0.4% OF/SS | 0.0% 1B/SS | 0.0% 2B/C | 0.0% C/OF | 0.0% 3B/C | 0.0%

this is DK data right? Would you happen to have FD Data like this? Good stuff man, always looking for an edge.

Milkman9691 commented 7 months ago

Here is the breakdown for this MLB season so far as to how they score I only count them if they were in the top 20 scorers on the slates I added by positions how they breakdown below also You can see after 5th it drops nearly in half and by positions the OF is by far the leading position By Batting Order 1 | 15.9% 2 | 14.6% 3 | 15.9% 4 | 12.4% 5 | 12.0% 6 | 8.2% 7 | 7.7% 8 | 7.7% 9 | 5.6% Positions OF | 43.8% 1B | 10.0% 1B/OF | 3.8% 2B/OF | 0.4% 3B | 8.3% 1B/2B | 0.4% C | 7.1% 2B | 10.0% SS | 11.7% 2B/3B | 0.4% 2B/SS | 1.7% 3B/SS | 0.8% 3B/OF | 0.4% 1B/3B | 0.8% 1B/C | 0.4% OF/SS | 0.0% 1B/SS | 0.0% 2B/C | 0.0% C/OF | 0.0% 3B/C | 0.0%

this is DK data right? Would you happen to have FD Data like this? Good stuff man, always looking for an edge.

Correct that is DK Data. You could create one for FD in just a few minutes if you want. The more the season progresses the longer it takes to create. I understand the edge part bc I am always looking for one too. I can shoot you several pointers and ideas in a new thread or via email if you want. I consistently get my Pitchers correct every night but the hitters are where the high variance is.