Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scrap arbitrage odds -help
#4
should be like this I hope this time it pastes normaly
import time

import sys

from selenium import webdriver



##basic calculations of how the odds stack up

def arb(info):

	arbs = []

	for x in info[1::2]:

		arb = ((1.0/x)*100.0)

		arbs.append(arb)

	total = sum(arbs)

	if total == 0:

		return

	profit = (10.0/(total/100.0))-10.0

	bets = list(map(lambda x: (10*x)/total, arbs))

	#ignore anything that we can't arbitrage

	if total < 99:

		print("\n info:")

		print info 

		print("\n arbs:")

		print arbs 

		print("\n bets:") 

		print bets 

		print("\n profit: \n" + str(profit) + "\n")



#allow command line arguments if you want to quickly check a specific sport	

if len(sys.argv) > 1:

	sports = sys.argv[1:]

#otherwise use default list of sports to check

else: 

	sports = ['https://www.oddschecker.com/baseball/mlb','https://www.oddschecker.com/football','https://www.oddschecker.com/tennis/atp-rome',

	'https://www.oddschecker.com/basketball/nba', 'https://www.oddschecker.com/football/english/premier-league', 'https://www.oddschecker.com/football/english/championship',

	'https://www.oddschecker.com/football/english/league-1', 'https://www.oddschecker.com/football/english/league-2', 'https://www.oddschecker.com/football/english/fa-cup',

	'https://www.oddschecker.com/football/elite-coupon', 'https://www.oddschecker.com/football/france/ligue-2', 'https://www.oddschecker.com/football/champions-league',

	'https://www.oddschecker.com/football/europa-league', 'https://www.oddschecker.com/football/womens-coupon','https://www.oddschecker.com/american-football/nfl',

	'https://www.oddschecker.com/australian-rules/afl', 'https://www.oddschecker.com/badminton', 'https://www.oddschecker.com/boxing', 'https://www.oddschecker.com/ufc-mma',

	'https://www.oddschecker.com/gaelic-games/gaelic-football','https://www.oddschecker.com/handball/handball-coupon', 'https://www.oddschecker.com/hockey/all-matches',

	'https://www.oddschecker.com/rugby-league/match-coupon','https://www.oddschecker.com/rugby-league/handicaps-coupon','https://www.oddschecker.com/rugby-union/match-coupon',

	'https://www.oddschecker.com/rugby-union/handicaps-coupon', 'https://www.oddschecker.com/rugby-union/european-champions-cup', 'https://www.oddschecker.com/rugby-union/lions-tour',

	'https://www.oddschecker.com/cricket/ipl','https://www.oddschecker.com/ice-hockey/nhl','https://www.oddschecker.com/tennis/itf-futures',

	'https://www.oddschecker.com/tennis/challenger-tour','https://www.oddschecker.com/tennis/wta-rome','https://www.oddschecker.com/football/football-coupons/over-under-2.5',

	'https://www.oddschecker.com/football/football-coupons/over-under-1.5', 'https://www.oddschecker.com/football/football-coupons/over-under-0.5', 

	'https://www.oddschecker.com/football/football-coupons/both-teams-to-score']



driver = webdriver.Chrome('')  # Optional argument, if not specified will search path.



for sport in sports: 

	driver.get(sport)

	markets = driver.find_elements_by_class_name('match-on') 

	print "\n----------------------------\n" + sport + "\n----------------------------\n"

	for m in markets:

		match_data = []

		infos = m.find_elements_by_tag_name('td')

		for i in infos:

			if i.get_attribute('data-best-odds'):

				match_data.append((i.find_element_by_class_name('fixtures-bet-name').get_attribute('innerHTML')))

				match_data.append(float(i.get_attribute('data-best-odds')))

		arb(match_data)		



print "finished!"

driver.quit()
Reply


Messages In This Thread
Scrap arbitrage odds -help - by Gochix2020 - Jul-31-2019, 04:36 AM
RE: Scrap arbitrage odds -help - by fishhook - Jul-31-2019, 06:57 AM
RE: Scrap arbitrage odds -help - by Gochix2020 - Jul-31-2019, 07:26 AM
RE: Scrap arbitrage odds -help - by Gochix2020 - Jul-31-2019, 10:45 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  web scraping football results and odds terrasamba77 2 856 Mar-28-2024, 10:21 AM
Last Post: 22206290
  Web scrap --Need help Lizardpython 4 1,009 Oct-01-2023, 11:37 AM
Last Post: Lizardpython
  I tried every way to scrap morningstar financials data without success so far sparkt 2 8,226 Oct-20-2020, 05:43 PM
Last Post: sparkt
  Web scrap multiple pages anilacem_302 3 3,813 Jul-01-2020, 07:50 PM
Last Post: mlieqo
  Need logic on how to scrap 100K URLs goodmind 2 2,609 Jun-29-2020, 09:53 AM
Last Post: goodmind
  Scrap a dynamic span hefaz 0 2,685 Mar-07-2020, 02:56 PM
Last Post: hefaz
  scrap by defining 3 functions zarize 0 1,851 Feb-18-2020, 03:55 PM
Last Post: zarize
  Skipping anti-scrap zarize 0 1,873 Jan-17-2020, 11:51 AM
Last Post: zarize
  Cannot get selenium to scrap past the first two pages newbie_programmer 0 4,155 Dec-12-2019, 06:19 AM
Last Post: newbie_programmer
  Scrap data from not standarized page? zarize 4 3,295 Nov-25-2019, 10:25 AM
Last Post: zarize

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020