Introduction to Team Stacking

Team Stacking

Introduction

Hey everyone, long time no see! Today we are going to be reviewing the basics of Team Stacking, with an emphasis on the basics. We will be getting into some more advanced stacking strategies in future videos.

First up, we will need to go ahead and import our modules, and define our player list and load our players into the optimizer. You will notice we have our standard import function on the top row, and then a new import statement to bring in our TeamStack function. You can put this all into a single import statement, I just wanted to separate the to call out the new item specifically.

from pydfs_lineup_optimizer import get_optimizer, Site, Sport
from pydfs_lineup_optimizer import TeamStack
playerList = r"C:\Users\nfwya\OneDrive\FanDuel-NBA-2022 ET-01 ET-15 ET-70261-players-list.csv"
optimizer = get_optimizer(Site.FANDUEL, Sport.BASKETBALL)
optimizer.load_players_from_csv(playerList)

Since we are going to be utilizing team stacking today, I went ahead and compiled a list of all the teams present in this player list so you can mix and match the teams used in this example.

""" TEAMS : LAL, DEN, BKN, PHI, SA, DAL,
            BOS, ATL, WAS, NO, LAC, MIA,
            CHI, POR, OKC, NY, CLE, ORL
"""

Regular lineups with no modifiers

As a control group we are going to run the first 10 lineups from the optimizer with no modifiers present. This will serve as our control group to compare our future stacking results with.

lineups = optimizer.optimize(n=10)
for lineup in lineups:
    print(lineup)
1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 312.99
Salary 59800.00

 1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      Luka Doncic                   PG/SG DAL            ORL@DAL  48.215         10400.0$  
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 312.49
Salary 59900.00

 1. PG      Dejounte Murray               PG/SG SA             LAC@SA   47.446         10500.0$  
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 311.72
Salary 60000.00

 1. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 2. PG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Franz Wagner                  SF/SG ORL            ORL@DAL  28.607         6200.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 311.30
Salary 60000.00

 1. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 2. PG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Josh Giddey                   SG    OKC            CLE@OKC  31.642         6700.0$   
 5. SF      Dorian Finney-Smith           SF/SG DAL            ORL@DAL  23.237         4500.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 311.15
Salary 60000.00

 1. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 2. PG      Trae Young                    PG    ATL            NY@ATL   45.457         9700.0$   
 3. SG      Dorian Finney-Smith           SF/SG DAL            ORL@DAL  23.237         4500.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 311.08
Salary 60000.00

 1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      Reggie Jackson                PG    LAC            LAC@SA   26.782         5300.0$   
 3. SG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 311.08
Salary 60000.00

 1. PG      Trae Young                    PG    ATL            NY@ATL   45.457         9700.0$   
 2. PG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Josh Giddey                   SG    OKC            CLE@OKC  31.642         6700.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 311.07
Salary 59900.00

 1. PG      Kyle Lowry                    PG    MIA            PHI@MIA  32.589         7000.0$   
 2. PG      Russell Westbrook             PG    LAL            LAL@DEN  40.614         8500.0$   
 3. SG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 311.06
Salary 60000.00

 1. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 2. PG      Trae Young                    PG    ATL            NY@ATL   45.457         9700.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Jonas Valanciunas             C     NO             NO@BKN   38.526         7600.0$   

Fantasy Points 311.06
Salary 60000.00

Team Stacking

Our first example of team stacking is going to be forcing a 3 from one team stack, with no restrictions on what that team is. So we need to go ahead and reinitialize our optimizer to clear out any existing settings.

optimizer = get_optimizer(Site.FANDUEL, Sport.BASKETBALL)
optimizer.load_players_from_csv(playerList)

Next up, we are going to utilize the TeamStack function that we imported, and add the stack to the optimizer.

optimizer.add_stack(TeamStack(3))

Now, we can rerun our optimizer and compare the results from our control group.

lineups = optimizer.optimize(n=10)
for lineup in lineups:
    print(lineup)
