James McCool commited on
Commit
8393233
·
1 Parent(s): 2a7d830

Update lineup generation logic in hedging_preset.py to adjust lineup target calculations. Changed divisor from 3 to 4 in small_field_preset and large_field_preset functions to improve accuracy in lineup adjustments.

Browse files
Files changed (1) hide show
  1. global_func/hedging_preset.py +4 -4
global_func/hedging_preset.py CHANGED
@@ -53,11 +53,11 @@ def hedging_preset(portfolio: pd.DataFrame, lineup_target: int, projections_file
53
  removed_df = working_df[remove_mask]
54
  locked_df = working_df[lock_mask]
55
 
56
- removed_lineups = small_field_preset(removed_df, math.ceil(lineup_target / (list_size * 3)), excluded_cols)
57
  print(len(removed_lineups))
58
  # Check if locked_df is empty before calling large_field_preset
59
  if not locked_df.empty:
60
- locked_lineups = large_field_preset(locked_df, math.ceil(lineup_target / (list_size * 3)), excluded_cols)
61
  print(len(locked_lineups))
62
  concat_portfolio = pd.concat([concat_portfolio, removed_lineups, locked_lineups])
63
  else:
@@ -70,10 +70,10 @@ def hedging_preset(portfolio: pd.DataFrame, lineup_target: int, projections_file
70
  removed_df = working_df[working_df['Stack'] != team]
71
  teams_df = working_df[working_df['Stack'] == team]
72
 
73
- removed_lineups = small_field_preset(removed_df, math.ceil(lineup_target / (list_size * 3)), excluded_cols)
74
  # Check if teams_df is empty before calling large_field_preset
75
  if not teams_df.empty:
76
- team_lineups = large_field_preset(teams_df, math.ceil(lineup_target / (list_size * 3)), excluded_cols)
77
  concat_portfolio = pd.concat([concat_portfolio, removed_lineups, team_lineups])
78
  else:
79
  # If no lineups have this team stacked, just add the removed lineups
 
53
  removed_df = working_df[remove_mask]
54
  locked_df = working_df[lock_mask]
55
 
56
+ removed_lineups = small_field_preset(removed_df, math.ceil(lineup_target / (list_size * 4)), excluded_cols)
57
  print(len(removed_lineups))
58
  # Check if locked_df is empty before calling large_field_preset
59
  if not locked_df.empty:
60
+ locked_lineups = large_field_preset(locked_df, math.ceil(lineup_target / (list_size * 4)), excluded_cols)
61
  print(len(locked_lineups))
62
  concat_portfolio = pd.concat([concat_portfolio, removed_lineups, locked_lineups])
63
  else:
 
70
  removed_df = working_df[working_df['Stack'] != team]
71
  teams_df = working_df[working_df['Stack'] == team]
72
 
73
+ removed_lineups = small_field_preset(removed_df, math.ceil(lineup_target / (list_size * 4)), excluded_cols)
74
  # Check if teams_df is empty before calling large_field_preset
75
  if not teams_df.empty:
76
+ team_lineups = large_field_preset(teams_df, math.ceil(lineup_target / (list_size * 4)), excluded_cols)
77
  concat_portfolio = pd.concat([concat_portfolio, removed_lineups, team_lineups])
78
  else:
79
  # If no lineups have this team stacked, just add the removed lineups