Greyhound Mystique

Any markets not covered in the other boards
Post Reply
User avatar
MemphisFlash
Posts: 2126
Joined: Fri May 16, 2014 10:12 pm
Location: Leicester

what are all them?
Archery1969
Posts: 3192
Joined: Thu Oct 24, 2019 8:25 am
Location: Newport

Imports, probably over the top but its working using the PyCharm Windows IDE.

2021-01-13,11:39 Crayford, 3. Woodcocks Amelia, class A5, time difference 0.05
2021-01-13,11:43 Perry Barr, 5. Warped, class A7, time difference 0.02
2021-01-13,11:46 Central Park, 1. Hazelwoodjayfkay, class A3, time difference 0.12
2021-01-13,11:51 Swindon, 1. Ide Poady, class A7, time difference 0.01
2021-01-13,11:54 Crayford, 1. Knockalton Shay, class A6, time difference 0.06
2021-01-13,11:58 Perry Barr, 4. Cassa Amour, class A8, time difference 0.3
2021-01-13,12:06 Swindon, 5. Boleys Flash, class A8, time difference 0.02
2021-01-13,12:09 Crayford, 2. Rarity, class A6, time difference 0.07
2021-01-13,12:21 Swindon, 6. Come On Buddy, class A5, time difference 0.25
2021-01-13,12:24 Crayford, 5. Out Of Cuba, class A9, time difference 0.09
2021-01-13,12:28 Perry Barr, 1. Riveting, class A9, time difference 0.11
2021-01-13,12:31 Central Park, 4. El Diamond, class A2, time difference 0.05
2021-01-13,12:36 Swindon, 2. Be Brave, class A8, time difference 0.05
2021-01-13,12:39 Crayford, 1. Discreet Polly, class A6, time difference 0.04
2021-01-13,12:43 Perry Barr, 6. Bit View Tom, class A7, time difference 0.16
2021-01-13,12:51 Swindon, 3. Zoomey Beauty, class A4, time difference 0.08
2021-01-13,12:54 Crayford, 4. Kelva Shabnam, class A7, time difference 0.17
2021-01-13,12:58 Perry Barr, 6. Swift Sinful, class A3, time difference 0.03
2021-01-13,13:02 Central Park, 4. Diegos Vixen, class A3, time difference 0.01
2021-01-13,13:06 Swindon, 3. Wildcard, class A3, time difference 0.13
2021-01-13,13:09 Crayford, 6. Savana Maestro, class A10, time difference 0.23
2021-01-13,13:13 Perry Barr, 6. Shortwood Elle, class A6, time difference 0.03
2021-01-13,13:21 Swindon, 5. Slippy Marilyn, class A6, time difference 0.35
2021-01-13,13:24 Crayford, 1. Ashgrove Jo, class A8, time difference 0.03
2021-01-13,13:28 Perry Barr, 2. Westway Lark, class A6, time difference 0.06
2021-01-13,13:36 Swindon, 3. Snaffi Jax, class A4, time difference 0.02
2021-01-13,13:39 Crayford, 1. Yacht Panda, class A3, time difference 0.02
2021-01-13,13:44 Perry Barr, 6. Drahbeg Delish, class A5, time difference 0.12
2021-01-13,13:49 Monmore, 6. Waikiki Danny, class A6, time difference 0.07
2021-01-13,13:51 Swindon, 6. Wriggle Room, class A6, time difference 0.04
2021-01-13,13:57 Hove, 1. Bazinga Bruno, class A2, time difference 0.01
2021-01-13,14:04 Newcastle, 1. Geordie Porsha, class A7, time difference 0.07
2021-01-13,14:07 Monmore, 4. Stepitout Mary, class A6, time difference 0.49
2021-01-13,14:12 Hove, 3. Rockmount Power, class A3, time difference 0.36
2021-01-13,14:19 Newcastle, 4. Peaky Boy, class A6, time difference 0.23
2021-01-13,14:23 Monmore, 5. Trending Trooper, class A7, time difference 0.1
2021-01-13,14:32 Hove, 4. Mellys Majestic, class A8, time difference 0.2
2021-01-13,14:36 Newcastle, 6. Droopys Pilot, class A1, time difference 0.01
2021-01-13,14:54 Newcastle, 6. Watermill Bufalo, class A2, time difference 0.04
2021-01-13,15:09 Newcastle, 3. Blackhouse Eric, class A3, time difference 0.09
2021-01-13,15:11 Hove, 5. Lad Dog, class A7, time difference 0.1
2021-01-13,15:18 Monmore, 1. Inky Time, class A9, time difference 0.09
2021-01-13,15:26 Newcastle, 1. Indian Reel, class A5, time difference 0.02
2021-01-13,15:28 Hove, 6. Fahy Cain, class A3, time difference 0.06
2021-01-13,15:38 Monmore, 5. Deelish Rebel, class A5, time difference 0.03
2021-01-13,15:44 Newcastle, 1. Canny Bamm Bamm, class A6, time difference 0.06
2021-01-13,15:48 Hove, 4. Music Master, class A2, time difference 0.09
2021-01-13,15:58 Monmore, 6. Bring The Noise, class A3, time difference 0.08
2021-01-13,16:04 Newcastle, 4. Ballyhoe Alpha, class A1, time difference 0.06
2021-01-13,16:18 Monmore, 3. Swift Improvise, class A8, time difference 0.04
2021-01-13,16:23 Newcastle, 4. Crooks Fabio, class A3, time difference 0.13
2021-01-13,16:28 Hove, 4. Nunhead Alfie, class A4, time difference 0.32
2021-01-13,16:38 Monmore, 4. Coosane Molly, class A5, time difference 0.35
2021-01-13,16:43 Newcastle, 4. Watermill Cain, class A4, time difference 0.1
2021-01-13,16:58 Monmore, 3. Sober Joy, class A5, time difference 0.14
2021-01-13,17:03 Newcastle, 6. Bertsmonkeymagic, class A8, time difference 0.03
2021-01-13,17:08 Hove, 3. Crossfield Earl, class A4, time difference 0.07
2021-01-13,17:18 Monmore, 4. Onyergofreddie, class A10, time difference 0.08
2021-01-13,17:22 Newcastle, 5. Lake Mckenzie, class A7, time difference 0.03
2021-01-13,17:28 Hove, 6. Spot The Fantasy, class A5, time difference 0.09
2021-01-13,17:37 Monmore, 2. Kittykanescorner, class A10, time difference 0.01
2021-01-13,17:44 Hove, 4. Glengar Pink, class A6, time difference 0.18
2021-01-13,17:54 Monmore, 6. Mission Paw, class A9, time difference 0.04
2021-01-13,18:02 Hove, 5. Baran Fury, class A2, time difference 0.21
2021-01-13,18:09 Doncaster, 1. Millcroft Magic, class A3, time difference 0.43
2021-01-13,18:17 Harlow, 6. Which Way Molly, class A6, time difference 0.19
2021-01-13,18:19 Sunderland, 1. Thai Lady, class A2, time difference 0.15
2021-01-13,18:26 Yarmouth, 3. Adamant Kenny, class A2, time difference 0.21
2021-01-13,18:28 Doncaster, 5. Keady Wonder, class A4, time difference 0.14
2021-01-13,18:33 Harlow, 2. Pretty Mischief, class A7, time difference 0.07
2021-01-13,18:41 Yarmouth, 5. Shaneboy Tolly, class A2, time difference 0.03
2021-01-13,18:43 Doncaster, 1. Fane Sisi Sir, class A3, time difference 0.09
2021-01-13,18:59 Yarmouth, 4. Allen Belle, class A3, time difference 0.07
2021-01-13,19:07 Harlow, 4. Front Society, class A5, time difference 0.13
2021-01-13,19:09 Sunderland, 5. Jumeirah Spirit, class A4, time difference 0.1
2021-01-13,19:16 Yarmouth, 3. Leislash Janjan, class A3, time difference 0.13
2021-01-13,19:18 Doncaster, 6. Ballybunion Bill, class A2, time difference 0.13
2021-01-13,19:24 Harlow, 1. Risk Impulse, class A6, time difference 0.1
2021-01-13,19:26 Sunderland, 5. Ballyhi Ranger, class A8, time difference 0.04
2021-01-13,19:34 Yarmouth, 3. Spottie Dottie, class A6, time difference 0.37
2021-01-13,19:36 Doncaster, 4. Kilara Annie, class A5, time difference 0.24
2021-01-13,19:41 Sunderland, 5. Slippy Maire, class A7, time difference 0.21
2021-01-13,19:51 Yarmouth, 4. Dillymore Jack, class A5, time difference 0.08
2021-01-13,20:03 Harlow, 2. Swift Fascinate, class A7, time difference 0.08
2021-01-13,20:06 Yarmouth, 3. Waltzing Nancy, class A4, time difference 0.06
2021-01-13,20:21 Yarmouth, 2. Rushmoor Latte, class A1, time difference 0.1
2021-01-13,20:23 Harlow, 1. Castell Dave, class A7, time difference 0.02
2021-01-13,20:27 Sunderland, 4. Evolution Tiara, class A3, time difference 0.2
2021-01-13,20:36 Yarmouth, 4. Harwell Panda, class A4, time difference 0.04
2021-01-13,20:46 Sunderland, 5. Droopys Beatrice, class A5, time difference 0.3
2021-01-13,20:52 Yarmouth, 3. Adamant Loretta, class A3, time difference 0.15
2021-01-13,21:01 Sunderland, 4. Coaltown Ash, class A2, time difference 0.13
2021-01-13,21:02 Harlow, 4. Indian Trump, class A5, time difference 0.16
2021-01-13,21:11 Yarmouth, 1. Fades N Blades, class A2, time difference 0.15
2021-01-13,21:16 Sunderland, 5. Waikiki Del, class A6, time difference 0.03
2021-01-13,21:26 Yarmouth, 4. Buckos Ace, class A3, time difference 0.23
User avatar
MemphisFlash
Posts: 2126
Joined: Fri May 16, 2014 10:12 pm
Location: Leicester