1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      Russell Westbrook             PG    LAL            LAL@DEN  40.614         8500.0$   
 3. SG      Luka Doncic                   PG/SG DAL            ORL@DAL  48.215         10400.0$  
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Dorian Finney-Smith           SF/SG DAL            ORL@DAL  23.237         4500.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 309.63
Salary 59900.00

 1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      Luka Doncic                   PG/SG DAL            ORL@DAL  48.215         10400.0$  
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Dorian Finney-Smith           SF/SG DAL            ORL@DAL  23.237         4500.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 309.31
Salary 59400.00

 1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      Luka Doncic                   PG/SG DAL            ORL@DAL  48.215         10400.0$  
 3. SG      Dorian Finney-Smith           SF/SG DAL            ORL@DAL  23.237         4500.0$   
 4. SG      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 309.15
Salary 60000.00

 1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      Russell Westbrook             PG    LAL            LAL@DEN  40.614         8500.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 6. SF      Tobias Harris                 PF/SF PHI            PHI@MIA  34.987         7500.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Joel Embiid                   C     PHI            PHI@MIA  50.83          10600.0$  

Fantasy Points 308.69
Salary 60000.00

 1. PG      Devonte' Graham               PG/SG NO             NO@BKN   25.851         5500.0$   
 2. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Jonas Valanciunas             C     NO             NO@BKN   38.526         7600.0$   

Fantasy Points 308.65
Salary 60000.00

 1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      Reggie Jackson                PG    LAC            LAC@SA   26.782         5300.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Luka Doncic                   PG/SG DAL            ORL@DAL  48.215         10400.0$  
 5. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 6. SF      Tim Hardaway                  SF/SG DAL            ORL@DAL  25.669         5400.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 308.64
Salary 60000.00

 1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      Luka Doncic                   PG/SG DAL            ORL@DAL  48.215         10400.0$  
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Tim Hardaway                  SF/SG DAL            ORL@DAL  25.669         5400.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 308.27
Salary 59700.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 308.26
Salary 59900.00

 1. PG      Reggie Jackson                PG    LAC            LAC@SA   26.782         5300.0$   
 2. PG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 5. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 6. SF      Tobias Harris                 PF/SF PHI            PHI@MIA  34.987         7500.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Joel Embiid                   C     PHI            PHI@MIA  50.83          10600.0$  

Fantasy Points 308.16
Salary 60000.00

 1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      Luka Doncic                   PG/SG DAL            ORL@DAL  48.215         10400.0$  
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Dorian Finney-Smith           SF/SG DAL            ORL@DAL  23.237         4500.0$   
 5. SF      Franz Wagner                  SF/SG ORL            ORL@DAL  28.607         6200.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 308.03
Salary 60000.00

As we can see here, every lineup has at least one team with three players included.

Team Stack Exposure

Next up we will be showing how we can set exposures for the team stacking across the slate. This is as simple as including the max_exposure parameter in the TeamStack function.

It is important to note that this will set an exposure on the team that gets stacked, not the individual stacks themselves. So an exposure of .1 with ten lineups means that each team can only be stacked once.

optimizer = get_optimizer(Site.FANDUEL, Sport.BASKETBALL)
optimizer.load_players_from_csv(playerList)
optimizer.add_stack(TeamStack(3, max_exposure=0.2))
lineups = optimizer.optimize(n=10)
for lineup in lineups:
    print(lineup)
1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      Russell Westbrook             PG    LAL            LAL@DEN  40.614         8500.0$   
 3. SG      Luka Doncic                   PG/SG DAL            ORL@DAL  48.215         10400.0$  
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Dorian Finney-Smith           SF/SG DAL            ORL@DAL  23.237         4500.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 309.63
Salary 59900.00

 1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      Luka Doncic                   PG/SG DAL            ORL@DAL  48.215         10400.0$  
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Dorian Finney-Smith           SF/SG DAL            ORL@DAL  23.237         4500.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 309.31
Salary 59400.00

 1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      Russell Westbrook             PG    LAL            LAL@DEN  40.614         8500.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 6. SF      Tobias Harris                 PF/SF PHI            PHI@MIA  34.987         7500.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Joel Embiid                   C     PHI            PHI@MIA  50.83          10600.0$  

