James McCool commited on
Commit
0a4c08a
·
1 Parent(s): 3f59c63

Refactor flex multipliers in Streamlit app to adjust RB, WR, QB, and TE values, improving accuracy in player evaluations and ensuring consistent index limits across all positions.

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +19 -14
src/streamlit_app.py CHANGED
@@ -75,24 +75,24 @@ pos_vorp_limiters = {
75
  flex_multipliers = {
76
  'Half PPR': {
77
  'QB': 2,
78
- 'RB': 2,
79
- 'WR': 2,
80
  'TE': 2,
81
  },
82
  'PPR': {
83
  'QB': 2,
84
  'RB': 2,
85
- 'WR': 2,
86
  'TE': 2,
87
  },
88
  'Standard': {
89
  'QB': 2,
90
- 'RB': 2,
91
  'WR': 2,
92
  'TE': 2,
93
  },
94
  'Superflex': {
95
- 'QB': 4,
96
  'RB': 2,
97
  'WR': 2,
98
  'TE': 2,
@@ -101,7 +101,7 @@ flex_multipliers = {
101
  'QB': 2,
102
  'RB': 2,
103
  'WR': 2,
104
- 'TE': 4,
105
  },
106
  }
107
 
@@ -275,10 +275,15 @@ def designate_custom_position_reqs(league_settings: dict, flex_percentiles: dict
275
  wr_base = league_settings['WR'] * league_settings['TEAMS']
276
  te_base = league_settings['TE'] * league_settings['TEAMS']
277
 
278
- qb_rv_index = min(math.ceil((qb_base) * flex_multipliers['QB']), 48)
279
- rb_rv_index = min(math.ceil((rb_base + ((league_settings['TEAMS'] * league_settings['FLEX']) * flex_percentiles['RB'])) * flex_multipliers['RB']), 60)
280
- wr_rv_index = min(math.ceil((wr_base + ((league_settings['TEAMS'] * league_settings['FLEX']) * flex_percentiles['WR'])) * flex_multipliers['WR']), 90)
281
- te_rv_index = min(math.ceil((te_base + ((league_settings['TEAMS'] * league_settings['FLEX']) * flex_percentiles['TE'])) * flex_multipliers['TE']), 30)
 
 
 
 
 
282
 
283
  print(f"Need {qb_rv_index} for QB in {league_settings['TEAMS']} teams with type {league_settings['TYPE']}")
284
  print(f"Need {rb_rv_index} for RB in {league_settings['TEAMS']} teams with type {league_settings['TYPE']}")
@@ -300,10 +305,10 @@ def designate_base_position_reqs() -> dict:
300
  wr_base = 3 * 12
301
  te_base = 1 * 12
302
 
303
- qb_rv_index = min(math.ceil(qb_base * 2), 48)
304
- rb_rv_index = min(math.ceil((rb_base + ((12 * 1) * .40)) * 2), 60)
305
- wr_rv_index = min(math.ceil((wr_base + ((12 * 1) * .55)) * 2), 90)
306
- te_rv_index = min(math.ceil((te_base + ((12 * 1) * .05)) * 2), 30)
307
 
308
  print(f"Need {qb_rv_index} for QB in {12} teams with type {league_settings['TYPE']}")
309
  print(f"Need {rb_rv_index} for RB in {12} teams with type {league_settings['TYPE']}")
 
75
  flex_multipliers = {
76
  'Half PPR': {
77
  'QB': 2,
78
+ 'RB': 3,
79
+ 'WR': 3,
80
  'TE': 2,
81
  },
82
  'PPR': {
83
  'QB': 2,
84
  'RB': 2,
85
+ 'WR': 3,
86
  'TE': 2,
87
  },
88
  'Standard': {
89
  'QB': 2,
90
+ 'RB': 3,
91
  'WR': 2,
92
  'TE': 2,
93
  },
94
  'Superflex': {
95
+ 'QB': 3,
96
  'RB': 2,
97
  'WR': 2,
98
  'TE': 2,
 
101
  'QB': 2,
102
  'RB': 2,
103
  'WR': 2,
104
+ 'TE': 3,
105
  },
106
  }
107
 
 
275
  wr_base = league_settings['WR'] * league_settings['TEAMS']
276
  te_base = league_settings['TE'] * league_settings['TEAMS']
277
 
278
+ qb_flex_mult = flex_multipliers['QB'] * (league_settings['TEAMS'] / 12)
279
+ rb_flex_mult = flex_multipliers['RB'] * (league_settings['TEAMS'] / 12)
280
+ wr_flex_mult = flex_multipliers['WR'] * (league_settings['TEAMS'] / 12)
281
+ te_flex_mult = flex_multipliers['TE'] * (league_settings['TEAMS'] / 12)
282
+
283
+ qb_rv_index = min(math.ceil((qb_base) * qb_flex_mult), 1000)
284
+ rb_rv_index = min(math.ceil((rb_base + ((league_settings['TEAMS'] * league_settings['FLEX']) * flex_percentiles['RB'])) * rb_flex_mult), 1000)
285
+ wr_rv_index = min(math.ceil((wr_base + ((league_settings['TEAMS'] * league_settings['FLEX']) * flex_percentiles['WR'])) * wr_flex_mult), 1000)
286
+ te_rv_index = min(math.ceil((te_base + ((league_settings['TEAMS'] * league_settings['FLEX']) * flex_percentiles['TE'])) * te_flex_mult), 1000)
287
 
288
  print(f"Need {qb_rv_index} for QB in {league_settings['TEAMS']} teams with type {league_settings['TYPE']}")
289
  print(f"Need {rb_rv_index} for RB in {league_settings['TEAMS']} teams with type {league_settings['TYPE']}")
 
305
  wr_base = 3 * 12
306
  te_base = 1 * 12
307
 
308
+ qb_rv_index = min(math.ceil(qb_base * 2), 1000)
309
+ rb_rv_index = min(math.ceil((rb_base + ((12 * 1) * .40)) * 2), 1000)
310
+ wr_rv_index = min(math.ceil((wr_base + ((12 * 1) * .55)) * 2), 1000)
311
+ te_rv_index = min(math.ceil((te_base + ((12 * 1) * .05)) * 2), 1000)
312
 
313
  print(f"Need {qb_rv_index} for QB in {12} teams with type {league_settings['TYPE']}")
314
  print(f"Need {rb_rv_index} for RB in {12} teams with type {league_settings['TYPE']}")