Football scores to Guardian programatically - Script & Sample BAF

Football, Soccer - whatever you call it. It is the beautiful game.
Anbell
Posts: 2004
Joined: Fri Apr 05, 2019 2:31 am

Very nice work.
mtrend
Posts: 90
Joined: Sun Sep 06, 2009 6:46 pm

sniffer66 wrote:
Sat Jan 30, 2021 4:02 pm
Sorry all. That UDF (user defined function) should ship with Auto-It and be included as part of the default install. Not sure why it's not in yours

The UDF can be downloaded as a zip file at the very bottom of the first post on this page.

https://www.autoitscript.com/forum/topi ... -udf-jsmn/

Its called: Json(2019.01.17).zip

Copy that to your \includes folder where you installed Auto-It, and unzip, and all should work
Thanks Sniffer, for anyone else having issues, I had to download this version of binarycall.au3 as well, added to the includes folder and now working:

https://github.com/J2TEAM/AutoIt-Imgur-UDF


Cheers
sniffer66
Posts: 1666
Joined: Thu May 02, 2019 8:37 am

Good stuff.

I've been using Auto-It for years and have downloaded many UDFs in that time. Sometimes it's easy to forget which are part of the default install and which need adding.

On another note, it's a relatively simple task to add in any of the in play statistics from each match. Shots on/off Target, Possession, Attacks etc.
Combined with saving SVs to History Lists it would be a cool way to add in stats based decisions to Guardian

If there is any interest in those I can improve the script. Let me know
Or if you have the ability it's not hard to update yourself. Just takes a little reading to get your head around the JSON format.
mtrend
Posts: 90
Joined: Sun Sep 06, 2009 6:46 pm

sniffer66 wrote:
Sun Jan 31, 2021 8:55 am
Good stuff.

I've been using Auto-It for years and have downloaded many UDFs in that time. Sometimes it's easy to forget which are part of the default install and which need adding.

On another note, it's a relatively simple task to add in any of the in play statistics from each match. Shots on/off Target, Possession, Attacks etc.
Combined with saving SVs to History Lists it would be a cool way to add in stats based decisions to Guardian

If there is any interest in those I can improve the script. Let me know
Or if you have the ability it's not hard to update yourself. Just takes a little reading to get your head around the JSON format.
Yeah in play stats would be awesome, I'm trying to find info the SofaScore API but cant find anything published about it.
sniffer66
Posts: 1666
Joined: Thu May 02, 2019 8:37 am

mtrend wrote:
Sun Jan 31, 2021 9:27 am
sniffer66 wrote:
Sun Jan 31, 2021 8:55 am
Good stuff.

I've been using Auto-It for years and have downloaded many UDFs in that time. Sometimes it's easy to forget which are part of the default install and which need adding.

On another note, it's a relatively simple task to add in any of the in play statistics from each match. Shots on/off Target, Possession, Attacks etc.
Combined with saving SVs to History Lists it would be a cool way to add in stats based decisions to Guardian

If there is any interest in those I can improve the script. Let me know
Or if you have the ability it's not hard to update yourself. Just takes a little reading to get your head around the JSON format.
Yeah in play stats would be awesome, I'm trying to find info the SofaScore API but cant find anything published about it.

Very little published info on most sites APIs.

A good place to start is that AutoIt link I posted previously for that UDF. Json_dump() is a very handy function that will dump the contents of the json get to the console, but in readable format. Once you get your head around it, it's then relatively simple to query and return the right stats per team

Should have some free time tomorrow and will update the script with the stats.
petermikael
Posts: 4
Joined: Fri Jun 19, 2020 9:40 am

Trying to download scores but no score.csv is to find on my computer. This feature is great so help is much appreciated. I have let the script run for several minutes before i terminated the process. I go to tools->Go and the console looks like this >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Program Files (x86)\AutoIt3\Examples\Football.au3" The score.csv should be saved down to the same folder as Football.au3 if i understand it correct?
Wonkymuffin
Posts: 6
Joined: Wed Nov 09, 2016 8:46 am

sniffer66 wrote:
Sun Jan 31, 2021 9:34 am
mtrend wrote:
Sun Jan 31, 2021 9:27 am
sniffer66 wrote:
Sun Jan 31, 2021 8:55 am
Good stuff.

I've been using Auto-It for years and have downloaded many UDFs in that time. Sometimes it's easy to forget which are part of the default install and which need adding.

On another note, it's a relatively simple task to add in any of the in play statistics from each match. Shots on/off Target, Possession, Attacks etc.
Combined with saving SVs to History Lists it would be a cool way to add in stats based decisions to Guardian

If there is any interest in those I can improve the script. Let me know
Or if you have the ability it's not hard to update yourself. Just takes a little reading to get your head around the JSON format.
Yeah in play stats would be awesome, I'm trying to find info the SofaScore API but cant find anything published about it.

Very little published info on most sites APIs.

A good place to start is that AutoIt link I posted previously for that UDF. Json_dump() is a very handy function that will dump the contents of the json get to the console, but in readable format. Once you get your head around it, it's then relatively simple to query and return the right stats per team

