Skip to content

Commit

Permalink
compute from max winning in "Cotes" tab
Browse files Browse the repository at this point in the history
  • Loading branch information
pretrehr committed Sep 5, 2021
1 parent 12fb820 commit 3c069b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions interface_pysimplegui.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,10 @@
[sg.Button("Aller sur la page du match", key="GOTO_SITE_ODDS", visible=False)],
[sg.Button("Supprimer le bookmaker", key="DELETE_SITE_ODDS", visible=False)],
[sg.Button("Supprimer le match", key="DELETE_MATCH_ODDS", visible=False)]]),
sg.Col([[sg.Text("Mise"), sg.InputText("100", size=(6, 1), key='STAKE_ODDS', enable_events=True)],
sg.Col([[sg.Text("Mise / Gain max"), sg.InputText("100", size=(6, 1), key='STAKE_ODDS', enable_events=True)],
[sg.Text("Issue : ")] + [sg.Radio("Mise répartie", "OUTCOME_ODDS", key="OUTCOME_ODDS_SPLIT_STAKE", enable_events=True)]
+ [sg.Col([[sg.Radio(x, "OUTCOME_ODDS", key='OUTCOME_ODDS_'+x, enable_events=True)]]) for x in ["1", "N", "2"]]])
+ [sg.Col([[sg.Radio(x, "OUTCOME_ODDS", key='OUTCOME_ODDS_'+x, enable_events=True)]]) for x in ["1", "N", "2"]]
+ [sg.Radio("Gain max", "OUTCOME_ODDS", key="OUTCOME_ODDS_MAX", enable_events=True)]])
],
[sg.MLine(size=(LENGTH_FIELD, HEIGHT_FIELD_SIMPLE), key="RESULT_ODDS", font="Consolas 10",
visible=False)]
Expand Down
8 changes: 8 additions & 0 deletions sportsbetting/interface_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,14 @@ def compute_odds(window, values):
what_was_printed = buffer.getvalue()
profit = float(what_was_printed.split("\n")[4].split(' = ')[1])
stakes = eval(what_was_printed.split("\n")[5].split(' = ')[1])
elif values["OUTCOME_ODDS_MAX"]:
old_stdout = sys.stdout # Memorize the default stdout stream
sys.stdout = buffer = io.StringIO()
mises2(best_odds, round(stake/best_odds[0], 2), 0, True)
sys.stdout = old_stdout # Put the old stream back in place
what_was_printed = buffer.getvalue()
profit = float(what_was_printed.split("\n")[5].split(' = ')[1])
stakes = eval(what_was_printed.split("\n")[6].split(' = ')[1])
else:
outcomes = ["1", "2"]
if get_nb_outcomes(sport) == 3:
Expand Down

0 comments on commit 3c069b1

Please sign in to comment.