Programming/Coding on Betfair

LinusP
Posts: 1871
Joined: Mon Jul 02, 2012 10:45 pm

PeterLe wrote:
Thu Nov 28, 2019 4:36 pm
Just though id post an update in case anyone is thinking of having a go at this in the future..
I decided to pause the Udemy Course and jump straight into the API, the reason was as the course is so long, I was forgetting the stuff I had learned at the beginning! My thought process was that if you were learning Excel for instance, you wouldn't try and learn each command, you'd just start to create a spreadsheet and learn what you need as you go along (not sure if that is a good thing, but we'll see)
First off, as a very inexperienced programmer, Ive found Python easier than C# (Within the context of connecting to the Betfair API)
Mainly due to the code shared by Liam (BetfairLightweighWrapper). The code is well commented so you can see what the various lines of code do.
However, the best way of describing the information available to you, it is like a mixed up jigsaw. All the pieces are there in github, but you have to work out what pieces you need, if you need to modify those pieces (ie certificates, Keys) and then how you assemble in the right order.
After a couple of hours and quite a few failures), I've managed to login to the API and extract the data for a race tonight, cant help but feel like a major triumph! I think the syndicates and teams out there wont be quaking in their boot just yet :D
Overall, really enjoying the new learning and hopefully I will look back at this post in a couple of years and realise how green I was!
Regards
Peter
Edit: By the way, I decided to drop SublimeText in favour of Pycharm
You can't beat the excitement of getting something to work with Betfair for the first time, it can be so satisfying working with API's and piecing everything together :)

Great to see so many of you starting out and joining the slack group!
CallumPerry
Posts: 575
Joined: Wed Apr 19, 2017 5:12 pm
Location: Wolverhampton

Could be posted here or Black Friday thread, today only.

https://www.amazon.co.uk/Coding-Beginne ... Q05KMEMTHB
spreadbetting
Posts: 3140
Joined: Sun Jan 31, 2010 8:06 pm

Nero Tulip wrote:
Fri Nov 29, 2019 11:09 am
Right, that's it. I'm joining in. I've wanted to learn this for myself for a long time. I'm also on Liam's slack, but for now, I'm going to tentatively step into the udemy course (now £9.99 !!). I think learning the syntax of the code could be the easier (still hard) part of the job for me, but what I don't yet understand at all currently is piecing together the infrastructure.. pycharm, git and so on, feels like I need someone to hold my hand while I begin to learn to walk, after that it'll be tough but more enjoyable getting involved in the code.

Any support or pointers along the way greatly appreciated, I'll probably need it !
The course covers the infrastructure side also so no need to worry about that, it's no more than installing python and a text editor that highlights syntax and errors.

If you've never coded before the syntax shouldn't be too hard to grasp, Python seems a lot better structured than the languages I've tinkered with in the past so knowing zilch could be a bonus as I'm having to forget syntax I know as they conflict somewhat or have different names.
PeterLe
Posts: 3715
Joined: Wed Apr 15, 2009 3:19 pm

...Just to add...
When you install Python, the BetfairLightweight wrapper is only certified up to and incl 3.7
Regards
Peter
spreadbetting
Posts: 3140
Joined: Sun Jan 31, 2010 8:06 pm

PeterLe wrote:
Fri Nov 29, 2019 2:03 pm
...Just to add...
When you install Python, the BetfairLightweight wrapper is only certified up to and incl 3.7
Regards
Peter
Current python is 3.8, what do you mean by certified,Peter? That it's only been tested on up to 3.7 or it'll only run on 3.7 and below? Can't imagine anything drastic would have been introduced between 3.7 to date.
LinusP
Posts: 1871
Joined: Mon Jul 02, 2012 10:45 pm