Should have some free time tomorrow and will update the script with the stats.
Hi Sniffer66,

Have you been able to update the script with in-play stats? This would be extremely useful in improving my automation results. Thank you.
sniffer66
Posts: 1666
Joined: Thu May 02, 2019 8:37 am

petermikael wrote:
Sun Mar 07, 2021 11:21 am
Trying to download scores but no score.csv is to find on my computer. This feature is great so help is much appreciated. I have let the script run for several minutes before i terminated the process. I go to tools->Go and the console looks like this >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Program Files (x86)\AutoIt3\Examples\Football.au3" The score.csv should be saved down to the same folder as Football.au3 if i understand it correct?
To be honest, I've not used this since I created it as I don't trade football on auto in BA - just thought it would be useful

I've just tested it though and ran fine for me - CSV file saves to same folder location as the script

Returned

1
* * *Central Coast Mariners* * S Score 1
* * *Macarthur FC* * S Score 0
* * *Abeldos United* * S Score 0
* * *Ab ovo* * S Score 0
* * *Bangalore Dream United FC* * S Score 0
* * *Income Tax SC* * S Score 0

Did you download the addititonal UDF's mentioned previously in the thread, and are you seeing any errors in the Scite Console ?
11percent
Posts: 1
Joined: Mon Nov 09, 2020 9:18 am

Installed software, and run script and its happily pulling scores from sofascore site.

Many thanks for posting instructions on this Stu, this will be a really useful addition to my automation.
Wonkymuffin
Posts: 6
Joined: Wed Nov 09, 2016 8:46 am

The work you have done so far with the scores is working brilliantly for me. My comment was in relation to the in-play stats from Sofascore as you had previously mentioned that it would be easy (well for you anyway!) to add these in to the csv. Thanks again.
sniffer66
Posts: 1666
Joined: Thu May 02, 2019 8:37 am

Wonkymuffin wrote:
Mon Mar 08, 2021 9:53 am
The work you have done so far with the scores is working brilliantly for me. My comment was in relation to the in-play stats from Sofascore as you had previously mentioned that it would be easy (well for you anyway!) to add these in to the csv. Thanks again.

I'm afraid I've had to time lately. In the middle of moving house so all over the place

It's worth doing some reading on the Auto-It forum - some good examples in those threads I linked. Definitely preferable to pick up the skills yourself then you can pull data down for any sport you like

Try using the existing script and the Json_Dump() function I've mentioned previously and that will give you an idea of how the json notation works, then it's just a case of adding additional lines to pull the values you are after.
As a hint, the stats are on an additional URL, which you can create from the JSON containing the current scores. Put a link/Json_Get to that in the existing score loop and you can then grab all the stats you like

Starter for 10:

$URL = "https://api.sofascore.com/api/v1/event/" & Json_Get($object, '.events' & '[' & $i & '].id') & "/statistics"
User avatar
Euler
Posts: 24701
Joined: Wed Nov 10, 2010 1:39 pm
Location: Bet Angel HQ

You've got me interested in this from a broader perspective. So thanks again, for taking the time to share it.
sniffer66
Posts: 1666
Joined: Thu May 02, 2019 8:37 am

Euler wrote:
Mon Mar 08, 2021 1:14 pm
You've got me interested in this from a broader perspective. So thanks again, for taking the time to share it.
No problem Peter. I was doing this via Excel previously but the new CSV import function simplifies it hugely (and saves a lot in CPU overhead)
Lovely when you can get up to date data like this into Guardian

08/03/2021 13:08:41: [G_Auto 1] : Store Value for Alex Molcan: 1stServeIn% = 61
08/03/2021 13:08:41: [G_Auto 1] : Store Value for Alex Molcan: 1stServePoints% = 91
08/03/2021 13:08:41: [G_Auto 1] : Store Value for Alex Molcan: 2ndServePoints% = 86
08/03/2021 13:08:41: [G_Auto 1] : Store Value for Alex Molcan: OppPointsCount = 2
08/03/2021 13:08:41: [G_Auto 1] : Store Value for Alex Molcan: BPAgainstCount = 0
08/03/2021 13:08:41: [G_Auto 1] : Store Value for Alex Molcan: ServeBrokenNo = 0
08/03/2021 13:10:25: [G_Auto 1] : Store Value for Ernests Gulbis: 1stServeIn% = 55
08/03/2021 13:10:25: [G_Auto 1] : Store Value for Ernests Gulbis: 1stServePoints% = 75
08/03/2021 13:10:25: [G_Auto 1] : Store Value for Ernests Gulbis: 2ndServePoints% = 23
08/03/2021 13:10:25: [G_Auto 1] : Store Value for Ernests Gulbis: OppPointsCount = 14
08/03/2021 13:10:25: [G_Auto 1] : Store Value for Ernests Gulbis: BPAgainstCount = 8
08/03/2021 13:10:25: [G_Auto 1] : Store Value for Ernests Gulbis: ServeBrokenNo = 2
08/03/2021 13:10:25: [G_Auto 1] : Store Value for market: GameCount = 8 + 1 = 9
08/03/2021 13:13:56: [G_Auto 1] : Store Value for Alex Molcan: 1stServeIn% = 70
08/03/2021 13:13:56: [G_Auto 1] : Store Value for Alex Molcan: 1stServePoints% = 88
08/03/2021 13:13:56: [G_Auto 1] : Store Value for Alex Molcan: 2ndServePoints% = 86
08/03/2021 13:13:56: [G_Auto 1] : Store Value for Alex Molcan: OppPointsCount = 3
08/03/2021 13:13:56: [G_Auto 1] : Store Value for Alex Molcan: BPAgainstCount = 0
08/03/2021 13:13:56: [G_Auto 1] : Store Value for Alex Molcan: ServeBrokenNo = 0
08/03/2021 13:13:56: [G_Auto 1] : Store Value for market: GameCount = 9 + 1 = 10
User avatar
jimibt
Posts: 3641
Joined: Mon Nov 30, 2015 6:42 pm
Location: Narnia

