Skip to content

Commit 8d57fd2

Browse files
authored
Merge pull request #28 from BetWave/exerelease
addedexe
2 parents 5d1a4bc + 9601817 commit 8d57fd2

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed
9.21 MB
Binary file not shown.

bet_data.db

-11.5 MB
Binary file not shown.

main_BetWaves.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ def tab_overview_setup():
5050
def bet_overview_static_text():
5151
Label(bet_overview, text="Betfair Sportsbook URL: ").grid(row=1, column = 1, columnspan = 1)
5252
Label(bet_overview, text="Strategy: ").grid(row=2, column = 1, columnspan = 1)
53+
Label(bet_overview, text="TIme period (s): ").grid(row=3, column = 1, columnspan = 1)
54+
5355
bet_overview_static_text() # call static text
5456

5557
# & Bet URL input
@@ -58,6 +60,8 @@ def bet_overview_static_text():
5860
bet_url_entry.grid(row=rw,column = 3, columnspan = 7, sticky="W")
5961
bet_url_entry.insert(END,"https://www.betfair.com/exchange/plus/football")
6062

63+
64+
# Strategy drop down menu
6165
OPTIONS = []
6266
import os
6367
for file in os.listdir():
@@ -71,6 +75,17 @@ def bet_overview_static_text():
7175

7276
w = OptionMenu(bet_overview, strategyoptions, *OPTIONS)
7377
w.grid(row=2, column = 3, columnspan = 1)
78+
79+
# Timer drop down menu
80+
timeoptions = [60,600,6000,6000]
81+
82+
global timeoption
83+
timeoption = StringVar(bet_overview)
84+
timeoption.set(timeoptions[3]) # default value
85+
86+
w = OptionMenu(bet_overview, timeoption, *timeoptions)
87+
w.grid(row=3, column = 3, columnspan = 1)
88+
7489
#w.pack()
7590

7691

@@ -217,7 +232,7 @@ def scrape_url(self):
217232
# ACTION: Retrieve URL from Tkinter text window
218233
url = bet_url_entry.get()
219234
strategy = strategyoptions.get()
220-
235+
timelimit = int(timeoption.get())
221236
# ACTION: Open Driver window and define driver variable
222237
try:
223238
# COMMENT: Case where we have already opened the window
@@ -227,9 +242,12 @@ def scrape_url(self):
227242
url_previous = "not available"
228243
opened_driver = get_driver(url,url_previous)
229244

245+
print("Macro started")
230246

231247
# ACTION: Loop through calls of functions
232-
for n in range(0,100000):
248+
time_elapsed = 0
249+
start_time = time.time()
250+
while time_elapsed <= timelimit:
233251

234252
# STEP: Connect to database
235253
conn = sqlite3.connect('bet_data.db')
@@ -280,17 +298,15 @@ def scrape_url(self):
280298
break
281299

282300
# COMMENT: print function provides feedback to user that loop is running
283-
print(n)
284301

285302
# STEP: Close the database connection
286303
conn.close()
287304

288-
# STEP: refresh the driver to ensure we get the latest betting data
289-
#opened_driver.driver.refresh()
290-
291-
# STEP: sleep for 1 second to allow the refreshed driver to open
292-
#time.sleep(0.5)
293-
305+
# STEP: Increment time elapsed
306+
time_elapsed = time.time() - start_time
307+
print(str(time_elapsed)+"s - cycle completed")
308+
309+
print("Macro finished")
294310

295311
# ============= Tidy up ============
296312
# COMMENT: define url_previous to allow the existing driver to be used again

strategy_lowodds.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def __init__(self,bet_data,c,conn,driver):
5757
self.market_entry_type = "home"
5858
self.bank_volume = bet_data.previous_bank_volume - stake_ammount
5959
execute_trade(driver,bet_data.league,bet_data.sub_table,bet_data.row,"home_back",stake_ammount,bet_data.home_back_odds)
60+
print("backed: Home team - " + str(bet_data.home_team_name) + " with odds: " + str(self.market_entry_odds))
6061
else:
6162
self.market_entry_odds = bet_data.previous_entry_odds
6263
self.market_entry_type = "none"
@@ -81,6 +82,7 @@ def __init__(self,bet_data,c,conn,driver):
8182
self.market_entry_type = "draw"
8283
self.bank_volume = bet_data.previous_bank_volume - stake_ammount
8384
execute_trade(driver,bet_data.league,bet_data.sub_table,bet_data.row,"draw_back",stake_ammount,bet_data.home_back_odds)
85+
print("Backed: Draw in market" + str(bet_data.home_team_name) + " vs " + str(bet_data.away_team_name) + " with odds: " + str(self.market_entry_odds))
8486
else:
8587
self.market_entry_odds = bet_data.previous_entry_odds
8688
self.market_entry_type = "none"
@@ -102,6 +104,7 @@ def __init__(self,bet_data,c,conn,driver):
102104
self.market_entry_type = "away"
103105
self.bank_volume = bet_data.previous_bank_volume - stake_ammount
104106
execute_trade(driver,bet_data.league,bet_data.sub_table,bet_data.row,"away_back",stake_ammount,bet_data.home_back_odds)
107+
print("backed: Away team - " + str(bet_data.away_team_name) + " with odds: " + str(self.market_entry_odds))
105108
else:
106109
self.market_entry_odds = bet_data.previous_entry_odds
107110
self.market_entry_type = "none"

0 commit comments

Comments
 (0)