def sort_category (category, file_source):
file = file_source.loc[file_source['Odds Category'] == category]
return file
def plot_graph (a, b):
plt.plot(a,b)
def calcul (bankroll_init, bet_init, multiplier, odds_category, file_source):
sorted_file = sort_category(odds_category, file_source)
bankroll_current = bankroll_init
bet_current = bet_init
list_bankroll = []
list_date = []
for i in sorted_file.index:
list_bankroll.append(bankroll_current)
list_date.append(sorted_file['Date'][i])
bankroll_current = bankroll_current - bet_current
if (sorted_file['B365H'][i] == sorted_file['Min Odds'][i]) & (sorted_file['FTR'][i] == 'H'):
bankroll_current = bankroll_current (bet_current * sorted_file['B365H'][i])
bet_current = bet_init
elif (sorted_file['B365A'][i] == sorted_file['Min Odds'][i]) & (sorted_file['FTR'][i] == 'A'):
bankroll_current = bankroll_current (bet_current * sorted_file['B365A'][i])
bet_current = bet_init
else :
bet_current = bet_current * multiplier
plot_graph(list_date,list_bankroll)
calcul(10000,10,2,4,ligue_1)
This code plot a graphic through the "plot_graph" function, which is called in the 'calcul' function.
Is there a way to update the five arguments of my 'calcul' function with sliders or dropdown menus ? These arguments are conditions that change the graphic.
Thanks
CodePudding user response:
I leave it to you to adapt this code for your case :
there are lot of widgets in ipywidgets library that you can discover