Fantasy Points 308.69
Salary 60000.00

 1. PG      Devonte' Graham               PG/SG NO             NO@BKN   25.851         5500.0$   
 2. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Jonas Valanciunas             C     NO             NO@BKN   38.526         7600.0$   

Fantasy Points 308.65
Salary 60000.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 308.26
Salary 59900.00

 1. PG      Reggie Jackson                PG    LAC            LAC@SA   26.782         5300.0$   
 2. PG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 5. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 6. SF      Tobias Harris                 PF/SF PHI            PHI@MIA  34.987         7500.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Joel Embiid                   C     PHI            PHI@MIA  50.83          10600.0$  

Fantasy Points 308.16
Salary 60000.00

 1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      Russell Westbrook             PG    LAL            LAL@DEN  40.614         8500.0$   
 3. SG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Brandon Ingram                SF    NO             NO@BKN   37.909         8200.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Jonas Valanciunas             C     NO             NO@BKN   38.526         7600.0$   

Fantasy Points 307.72
Salary 60000.00

 1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      Monte Morris                  PG    DEN            LAL@DEN  23.319         4700.0$   
 3. SG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Aaron Gordon                  PF    DEN            LAL@DEN  26.073         5100.0$   
 8. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 307.27
Salary 59500.00

 1. PG      Dejounte Murray               PG/SG SA             LAC@SA   47.446         10500.0$  
 2. PG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Kevin Durant                  PF/SF BKN            NO@BKN   49.694         10900.0$  
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Jakob Poeltl                  C     SA             LAC@SA   31.763         6200.0$   

Fantasy Points 307.27
Salary 60000.00

 1. PG      Monte Morris                  PG    DEN            LAL@DEN  23.319         4700.0$   
 2. PG      Reggie Jackson                PG    LAC            LAC@SA   26.782         5300.0$   
 3. SG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Aaron Gordon                  PF    DEN            LAL@DEN  26.073         5100.0$   
 8. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 307.06
Salary 60000.00

Stacking a Specific Team

Now, if we want to stack a specific team, we can pass the for_teams parameter to the TeamStack function. It is important to remember that even if you are only passing a single team, this needs to be passed as a list. The items in the list will need to be strings, and will need to match the team abbreviation that is present on your player list.

optimizer = get_optimizer(Site.FANDUEL, Sport.BASKETBALL)
optimizer.load_players_from_csv(playerList)
optimizer.add_stack(TeamStack(3, for_teams=['BOS']))
lineups = optimizer.optimize(n=10)
for lineup in lineups:
    print(lineup)
C:\Users\nfwya\anaconda3\lib\site-packages\pydfs_lineup_optimizer\utils.py:156: DeprecationWarning: available_teams will be removed in version 3.7, use player_pool.available_teams instead
  warnings.warn(text, DeprecationWarning)


 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 308.26
Salary 59900.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.98
Salary 59800.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      Jaylen Brown                  SF/SG BOS            CHI@BOS  38.024         8800.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.80
Salary 60000.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Aaron Gordon                  PF    DEN            LAL@DEN  26.073         5100.0$   
 8. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.63
Salary 59900.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Josh Richardson               SF/SG BOS            CHI@BOS  18.968         4300.0$   
 6. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.35
Salary 59900.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 3. SG      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Josh Richardson               SF/SG BOS            CHI@BOS  18.968         4300.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.15
Salary 59800.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Reggie Jackson                PG    LAC            LAC@SA   26.782         5300.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.15
Salary 59600.00

 1. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 2. PG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 3. SG      Josh Richardson               SF/SG BOS            CHI@BOS  18.968         4300.0$   
 4. SG      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.15
Salary 60000.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Russell Westbrook             PG    LAL            LAL@DEN  40.614         8500.0$   
 3. SG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 4. SG      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.10