So much to try and get your Head around.
This Old Dog is learning new tricks all the time.
spreadbetting
Posts: 3140
Joined: Sun Jan 31, 2010 8:06 pm

MemphisFlash wrote:
Wed Jan 13, 2021 8:07 am
do you teach python, you seem rather good at it? :D :D :D
If only, luckily python is one of those coding languages where a little knowledge goes a long way.
spreadbetting
Posts: 3140
Joined: Sun Jan 31, 2010 8:06 pm

Archery1969 wrote:
Wed Jan 13, 2021 11:34 am
Imports, probably over the top but its working using the PyCharm Windows IDE.
Yep that was scraping and reporting every race because the line

Code: Select all

if (1 >= x[1][0] - x[0][0]) >= 0.1 and x[1][0] !=100:
Should have been

Code: Select all

if 0.1 <= (x[1][0] - x[0][0]) <= 1 and x[1][0] !=100:


I'd changed it because it was reporting races where sportinglife had duff info for races so thought no dog was going to be more than a second faster than the next best and put the bracket in the wrong place :oops:
Archery1969
Posts: 3192
Joined: Thu Oct 24, 2019 8:25 am
Location: Newport

Observation.

SportingLife

2021-01-13,14:07 Monmore, 4. Stepitout Mary, Class A6, Time Difference 0.49

