Quote:
Originally Posted by VeniceMerchant
Currently my 'real' bets are 30 underdogs with a breakeven of .455 and 150 faves at a breakeven of .574
I updated the script so that by default, it runs a simulation reflecting your real numbers, but with 1,000 simulated bets per season and assuming your probability of picking a winner when betting dogs or favorites is 0.005 greater than their respective breakeven rates.
First, here is the code to import the numerical module and define the simulator:
Code:
# import numpy module and define simulator
import numpy as np
def simulate_season_wagering(dog_be_odds=120,fav_be_odds=-135,win_p_dog=0.46,win_p_fav=0.579,n_bets=1000,fav_ratio=0.83):
"""
This function simulates a season of wagering, risking $100 on underdogs, and risking to win $100 on favorites.
dog_be_odds = breakeven rate for betting underdogs, expressed in American odds
fav_be_odds = breakeven rate for betting favorites, expressed in American odds
win_p_dog = the probabilitiy of success when betting on an underdog
win_p_fav = the probability of success when betting on a favorite
n_bets = the number of bets in a season
fav_ratio = the ratio of favorite to underdog bets
"""
underdog_pl = 0 # profit & loss betting underdogs
favorite_pl = 0 # profit & loss betting favorites
n_fav = int(n_bets*fav_ratio)
n_dog = n_bets - n_fav
# draw n random samples from a binomial distribution with probability of success = win_p_dog or win_p_fav
# 1 is a winning bet, 0 is a losing bet
dog_bets = np.random.binomial(n=1, p=win_p_dog, size=n_dog)
fave_bets = np.random.binomial(n=1, p=win_p_fav, size=n_fav)
#tally up the profit and loss for the simulated season of wagers
for i in range(n_dog):
if dog_bets[i] == 0:
underdog_pl -= 100
else:
underdog_pl += dog_be_odds
for i in range(n_fav):
if fave_bets[i] == 0:
favorite_pl += fav_be_odds
else:
favorite_pl += 100
return underdog_pl, favorite_pl
Here is the code you can use to run a default simulation:
Code:
# run default simulation
epochs = 10
seasons = 100
epoch_win_pct = list() # hold the percentage of profitable seasons per epoch in a list
for i in range(epochs):
dog_pl = 0 # profit and loss of betting underdogdogs
fav_pl = 0 # profit and loss of betting favorites
winning_seasons = 0
for j in range(seasons):
dog_pl, fav_pl = simulate_season_wagering()
season_wagering_results = dog_pl + fav_pl
if season_wagering_results > 0:
winning_seasons += 1
epoch_win_pct.append(winning_seasons/seasons)
epoch_win_pct = np.array(epoch_win_pct)
print(f'Over {epochs} epochs containing {seasons} simulated seasons each,\
a profitable season occurred an average of {epoch_win_pct.mean()*100:.2f}% of the time.')
Which on a typical run prints out something like "Over 10 epochs containing 100 simulated seasons each, a profitable season occurred an average of 60.90% of the time."
Say you want to customize the simulation run by just changing the probability of a success when betting dogs and faves to be 0.01 and 0.02 better than their respective breakeven rates, here is a code example:
Code:
win_p_dog = 0.455 + 0.01
win_p_fav = 0.574 + 0.02
epochs = 10
seasons = 100
epoch_win_pct = list() # hold the percentage of profitable seasons per epoch in a list
for i in range(epochs):
dog_pl = 0 # profit and loss of betting underdogdogs
fav_pl = 0 # profit and loss of betting favorites
winning_seasons = 0
for j in range(seasons):
dog_pl, fav_pl = simulate_season_wagering(win_p_dog=win_p_dog,win_p_fav=win_p_fav)
season_wagering_results = dog_pl + fav_pl
if season_wagering_results > 0:
winning_seasons += 1
epoch_win_pct.append(winning_seasons/seasons)
epoch_win_pct = np.array(epoch_win_pct)
print(f'Over {epochs} epochs containing {seasons} simulated seasons each,\
a profitable season occurred an average of {epoch_win_pct.mean()*100:.2f}% of the time.')
Which will print something like "Over 10 epochs containing 100 simulated seasons each, a profitable season occurred an average of 88.70% of the time."
The likelihood of having a profitable season drops to around 50% when setting the probability of making a successful bet equal to the breakeven rate, and drops to around 25% when setting the probability of a successful bet to 0.01 less than the breakeven rate.