Salary 59800.00

 1. PG      Cole Anthony                  PG/SG ORL            ORL@DAL  36.352         7800.0$   
 2. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Jaylen Brown                  SF/SG BOS            CHI@BOS  38.024         8800.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.06
Salary 60000.00

If we want the optimizer to create stacks from 2 teams, we simply need to pass more than one team in the for_teams list. This does not stack both teams on the same lineup, just forces a stack from one of the teams in the list for each lineup.

optimizer = get_optimizer(Site.FANDUEL, Sport.BASKETBALL)
optimizer.load_players_from_csv(playerList)
C:\Users\nfwya\anaconda3\lib\site-packages\ipykernel\ipkernel.py:287: DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in the future. Please pass the result to `transformed_cell` argument and any exception that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 and above.
  and should_run_async(code)
optimizer.add_stack(TeamStack(3, for_teams=['BOS', 'MIA']))
lineups = optimizer.optimize(n=10)
for lineup in lineups:
    print(lineup)
C:\Users\nfwya\anaconda3\lib\site-packages\ipykernel\ipkernel.py:287: DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in the future. Please pass the result to `transformed_cell` argument and any exception that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 and above.
  and should_run_async(code)
C:\Users\nfwya\anaconda3\lib\site-packages\pydfs_lineup_optimizer\utils.py:156: DeprecationWarning: available_teams will be removed in version 3.7, use player_pool.available_teams instead
  warnings.warn(text, DeprecationWarning)
C:\Users\nfwya\anaconda3\lib\site-packages\pydfs_lineup_optimizer\utils.py:156: DeprecationWarning: available_teams will be removed in version 3.7, use player_pool.available_teams instead
  warnings.warn(text, DeprecationWarning)


 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 308.26
Salary 59900.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.98
Salary 59800.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      Jaylen Brown                  SF/SG BOS            CHI@BOS  38.024         8800.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.80
Salary 60000.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Aaron Gordon                  PF    DEN            LAL@DEN  26.073         5100.0$   
 8. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.63
Salary 59900.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Josh Richardson               SF/SG BOS            CHI@BOS  18.968         4300.0$   
 6. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.35
Salary 59900.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 3. SG      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Josh Richardson               SF/SG BOS            CHI@BOS  18.968         4300.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.15
Salary 59800.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Reggie Jackson                PG    LAC            LAC@SA   26.782         5300.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.15
Salary 59600.00

 1. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 2. PG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 3. SG      Josh Richardson               SF/SG BOS            CHI@BOS  18.968         4300.0$   
 4. SG      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.15
Salary 60000.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Russell Westbrook             PG    LAL            LAL@DEN  40.614         8500.0$   
 3. SG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 4. SG      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.10
Salary 59800.00

 1. PG      Cole Anthony                  PG/SG ORL            ORL@DAL  36.352         7800.0$   
 2. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Jaylen Brown                  SF/SG BOS            CHI@BOS  38.024         8800.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.06
Salary 60000.00

In addition to this, we can also apply a max exposure to the stacked teams. In this instance, the exposure will be applied to each team stack individually, so BOS stack will only be present in 10% of lineups, and MIA stack will also only be present for a separate 10% of lineups.

optimizer = get_optimizer(Site.FANDUEL, Sport.BASKETBALL)
optimizer.load_players_from_csv(playerList)
C:\Users\nfwya\anaconda3\lib\site-packages\ipykernel\ipkernel.py:287: DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in the future. Please pass the result to `transformed_cell` argument and any exception that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 and above.
  and should_run_async(code)
optimizer.add_stack(TeamStack(3, for_teams=['BOS', 'MIA'], max_exposure=0.1))
lineups = optimizer.optimize(n=10)
for lineup in lineups:
    print(lineup)
C:\Users\nfwya\anaconda3\lib\site-packages\ipykernel\ipkernel.py:287: DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in the future. Please pass the result to `transformed_cell` argument and any exception that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 and above.
  and should_run_async(code)
C:\Users\nfwya\anaconda3\lib\site-packages\pydfs_lineup_optimizer\utils.py:156: DeprecationWarning: available_teams will be removed in version 3.7, use player_pool.available_teams instead
  warnings.warn(text, DeprecationWarning)