My Database

2021-01-13,14:07 Monmore, 1. Waikiki Tom, Class A6, Time Difference 0.36

Could be that I am using the adjusted time last run. T1 did actually shorten in price and start around 6/4 Favourite.

Anyway,,,,
User avatar
MemphisFlash
Posts: 2126
Joined: Fri May 16, 2014 10:12 pm
Location: Leicester

does the file need the code changing, i'm getting confused now, lol?
spreadbetting
Posts: 3140
Joined: Sun Jan 31, 2010 8:06 pm

Archery1969 wrote:
Wed Jan 13, 2021 3:03 pm
Observation.

SportingLife

2021-01-13,14:07 Monmore, 4. Stepitout Mary, Class A6, Time Difference 0.49

My Database

2021-01-13,14:07 Monmore, 1. Waikiki Tom, Class A6, Time Difference 0.36

Could be that I am using the adjusted time last run. T1 did actually shorten in price and start around 6/4 Favourite.

Anyway,,,,
Hard to know why they're different as SportingLife delete the form data after the race is run but it's set to look at the last 5 races where the course and distance are the same as today's race. Maybe your database is looking at races from all courses or distances or more than 5 races.
spreadbetting
Posts: 3140
Joined: Sun Jan 31, 2010 8:06 pm

MemphisFlash wrote:
Wed Jan 13, 2021 3:49 pm
does the file need the code changing, i'm getting confused now, lol?
Depends what you're trying to do as there's so many versions out there now :)

