Bottom Page

• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
 Scrap arbitrage odds -help Gochix2020 Programmer named Tim Posts: 5 Threads: 2 Joined: Jul 2019 Reputation: 0 Likes received: 0 #1 Jul-31-2019, 04:36 AM (This post was last modified: Jul-31-2019, 04:48 AM by Gochix2020. Edited 1 time in total.) Hi there. I have this code which friend of mine gave me as he trying to figure out why this code not working. Basically it should scrap the best arbitrage odds opportunity from website. All it does is giving back text of link of leagues of football or any other sports. But it supposed to give arrbitrage odds opportunity. Here is the code. Im sure you guys will figure it out more than i will. So please if its not hard for you help me with this. It uses selenium and webdriver which i have. ` import timeimport sysfrom selenium import webdriver ##basic calculations of how the odds stack updef 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 checkelse: 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() ` [python] 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() [python] « Next Oldest | Next Newest »

Top Page

 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 Scrap a dynamic span hefaz 0 577 Mar-07-2020, 02:56 PM Last Post: hefaz scrap by defining 3 functions zarize 0 260 Feb-18-2020, 03:55 PM Last Post: zarize Skipping anti-scrap zarize 0 309 Jan-17-2020, 11:51 AM Last Post: zarize Cannot get selenium to scrap past the first two pages newbie_programmer 0 959 Dec-12-2019, 06:19 AM Last Post: newbie_programmer Scrap data from not standarized page? zarize 4 600 Nov-25-2019, 10:25 AM Last Post: zarize page impossible to scrap? :O zarize 2 838 Oct-03-2019, 02:44 PM Last Post: zarize Scrap a value from website harsush 1 380 Aug-29-2019, 01:57 PM Last Post: snippsat Scrap text out of td table from URLS Gochix2020 4 1,267 Aug-03-2019, 02:56 AM Last Post: Larz60+ scrap macrotrends mr_byte31 7 2,017 Aug-02-2019, 12:02 AM Last Post: mr_byte31 i am trying to web scrap this .asp nufan0000 1 500 May-30-2019, 02:27 AM Last Post: Larz60+

Forum Jump:

Users browsing this thread: 1 Guest(s)