C:\Users\nfwya\anaconda3\lib\site-packages\pydfs_lineup_optimizer\utils.py:156: DeprecationWarning: available_teams will be removed in version 3.7, use player_pool.available_teams instead
  warnings.warn(text, DeprecationWarning)


 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 308.26
Salary 59900.00

 1. PG      Kyle Lowry                    PG    MIA            PHI@MIA  32.589         7000.0$   
 2. PG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Duncan Robinson               SG    MIA            PHI@MIA  19.731         5000.0$   
 5. SF      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 303.49
Salary 59700.00

 1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 312.99
Salary 59800.00

 1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      Luka Doncic                   PG/SG DAL            ORL@DAL  48.215         10400.0$  
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 312.49
Salary 59900.00

 1. PG      Dejounte Murray               PG/SG SA             LAC@SA   47.446         10500.0$  
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 311.72
Salary 60000.00

 1. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 2. PG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Franz Wagner                  SF/SG ORL            ORL@DAL  28.607         6200.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 311.30
Salary 60000.00

 1. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 2. PG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Josh Giddey                   SG    OKC            CLE@OKC  31.642         6700.0$   
 5. SF      Dorian Finney-Smith           SF/SG DAL            ORL@DAL  23.237         4500.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 311.15
Salary 60000.00

 1. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 2. PG      Trae Young                    PG    ATL            NY@ATL   45.457         9700.0$   
 3. SG      Dorian Finney-Smith           SF/SG DAL            ORL@DAL  23.237         4500.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 311.08
Salary 60000.00

 1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      Reggie Jackson                PG    LAC            LAC@SA   26.782         5300.0$   
 3. SG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 311.08
Salary 60000.00

 1. PG      Trae Young                    PG    ATL            NY@ATL   45.457         9700.0$   
 2. PG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Josh Giddey                   SG    OKC            CLE@OKC  31.642         6700.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 311.07
Salary 59900.00
optimizer = get_optimizer(Site.FANDUEL, Sport.BASKETBALL)
optimizer.load_players_from_csv(playerList)
C:\Users\nfwya\anaconda3\lib\site-packages\ipykernel\ipkernel.py:287: DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in the future. Please pass the result to `transformed_cell` argument and any exception that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 and above.
  and should_run_async(code)
optimizer.add_stack(TeamStack(3, for_teams=['BOS', 'MIA'], max_exposure=0.5))
lineups = optimizer.optimize(n=10)
for lineup in lineups:
    print(lineup)
C:\Users\nfwya\anaconda3\lib\site-packages\ipykernel\ipkernel.py:287: DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in the future. Please pass the result to `transformed_cell` argument and any exception that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 and above.
  and should_run_async(code)
C:\Users\nfwya\anaconda3\lib\site-packages\pydfs_lineup_optimizer\utils.py:156: DeprecationWarning: available_teams will be removed in version 3.7, use player_pool.available_teams instead
  warnings.warn(text, DeprecationWarning)
C:\Users\nfwya\anaconda3\lib\site-packages\pydfs_lineup_optimizer\utils.py:156: DeprecationWarning: available_teams will be removed in version 3.7, use player_pool.available_teams instead
  warnings.warn(text, DeprecationWarning)


 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 308.26
Salary 59900.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.98
Salary 59800.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      Jaylen Brown                  SF/SG BOS            CHI@BOS  38.024         8800.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.80
Salary 60000.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Aaron Gordon                  PF    DEN            LAL@DEN  26.073         5100.0$   
 8. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.63
Salary 59900.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Josh Richardson               SF/SG BOS            CHI@BOS  18.968         4300.0$   
 6. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.35
Salary 59900.00

 1. PG      Kyle Lowry                    PG    MIA            PHI@MIA  32.589         7000.0$   
 2. PG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Duncan Robinson               SG    MIA            PHI@MIA  19.731         5000.0$   
 5. SF      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 303.49
