Spaces:
Running
Running
James McCool
commited on
Commit
·
9012c48
1
Parent(s):
937571e
added no vig probably
Browse files
app.py
CHANGED
@@ -101,6 +101,25 @@ def init_baselines():
|
|
101 |
|
102 |
return game_model, overall_stats, timestamp, prop_frame, prop_trends, pick_frame, market_props
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
game_model, overall_stats, timestamp, prop_frame, prop_trends, pick_frame, market_props = init_baselines()
|
105 |
qb_stats = overall_stats[overall_stats['Position'] == 'QB']
|
106 |
qb_stats = qb_stats.drop_duplicates(subset=['Player', 'Position'])
|
@@ -226,14 +245,15 @@ with tab4:
|
|
226 |
market_type = st.selectbox('Select type of prop are you wanting to view', options = prop_table_options, key = 'market_type_key')
|
227 |
disp_market = market_props.copy()
|
228 |
disp_market = disp_market[disp_market['PropType'] == market_type]
|
|
|
229 |
fanduel_frame = disp_market[disp_market['OddsType'] == 'FANDUEL']
|
230 |
-
fanduel_dict = dict(zip(fanduel_frame['Name'], fanduel_frame['
|
231 |
draftkings_frame = disp_market[disp_market['OddsType'] == 'DRAFTKINGS']
|
232 |
-
draftkings_dict = dict(zip(draftkings_frame['Name'], draftkings_frame['
|
233 |
mgm_frame = disp_market[disp_market['OddsType'] == 'MGM']
|
234 |
-
mgm_dict = dict(zip(mgm_frame['Name'], mgm_frame['
|
235 |
consensus_frame = disp_market[disp_market['OddsType'] == 'CONSENSUS']
|
236 |
-
consensus_dict = dict(zip(consensus_frame['Name'], consensus_frame['
|
237 |
|
238 |
disp_market['FANDUEL Prop'] = disp_market['Name'].map(fanduel_dict)
|
239 |
disp_market['DRAFTKINGS Prop'] = disp_market['Name'].map(draftkings_dict)
|
|
|
101 |
|
102 |
return game_model, overall_stats, timestamp, prop_frame, prop_trends, pick_frame, market_props
|
103 |
|
104 |
+
def calculate_no_vig(row):
|
105 |
+
def implied_probability(american_odds):
|
106 |
+
if american_odds < 0:
|
107 |
+
return (-american_odds) / ((-american_odds) + 100)
|
108 |
+
else:
|
109 |
+
return 100 / (american_odds + 100)
|
110 |
+
|
111 |
+
over_line = row['over_pay'].apply(lambda x: (x - 1) * 100 if x >= 2.0 else -100 / (x - 1))
|
112 |
+
under_line = row['under_pay'].apply(lambda x: (x - 1) * 100 if x >= 2.0 else -100 / (x - 1))
|
113 |
+
over_prop = row['Projection']
|
114 |
+
|
115 |
+
over_prob = implied_probability(over_line)
|
116 |
+
under_prob = implied_probability(under_line)
|
117 |
+
|
118 |
+
total_prob = over_prob + under_prob
|
119 |
+
no_vig_prob = (over_prob / total_prob + 0.5) * over_prop
|
120 |
+
|
121 |
+
return no_vig_prob
|
122 |
+
|
123 |
game_model, overall_stats, timestamp, prop_frame, prop_trends, pick_frame, market_props = init_baselines()
|
124 |
qb_stats = overall_stats[overall_stats['Position'] == 'QB']
|
125 |
qb_stats = qb_stats.drop_duplicates(subset=['Player', 'Position'])
|
|
|
245 |
market_type = st.selectbox('Select type of prop are you wanting to view', options = prop_table_options, key = 'market_type_key')
|
246 |
disp_market = market_props.copy()
|
247 |
disp_market = disp_market[disp_market['PropType'] == market_type]
|
248 |
+
disp_market['No_Vig_Prop'] = disp_market.apply(calculate_no_vig, axis=1)
|
249 |
fanduel_frame = disp_market[disp_market['OddsType'] == 'FANDUEL']
|
250 |
+
fanduel_dict = dict(zip(fanduel_frame['Name'], fanduel_frame['No_Vig_Prop']))
|
251 |
draftkings_frame = disp_market[disp_market['OddsType'] == 'DRAFTKINGS']
|
252 |
+
draftkings_dict = dict(zip(draftkings_frame['Name'], draftkings_frame['No_Vig_Prop']))
|
253 |
mgm_frame = disp_market[disp_market['OddsType'] == 'MGM']
|
254 |
+
mgm_dict = dict(zip(mgm_frame['Name'], mgm_frame['No_Vig_Prop']))
|
255 |
consensus_frame = disp_market[disp_market['OddsType'] == 'CONSENSUS']
|
256 |
+
consensus_dict = dict(zip(consensus_frame['Name'], consensus_frame['No_Vig_Prop']))
|
257 |
|
258 |
disp_market['FANDUEL Prop'] = disp_market['Name'].map(fanduel_dict)
|
259 |
disp_market['DRAFTKINGS Prop'] = disp_market['Name'].map(draftkings_dict)
|