James McCool
commited on
Commit
·
ef7a8b2
1
Parent(s):
c1137d7
Add team lineup filtering in hedging_preset.py to enhance lineup generation. Introduced logic to separate teams and calculate removed lineups, improving the accuracy of team-based strategies.
Browse files
global_func/hedging_preset.py
CHANGED
@@ -62,8 +62,10 @@ def hedging_preset(portfolio: pd.DataFrame, lineup_target: int, projections_file
|
|
62 |
|
63 |
for team in top_owned_teams:
|
64 |
working_df = portfolio.copy()
|
|
|
65 |
teams_df = working_df[working_df['Stack'] == team]
|
66 |
|
|
|
67 |
team_lineups = large_field_preset(teams_df, math.ceil(lineup_target / (list_size * 3)), excluded_cols)
|
68 |
concat_portfolio = pd.concat([concat_portfolio, team_lineups])
|
69 |
|
|
|
62 |
|
63 |
for team in top_owned_teams:
|
64 |
working_df = portfolio.copy()
|
65 |
+
removed_df = working_df[working_df['Stack'] != team]
|
66 |
teams_df = working_df[working_df['Stack'] == team]
|
67 |
|
68 |
+
removed_lineups = small_field_preset(removed_df, math.ceil(lineup_target / (list_size * 3)), excluded_cols)
|
69 |
team_lineups = large_field_preset(teams_df, math.ceil(lineup_target / (list_size * 3)), excluded_cols)
|
70 |
concat_portfolio = pd.concat([concat_portfolio, team_lineups])
|
71 |
|