Salary 59700.00

 1. PG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 2. PG      Kyle Lowry                    PG    MIA            PHI@MIA  32.589         7000.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 5. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 6. SF      Tyler Herro                   SF/SG MIA            PHI@MIA  32.147         7500.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Ivica Zubac                   C     LAC            LAC@SA   23.887         4200.0$   

Fantasy Points 303.01
Salary 60000.00

 1. PG      Kyle Lowry                    PG    MIA            PHI@MIA  32.589         7000.0$   
 2. PG      Reggie Jackson                PG    LAC            LAC@SA   26.782         5300.0$   
 3. SG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 4. SG      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 5. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 6. SF      Tyler Herro                   SF/SG MIA            PHI@MIA  32.147         7500.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 302.80
Salary 59900.00

 1. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 2. PG      Kyle Lowry                    PG    MIA            PHI@MIA  32.589         7000.0$   
 3. SG      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 4. SG      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Tyler Herro                   SF/SG MIA            PHI@MIA  32.147         7500.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 302.43
Salary 59600.00

 1. PG      Kyle Lowry                    PG    MIA            PHI@MIA  32.589         7000.0$   
 2. PG      Reggie Jackson                PG    LAC            LAC@SA   26.782         5300.0$   
 3. SG      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 6. SF      Tyler Herro                   SF/SG MIA            PHI@MIA  32.147         7500.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 302.38
Salary 59500.00

Player Exposures With Team Stacks

If you are wanting to stack certain teams but don't want the same exact players stacked every time, you can still apply player exposures in addition to your team stack exposures. Here we will be setting our Boston and Miami team stacks to a max exposure of 50%, then applying an overall player exposure to 20%. This will result in our normal boston and miami stacking half the lineups, but will limit each individual player to onlly 2 lineups to increase our lineup variability.

optimizer = get_optimizer(Site.FANDUEL, Sport.BASKETBALL)
optimizer.load_players_from_csv(playerList)
C:\Users\nfwya\anaconda3\lib\site-packages\ipykernel\ipkernel.py:287: DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in the future. Please pass the result to `transformed_cell` argument and any exception that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 and above.
  and should_run_async(code)
optimizer.add_stack(TeamStack(3, for_teams=['BOS', 'MIA'], max_exposure=0.5))
lineups = optimizer.optimize(n=10, max_exposure=.2)
for lineup in lineups:
    print(lineup)
C:\Users\nfwya\anaconda3\lib\site-packages\ipykernel\ipkernel.py:287: DeprecationWarning: `should_run_async` will not call `transform_cell` automatically in the future. Please pass the result to `transformed_cell` argument and any exception that happen during thetransform in `preprocessing_exc_tuple` in IPython 7.17 and above.
  and should_run_async(code)
C:\Users\nfwya\anaconda3\lib\site-packages\pydfs_lineup_optimizer\utils.py:156: DeprecationWarning: available_teams will be removed in version 3.7, use player_pool.available_teams instead
  warnings.warn(text, DeprecationWarning)
C:\Users\nfwya\anaconda3\lib\site-packages\pydfs_lineup_optimizer\utils.py:156: DeprecationWarning: available_teams will be removed in version 3.7, use player_pool.available_teams instead
  warnings.warn(text, DeprecationWarning)


 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 308.26
Salary 59900.00

 1. PG      Dennis Schroder               PG/SG BOS            CHI@BOS  26.606         5500.0$   
 2. PG      Jalen Brunson                 PG/SG DAL            ORL@DAL  30.305         6000.0$   
 3. SG      DeMar DeRozan                 SF/SG CHI            CHI@BOS  40.3           8000.0$   
 4. SG      Tyrese Maxey                  PG/SG PHI            PHI@MIA  29.891         5600.0$   
 5. SF      Jayson Tatum                  PF/SF BOS            CHI@BOS  43.792         9900.0$   
 6. SF      Nickeil Alexander-Walker      SF/SG NO             NO@BKN   22.913         3700.0$   
 7. PF      Al Horford                    C/PF  BOS            CHI@BOS  30.147         5000.0$   
 8. PF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 9. C       Nikola Jokic                  C     DEN            LAL@DEN  55.609         11100.0$  