spreadbetting wrote:
Fri Nov 29, 2019 2:24 pm
PeterLe wrote:
Fri Nov 29, 2019 2:03 pm
...Just to add...
When you install Python, the BetfairLightweight wrapper is only certified up to and incl 3.7
Regards
Peter
Current python is 3.8, what do you mean by certified,Peter? That it's only been tested on up to 3.7 or it'll only run on 3.7 and below? Can't imagine anything drastic would have been introduced between 3.7 to date.
Currently only tested up to 3.7, 3.8 should be fine but I haven't tested yet (working on v2.0)

https://travis-ci.org/liampauling/betfair
https://travis-ci.org/liampauling/betfa ... /600776505
PeterLe
Posts: 3715
Joined: Wed Apr 15, 2009 3:19 pm

Sorry SB, I intended to say Tested rather than certified; Thanks for clarifying Liam
spreadbetting
Posts: 3140
Joined: Sun Jan 31, 2010 8:06 pm

Thanks.
spreadbetting
Posts: 3140
Joined: Sun Jan 31, 2010 8:06 pm

Haven't had much time, or more likely inclination, to get much further with the python course, about 45% done. But I have just written a script to log into the interactive API and get a session key returned :o

Now able to pull down the markets, just have to figure out how to order the json data within python now into some kind of order I can visualise it as I'm so used to std class multidimensional arrays from php
PeterLe
Posts: 3715
Joined: Wed Apr 15, 2009 3:19 pm

Nice one! You're further ahead than me; just maxed with my day job 12 hour days at the mo...will be clear by end of jan...
Have you joined the Slack group? There's lot of people willing to help on there if you get stuck..
Im making progress in the right direction; The problem I have is one of frustration, I have some very good ideas and cant implement them (yet!) but Ill get there.

Also, Ive just posted in the good book thread..about the book "the man who solved the markets" I thought of you, xitan and Liam to name a few who would really enjoy this book...
Regards
Peter
spreadbetting
Posts: 3140
Joined: Sun Jan 31, 2010 8:06 pm

Yep finding time is probably the hardest thing, I thought I'd have a tinker as racing finished early and no night stuff.

Slowly figuring out the structures but dictionaires within lists within dictionaries etc and when you try and look online most examples are for python 2 so it's a right pain in the ass.
PeterLe
Posts: 3715
Joined: Wed Apr 15, 2009 3:19 pm

Evening
Im just looking for the best source to scrape the following day greyhounds and horse racing runners.
Ill use Python, but wondered if some sites are easier than others to do this from ?
Any help appreciated
Thanks in advance,
Regards
Peter
dragonzed
Posts: 1
Joined: Tue Mar 17, 2020 9:36 pm

I keep seeing this thing about £299 for an API key but I have a "live" key yet I've never had to give Betfair any money. I signed up for my key years ago, before NG, I think even then there was some tiered pricing but the delayed pricing was sufficient for what I was doing.

Have I somehow got lucky in getting this key for free?
User avatar
johnsheppard
Posts: 283
Joined: Mon Feb 04, 2019 6:00 am
Location: Cairns Australia

dragonzed wrote:
Tue Mar 17, 2020 9:53 pm
I keep seeing this thing about £299 for an API key but I have a "live" key yet I've never had to give Betfair any money. I signed up for my key years ago, before NG, I think even then there was some tiered pricing but the delayed pricing was sufficient for what I was doing.

Have I somehow got lucky in getting this key for free?
I think so. They used to do it for free. Way back, but someone that's been around longer than I might confirm.

As an aside, if anyone is serious about doing any coding...$300 is a pittance compared with the labour/opportunity cost of doing any real coding that might return a profit... you should probably not be too concerned about that price tag (well other than ignorance/noobiness and resulting lofty expectation)... you're gonna be sinking months/years/decades into coding... pay for the things that make you more efficient is smarter...

I would guess Betfair started charging for api keys to reduce support costs....
User avatar
ShaunWhite
Posts: 9731
Joined: Sat Sep 03, 2016 3:42 am

+1 John.
£299 for lifetime access is the bargain of the century. And I agree it's chicken feed compared to the bottom line cost in terms of time.
Post Reply

Return to “Betfair Exchange API”