sniffer66 wrote:
Mon Mar 08, 2021 1:17 pm
Euler wrote:
Mon Mar 08, 2021 1:14 pm
You've got me interested in this from a broader perspective. So thanks again, for taking the time to share it.
No problem Peter. I was doing this via Excel previously but the new CSV import function simplifies it hugely (and saves a lot in CPU overhead)
Lovely when you can get up to date data like this into Guardian

08/03/2021 13:08:41: [G_Auto 1] : Store Value for Alex Molcan: 1stServeIn% = 61
08/03/2021 13:08:41: [G_Auto 1] : Store Value for Alex Molcan: 1stServePoints% = 91
08/03/2021 13:08:41: [G_Auto 1] : Store Value for Alex Molcan: 2ndServePoints% = 86
08/03/2021 13:08:41: [G_Auto 1] : Store Value for Alex Molcan: OppPointsCount = 2
08/03/2021 13:08:41: [G_Auto 1] : Store Value for Alex Molcan: BPAgainstCount = 0
08/03/2021 13:08:41: [G_Auto 1] : Store Value for Alex Molcan: ServeBrokenNo = 0
08/03/2021 13:10:25: [G_Auto 1] : Store Value for Ernests Gulbis: 1stServeIn% = 55
08/03/2021 13:10:25: [G_Auto 1] : Store Value for Ernests Gulbis: 1stServePoints% = 75
08/03/2021 13:10:25: [G_Auto 1] : Store Value for Ernests Gulbis: 2ndServePoints% = 23
08/03/2021 13:10:25: [G_Auto 1] : Store Value for Ernests Gulbis: OppPointsCount = 14
08/03/2021 13:10:25: [G_Auto 1] : Store Value for Ernests Gulbis: BPAgainstCount = 8
08/03/2021 13:10:25: [G_Auto 1] : Store Value for Ernests Gulbis: ServeBrokenNo = 2
08/03/2021 13:10:25: [G_Auto 1] : Store Value for market: GameCount = 8 + 1 = 9
08/03/2021 13:13:56: [G_Auto 1] : Store Value for Alex Molcan: 1stServeIn% = 70
08/03/2021 13:13:56: [G_Auto 1] : Store Value for Alex Molcan: 1stServePoints% = 88
08/03/2021 13:13:56: [G_Auto 1] : Store Value for Alex Molcan: 2ndServePoints% = 86
08/03/2021 13:13:56: [G_Auto 1] : Store Value for Alex Molcan: OppPointsCount = 3
08/03/2021 13:13:56: [G_Auto 1] : Store Value for Alex Molcan: BPAgainstCount = 0
08/03/2021 13:13:56: [G_Auto 1] : Store Value for Alex Molcan: ServeBrokenNo = 0
08/03/2021 13:13:56: [G_Auto 1] : Store Value for market: GameCount = 9 + 1 = 10
will be even lovlier when the SV-CSV functionality is updated to allow MarketId and SelectionId to be passed in, rather than coercing and mapping variations of name etc..!! :mrgreen:

viewtopic.php?f=20&t=23204
petermikael
Posts: 4
Joined: Fri Jun 19, 2020 9:40 am

sniffer66 wrote:
Mon Mar 08, 2021 8:39 am
petermikael wrote:
Sun Mar 07, 2021 11:21 am
Trying to download scores but no score.csv is to find on my computer. This feature is great so help is much appreciated. I have let the script run for several minutes before i terminated the process. I go to tools->Go and the console looks like this >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Program Files (x86)\AutoIt3\Examples\Football.au3" The score.csv should be saved down to the same folder as Football.au3 if i understand it correct?
To be honest, I've not used this since I created it as I don't trade football on auto in BA - just thought it would be useful

I've just tested it though and ran fine for me - CSV file saves to same folder location as the script

Returned

1
* * *Central Coast Mariners* * S Score 1
* * *Macarthur FC* * S Score 0
* * *Abeldos United* * S Score 0
* * *Ab ovo* * S Score 0
* * *Bangalore Dream United FC* * S Score 0
* * *Income Tax SC* * S Score 0

Did you download the addititonal UDF's mentioned previously in the thread, and are you seeing any errors in the Scite Console ?
Did a restart on my computer and then it worked :D Thanks for the reply
Post Reply

Return to “Football trading”