Fantasy Points 305.98
Salary 59800.00

 1. PG      Eric Bledsoe                  PG/SG LAC            LAC@SA   23.291         4600.0$   
 2. PG      Kyle Lowry                    PG    MIA            PHI@MIA  32.589         7000.0$   
 3. SG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 4. SG      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 5. SF      Keldon Johnson                PF/SF SA             LAC@SA   26.416         5000.0$   
 6. SF      Tyler Herro                   SF/SG MIA            PHI@MIA  32.147         7500.0$   
 7. PF      Aaron Gordon                  PF    DEN            LAL@DEN  26.073         5100.0$   
 8. PF      Montrezl Harrell              C/PF  WAS            POR@WAS  28.697         5100.0$   
 9. C       Jakob Poeltl                  C     SA             LAC@SA   31.763         6200.0$   

Fantasy Points 293.30
Salary 60000.00

 1. PG      Kyle Lowry                    PG    MIA            PHI@MIA  32.589         7000.0$   
 2. PG      Reggie Jackson                PG    LAC            LAC@SA   26.782         5300.0$   
 3. SG      Dorian Finney-Smith           SF/SG DAL            ORL@DAL  23.237         4500.0$   
 4. SG      James Harden                  PG/SG BKN            NO@BKN   48.717         10300.0$  
 5. SF      Jimmy Butler                  SF/SG MIA            PHI@MIA  43.608         9200.0$   
 6. SF      Tyler Herro                   SF/SG MIA            PHI@MIA  32.147         7500.0$   
 7. PF      Aaron Gordon                  PF    DEN            LAL@DEN  26.073         5100.0$   
 8. PF      Willy Hernangomez             C/PF  NO             NO@BKN   18.426         3500.0$   
 9. C       Jonas Valanciunas             C     NO             NO@BKN   38.526         7600.0$   

Fantasy Points 290.11
Salary 60000.00

 1. PG      Reggie Jackson                PG    LAC            LAC@SA   26.782         5300.0$   
 2. PG      Russell Westbrook             PG    LAL            LAL@DEN  40.614         8500.0$   
 3. SG      Dorian Finney-Smith           SF/SG DAL            ORL@DAL  23.237         4500.0$   
 4. SG      Luka Doncic                   PG/SG DAL            ORL@DAL  48.215         10400.0$  
 5. SF      Jaylen Brown                  SF/SG BOS            CHI@BOS  38.024         8800.0$   
 6. SF      Josh Richardson               SF/SG BOS            CHI@BOS  18.968         4300.0$   
 7. PF      Robert Williams               C/PF  BOS            CHI@BOS  31.0           7100.0$   
 8. PF      Willy Hernangomez             C/PF  NO             NO@BKN   18.426         3500.0$   
 9. C       Jonas Valanciunas             C     NO             NO@BKN   38.526         7600.0$   

Fantasy Points 283.79
Salary 60000.00

 1. PG      Russell Westbrook             PG    LAL            LAL@DEN  40.614         8500.0$   
 2. PG      Trae Young                    PG    ATL            NY@ATL   45.457         9700.0$   
 3. SG      Eric Bledsoe                  PG/SG LAC            LAC@SA   23.291         4600.0$   
 4. SG      Jaylen Brown                  SF/SG BOS            CHI@BOS  38.024         8800.0$   
 5. SF      Josh Richardson               SF/SG BOS            CHI@BOS  18.968         4300.0$   
 6. SF      Talen Horton-Tucker           SF/SG LAL            LAL@DEN  22.077         4600.0$   
 7. PF      Julius Randle                 C/PF  NY             NY@ATL   39.108         8200.0$   
 8. PF      Robert Williams               C/PF  BOS            CHI@BOS  31.0           7100.0$   
 9. C       Ivica Zubac                   C     LAC            LAC@SA   23.887         4200.0$   