Here's the last version

Code: Select all

import json
import re
import requests
from bs4 import BeautifulSoup
from requests_html import HTMLSession


def main():
    
    session = HTMLSession()
    baseUrl = "https://www.sportinglife.com"
    results=[]
    urls = []
    res = requests.get("https://www.sportinglife.com/greyhounds/racecards")
    soup = BeautifulSoup(res.text, "html.parser")
    data =json.loads( soup.find('script', type='application/json').string) #convert to dictionary
    

    for market in data['props']['pageProps']['meetings']:
        
        for race in market['races']:
            if race['race_stage'] == "Dormant":
                urls.append('/greyhounds/racecards/' + race['date'] + '/' + race['course_name'].replace(" ", "-") + '/racecard/' + str(race['race_summary_reference']['id']))
    
    x = 0
    for link in urls:
        
        
        res = session.get(baseUrl + link)
        print(baseUrl + link)
        soup = BeautifulSoup(res.text, "html.parser")
        data =json.loads( soup.find('script', type='application/json').string)
        
        grade = data['props']['pageProps']['race']['race_summary']['race_class']
        distance = data['props']['pageProps']['race']['race_summary']['distance']
        course = data['props']['pageProps']['race']['race_summary']['course_name']
        race = data['props']['pageProps']['race']['race_summary']['date'] + "," + data['props']['pageProps']['race']['race_summary']['time'] + " " + course
        Runners = dict()
        
        
        data =json.loads( soup.find('script', type='application/json').string) #convert to dictionary
        for runner in data['props']['pageProps']['race']['runs']:
            runs=0
            
            
            
            Trap = runner['cloth_number']
            Name = runner['greyhound']['name']
            
            fastest_time=100
            for time in runner['greyhound']['previous_results']:
                raceDate=time['date']
                
               
                if  'distance'  in time.keys() and time['course_name'] == course and time['distance'] == distance and time['run_time'] !="" and runs < 5:
                    runs += 1
                    #print(raceDate + " " + str(time['run_time']) + " " + str(Trap) + " "  + Name)
                    
                   
                    
                    if float(time['run_time'].strip("s")) <= fastest_time :
                        
                        fastest_time=float(time['run_time'].strip("s"))
                        
                    

            
            Runners[fastest_time] = str(Trap) + '. ' + Name
            #print("\nFastest time   " + str(fastest_time) + "\n")
                        
         
        if bool(Runners) == True and ('OR' in grade or 'A' in grade) and len(Runners.items())>1:
            
            x = sorted(((k, v) for k, v in Runners.items()))
           

            if 0.1 <= (x[1][0] - x[0][0]) <= 1 and x[1][0] !=100:
                timeDiff = round((x[1][0] - x[0][0]), 2)
                results.append(race + ', ' + x[0][1] + ', class ' + grade + ', time difference ' + str(timeDiff))
               


    results.sort()
    file = open('dogs_1.txt', mode='w')
    for line in results: file.write(line+'\n')
    file.close()
    
main()
I'll talk you thru what it's doing so you can amend/tweak as you want.

First off it goes to https://www.sportinglife.com/greyhounds/racecards and grabs the urls of races where sportinglife haven't stuck up a result already.

Then it scrapes each of those races in turn going thru each runner to try and get the fastest time.

The code below is where it's doing it fastest time grab so can be easily amended to include all courses or more than 5 races

Code: Select all

if  'distance'  in time.keys() and time['course_name'] == course and time['distance'] == distance and time['run_time'] !="" and runs < 5:
The previous race data available to you is as below, you could make use of that into the code if you think it'd be useful to any rating
{
"race_id": 223351,
"date": "2021-01-04",
"course_name": "Yarmouth",
"distance": "462",
"trap_number": 1,
"sectional_time": "5.71s",
"finish_distance": "3",
"position": 2,
"odds": "8/1",
"run_time": "28.74s"
}
Once it's got the fastest races for all runners (if a runner doesn't have previous race data or race data at the distance/course it gets entered as 100*) it then checks the race grade is A something or OR and we have data for more than one runner.

Code: Select all

if bool(Runners) == True and ('OR' in grade or 'A' in grade) and len(Runners.items())>1:
next the runners get sorted in order of speed

Code: Select all

x = sorted(((k, v) for k, v in Runners.items()))
then if the time difference between the fastest and second fastest is between 0.1 and 1 and the second fastest race is not 100 (i.e. we have no data*)

Code: Select all

if 0.1 <= (x[1][0] - x[0][0]) <= 1 and x[1][0] !=100:
it gets entered into a list .

Code: Select all

results.append(race + ', ' + x[0][1] + ', class ' + grade + ', time difference ' + str(timeDiff))
Then once all races have been grabbed the list gets sorted in time order and written to a text file.

Code: Select all

results.sort()
    file = open('dogs_1.txt', mode='w')
    for line in results: file.write(line+'\n')
    file.close()
User avatar
MemphisFlash
Posts: 2126
Joined: Fri May 16, 2014 10:12 pm
Location: Leicester

thought i was doing well with python, now on brain overload, lol
User avatar
Realrocknrolla
Posts: 1903
Joined: Fri Jun 05, 2020 7:15 pm

MemphisFlash wrote:
Wed Jan 13, 2021 7:35 pm
thought i was doing well with python, now on brain overload, lol
Bit like me an excel! 😬
StellaBot
Posts: 818
Joined: Thu Jan 26, 2017 11:52 am

Hi

To take the mystery out of this above nonsense

Does anyone have data for greyhounds , say last 6 months,

In excel format

Distance times etc?
StellaBot
Posts: 818
Joined: Thu Jan 26, 2017 11:52 am

:D

The Band Genesis song springs to mind

Follow Me etc
spreadbetting
Posts: 3140
Joined: Sun Jan 31, 2010 8:06 pm

MemphisFlash wrote:
Wed Jan 13, 2021 7:35 pm
thought i was doing well with python, now on brain overload, lol
Just have to break it into manageable chunks, I wouldn't have a clue how to do a power query.
StellaBot wrote:
Wed Jan 13, 2021 8:49 pm
Hi

To take the mystery out of this above nonsense

Does anyone have data for greyhounds , say last 6 months,

In excel format

Distance times etc?
I guess all the juicy stuff is kept well away from prying eyes.
spreadbetting
Posts: 3140
Joined: Sun Jan 31, 2010 8:06 pm

jimibt wrote:
Thu Jan 07, 2021 12:22 pm


*HINT* - most of the race sites have a *private* api that isn't exposed but is easily discoverable. why battle with scraping from html (classnames/id's etc) when you can just load up an object from json and party on that! ;)
Have you considered decompiling their android apps to get the API addresses, Jim? I'm sure both sporting life and racing post etc would have andorid apps
Post Reply

Return to “Other Betfair Sports Trading markets”