Fantasy Points 282.43
Salary 60000.00

 1. PG      Cole Anthony                  PG/SG ORL            ORL@DAL  36.352         7800.0$   
 2. PG      Trae Young                    PG    ATL            NY@ATL   45.457         9700.0$   
 3. SG      Duncan Robinson               SG    MIA            PHI@MIA  19.731         5000.0$   
 4. SG      Kyle Guy                      SG    MIA            PHI@MIA  14.933         3800.0$   
 5. SF      Brandon Ingram                SF    NO             NO@BKN   37.909         8200.0$   
 6. SF      Caleb Martin                  SF/SG MIA            PHI@MIA  18.569         5200.0$   
 7. PF      Jarrett Allen                 C/PF  CLE            CLE@OKC  37.628         7900.0$   
 8. PF      Julius Randle                 C/PF  NY             NY@ATL   39.108         8200.0$   
 9. C       Ivica Zubac                   C     LAC            LAC@SA   23.887         4200.0$   

Fantasy Points 273.57
Salary 60000.00

 1. PG      Luka Doncic                   PG/SG DAL            ORL@DAL  48.215         10400.0$  
 2. PG      Monte Morris                  PG    DEN            LAL@DEN  23.319         4700.0$   
 3. SG      Duncan Robinson               SG    MIA            PHI@MIA  19.731         5000.0$   
 4. SG      Kyle Guy                      SG    MIA            PHI@MIA  14.933         3800.0$   
 5. SF      Talen Horton-Tucker           SF/SG LAL            LAL@DEN  22.077         4600.0$   
 6. SF      Tobias Harris                 PF/SF PHI            PHI@MIA  34.987         7500.0$   
 7. PF      Jarrett Allen                 C/PF  CLE            CLE@OKC  37.628         7900.0$   
 8. PF      P.J. Tucker                   C/PF  MIA            PHI@MIA  20.883         5500.0$   
 9. C       Joel Embiid                   C     PHI            PHI@MIA  50.83          10600.0$  

Fantasy Points 272.60
Salary 60000.00

 1. PG      Cole Anthony                  PG/SG ORL            ORL@DAL  36.352         7800.0$   
 2. PG      Payton Pritchard              PG/SG BOS            CHI@BOS  10.406         3700.0$   
 3. SG      Josh Giddey                   SG    OKC            CLE@OKC  31.642         6700.0$   
 4. SG      Romeo Langford                SG    BOS            CHI@BOS  11.809         3500.0$   
 5. SF      Kevin Durant                  PF/SF BKN            NO@BKN   49.694         10900.0$  
 6. SF      Tobias Harris                 PF/SF PHI            PHI@MIA  34.987         7500.0$   
 7. PF      Grant Williams                PF    BOS            CHI@BOS  15.142         3700.0$   
 8. PF      Kevin Love                    C/PF  CLE            CLE@OKC  26.306         5600.0$   
 9. C       Joel Embiid                   C     PHI            PHI@MIA  50.83          10600.0$  

Fantasy Points 267.17
Salary 60000.00

 1. PG      Dejounte Murray               PG/SG SA             LAC@SA   47.446         10500.0$  
 2. PG      Monte Morris                  PG    DEN            LAL@DEN  23.319         4700.0$   
 3. SG      Caleb Martin                  SF/SG MIA            PHI@MIA  18.569         5200.0$   
 4. SG      Josh Giddey                   SG    OKC            CLE@OKC  31.642         6700.0$   
 5. SF      Brandon Ingram                SF    NO             NO@BKN   37.909         8200.0$   
 6. SF      Deni Avdija                   PF/SF WAS            POR@WAS  18.867         3900.0$   
 7. PF      Kevin Durant                  PF/SF BKN            NO@BKN   49.694         10900.0$  
 8. PF      P.J. Tucker                   C/PF  MIA            PHI@MIA  20.883         5500.0$   
 9. C       Dewayne Dedmon                C     MIA            PHI@MIA  16.854         4300.0$   

Fantasy Points 265.18
Salary 59900.00
Next
Next

Adding a New Sport to pydfs_lineup_optimizer