data market without delay

Discuss anything related to using the program (eg. triggered betting tactics)

Moderator: 2020vision

data market without delay

Postby motorhead » Sat May 20, 2006 7:22 pm

is it possible by an API acces and VBA or other linguages to have ALL this data




Image

in an excel sheet IN REAL TIME , without delay :?:

this really will help me , I think is possible but don't know exatly how to progam an acces to the betfair server and download this info.

captain help required :D
motorhead
 
Posts: 39
Joined: Tue Mar 07, 2006 8:56 pm

Re: data market without delay

Postby Dedes » Sat May 20, 2006 8:31 pm

motorhead wrote:is it possible by an API acces and VBA or other linguages to have ALL this data




Image

in an excel sheet IN REAL TIME , without delay :?:

this really will help me , I think is possible but don't know exatly how to progam an acces to the betfair server and download this info.

captain help required :D


I would like something like that too. I would like to know not only the amount that is available for each odd but the number of orders too. Like the Stock Market.
Dedes
 
Posts: 77
Joined: Thu Dec 22, 2005 4:12 am

Postby Captain Sensible » Sun May 21, 2006 12:52 pm

You could grab the data using am excel web query - not sure if the excel refresh would be quick enough for you but someone on here would be able to code a bit of vb to make it refresh quicker

The url is simple to get just click on the selection you need to look at market info for and pressing F11 will show the url like below

http://www.betfair.com/betting/LoadRunn ... rrency=GBP

Then paste the url into the excel webquery and select the table you want to monitor
User avatar
Captain Sensible
 
Posts: 2883
Joined: Sat Nov 19, 2005 2:29 pm

Postby motorhead » Sun May 21, 2006 7:06 pm

thanks Captain , it works :) . Now how can I select another horse and others races/markets from the excel format without copy-paste the link evry time (let's say something like the BA menù or more simply ) :?:

about the refresh, do you think is possible to have the data without any delay from betfair :?: how can I program the routine? even a 0.5-1 sec. refresh will be great



cheers
motorhead
 
Posts: 39
Joined: Tue Mar 07, 2006 8:56 pm

Postby Captain Sensible » Sun May 21, 2006 10:47 pm

To get the info into excel you need the marketId and the selectionId sadly that info isn't being brought over by betair trader so theres no easy options to get it into excel.

I'm sure the API can do it but that'll cost as I doubt the free version refreshes quick enough. Setting up scripts in most languages shouldn't be too hrd as it only a point of passing the market and selection id's to the url.

http://www.betfair.com/betting/LoadRunn ... Id=1481691

I've used the free excel sample on the bdp site and that pulls the menu in so everything is available to excl but afraid I would have a clue how to set that up.
User avatar
Captain Sensible
 
Posts: 2883
Joined: Sat Nov 19, 2005 2:29 pm

Postby PeteB » Tue May 23, 2006 4:21 pm

Hi,

I'm new on here - have been using Gary's excellent software with good results for a while, and playing with the Bladder too - thank you all for sharing the fruits of your labours - hopefully I can contribute something too :-)

I have been working on exactly the same thing - up to date full market data - just having access to the 3 best prices isn't enough - want to see how the money in the market actually moves - when does new money come in, when is money withdrawn, and when is it matched.

It's easy to get the contents of that screen by screen scraping, but everything on that screen is delayed, except for the total matched on the market which is up to date. I couldn't find any means of getting that data up to date via screen scraping. (It's also important to note if using those graphs that the x-axis doesn't represent time, instead you add one tick to the x-axis each time the price moves - so the graphs can be deceptive as well as out of date)

I've got my first API program running now - took me about a week spending the odd evening on it - it's not too bad to get to grips with. I don't have anything yet that I'm willing to share - but I will see how things shape up.
Basically I started with the service41 spreadsheet, added some XML handling classes that weren't already there (MarketAvailableDepth & AvailabilityInfo, MarketTradedVolume & VolumeInfo).
Then call the following API functions:
getMarketPricesCompressed - can get the 3 best back and lay prices
getDetailAvailableMarketDepth - gets the full back and lay money available in the market
getMarketTradedVolume - gets the money matched so far at each odds

All this data is fully up to date - the available market depth numbers always match the best 3 prices to the penny.
There are a few other points - e.g. the 3 best prices don't show you odds available if the money is less than £2 - but the available market depth does, so you get a more accurate picture than you can get by screen scraping.

getMarketPricesCompressed and getMarketTradedVolume are throttled to 60 calls a minute - this is enough to trade one selection in one market. If you want to trade more than one selection at once you would need the Personal API (no change to your program required - just have to pay the £200!)
getDetailMarketAvailableDepth does not appear to be throttled - I have hammered it as fast as I can and don't hit a limit - so it should be possible to monitor multiple selections at once, though of course you don't have the full picture without the traded volume. I suspect the lack of throttling is an omission, and may be added if they notice a lot of traffic on this function....

Mostly the Free API looks great - it has everything you could need for trading on a single selection. The only difficulty I can see over what we already have in screen-scrpaing is that it enforces a minimum bet of £2 - I think this is a real pain, especially for testing a new system. For this reason I am still using Excel and Gary's system to place bets.
The one thing I would add to Gary's sytem is the ability to see your matched and unmatched bets in Excel - that would make a lot of the Bladder functionality easier too. This is pretty easy via the Free API too - so at the mo I am working on using API to read markets and bets, and screen scraping to place bets.

Anyway enough for now...

Cheers,

Pete.
PeteB
 
Posts: 258
Joined: Tue May 23, 2006 12:13 pm

Postby Mitch » Tue May 23, 2006 4:47 pm

Very interesting post Pete.

I'd like to be able to do a similar type of thing to what you are working on, can you suggest an internet resource or what to search for in google so that I can learn how to do it?

I have absolutely no idea about getting API info, or how to screen scrape or anything like that.

I've managed to teach myself enough vba to get Excel to do what I want it to do so I think I can pick new things up fairly quickly.

Any help or advice would be appreciated.

Mitch
User avatar
Mitch
 
Posts: 365
Joined: Sat Nov 19, 2005 12:28 am
Location: Leicester

Postby Captain Sensible » Tue May 23, 2006 5:48 pm

Mitch I doubt you'd have too many problems as the excel example is basically running from VB - Have a look at the free excel spreadsheet on the dbp site


Sample Spreadsheet Application
VB/ Excel application demonstrating most services. Note: You will require the soapsdk.exe that can be found under >API4.1 Sample Code>General Tools & Utilities Updated 11/4/2006
you'll also need to instal the soap component



just use product code 82 the free api one and your own username and pssword.

I sugested to alehouse to adapt his bladder prog to use it as it'd be quicker than the info coming in and out of garys prog and the added features of the api should make up for the limits on canclling placing bets


http://bdpsupport.betfair.com/ics/suppo ... k=download
User avatar
Captain Sensible
 
Posts: 2883
Joined: Sat Nov 19, 2005 2:29 pm

Postby Mitch » Tue May 23, 2006 8:16 pm

Thanks capt, I'll take a look.
User avatar
Mitch
 
Posts: 365
Joined: Sat Nov 19, 2005 12:28 am
Location: Leicester

Postby PeteB » Wed May 24, 2006 8:47 am

Mitch,

A few more starting points:

Screen scraping:
wikipedia has a neat definition, with a lot of links to useful resources
http://en.wikipedia.org/wiki/Screen_scraping
Basically you are using a program to interact with web-pages that were designed to be used by humans.
Easiest way to get started is to install iewatch or httpwatch, follow the instructions to start logging, and then use the normal betfair website to look at a market and place and cancel a bet. The iewatch (or httpwatch) log will show you all the requests your browser made, and what data came back. You can then copy this in a program. This is what Gary's program does.

The problem with this approach is that the website may change, and then you have to fix your program (as Gary had to do on Monday). Also if you hammer the website in a way that would not be possible for a human, they have a right to be upset about it.

Betfair API:
(http://en.wikipedia.org/wiki/Applicatio ... _interface)
The API is designed to be used by programs, and so is insulated from change, and they aim to support the amount of traffic that results from programs using it.

http://bdpsupport.betfair.com has everything you need.

The Developers Guide document is straightforward, and shows that the API is well thought out.

The WebService Studio 2.0 is very useful. Paste in the wsdl address from the developers guide (without the final 's' - they have a typo), and browse the functions.
Call the login function first, with your username and password, and 82 for the product (for the Free API).
If this is successful you will see a response section containing an 'OK' status, and a session token. For each subsequent function request, you need to take the session token from the previous response and put in in the Header of the new request.
This will be enough to play with each of the functions, and see what kind of data comes back.

Then you need some code as a starting point.
The Sample Spreadsheet Application is ok in this respect, but there is about 20 times as much code in it as is really needed to do the jobs it does, and quite a few bugs.
I started by printing out all the code and writing notes on it - only do this if you have an entire pack of paper going spare!

A few comments to save you time:
There are two files of constants:
modAPI has constants needed to interact with the betfair API and the XML it returns
modControl has constants for all the named ranges in the spreadsheet, and controls how data is mapped from code to sheet
ThisWorkbook handles the interaction between code and sheet - this is generally neat (using named ranges) but with a few bugs
clsControl has the 'business logic' - most of what the application actually does is in here
ServiceProxy has all the code for interacting with the Betfair API - the bits that are there are generally ok and reusable

All the other classes are XML handler classes, and have a huge amount of duplicated code (they could have used inheritance!) - the easiest way to get to know these is to use a difference tool like WinDiff to see the differences between them. RunnerPnl is probably the simplest, if you start with that, and compare RunnerPrices, you will see what is going on.

Anyway work your way through it - it will quickly make sense :-)

One more starting point:
http://en.wikipedia.org/wiki/Algorithmic_trading - hours and hours of usefulreading from here
PeteB
 
Posts: 258
Joined: Tue May 23, 2006 12:13 pm

Postby PeteB » Wed May 24, 2006 8:52 am

Incidentally discovered a problem last night - while all the data is up to date, the volume traded appears to update continuously, while the best prices and available market depth update on a regular interval - say once or twice a second - this annoyingly makes it harder to tie the 3 pieces of data together :-(
PeteB
 
Posts: 258
Joined: Tue May 23, 2006 12:13 pm

Postby The Gambling Monkey » Wed May 24, 2006 10:26 am

Hi PeteB,

I echo Mitch, a very interesting post, and also I have taught myself enough VBA to get excel to do what I want.

I've had a look at all the information you posted but at the moment it is way over my head. I have also had a look at the sample spreadsheet and didn't understand a word of the code. It seems way too complicated!

Would it be possible for you to post a few lines of VBA code (and an explanation of what it does), which interacts with the API?

This would help a lot in my understanding. If not, many thanks anyway for the previous post.

Regards,
Scott
The Gambling Monkey
 
Posts: 39
Joined: Fri Nov 18, 2005 9:22 pm
Location: St. Albans

Postby Mitch » Fri May 26, 2006 8:23 pm

Thanks Pete,

Funnily enough I've been looking at the bdp site over the last couple of days and have been thinking of learning another language for a while now. Firstly for usefulness at work, but also because I'd love to make an application of my own for interacting with Betfair.
Do you code in another language, or do you use vba only?

If you use other(s), any advise on which would be best for a Betfair app (at the moment I'm thinking Java) ?
User avatar
Mitch
 
Posts: 365
Joined: Sat Nov 19, 2005 12:28 am
Location: Leicester

Postby PeteB » Sat May 27, 2006 10:45 am

Mitch,

I am wondering the same thing myself - I used to program in C years ago, and have since done some Java (but not much) and a fair bit of VB in Excel, but have really got pretty rusty.
The work I have done on the API so far is just extending the sample spreadsheet - so VB only.

For an application I am thinking C# .NET, with a MySQL database if I need to store data - for a few reasons:
- I want to learn C# .NET anyway
- Easy interaction with Excel
- I've got Visual Studio .NET on my work laptop
- C# .NET is currently more employable than java and VB .NET
VB .NET would have the same advantages - but with my C/C++ background, C# will probably be easier for me - VB .NET might be easier for you.

Java would be good too - and I think there is probably more support on the bdp forum for this - but I think it is harder to write the user interface (need to learn Swing or something similar?) and interacting with Excel would be harder.

The interaction with Excel is useful - you can follow a model I see quite often at work - put all the code for interacting with the exchange etc in application code, and put the business rules in Excel - that way you can change what your app does with a small change in Excel rather than having to re-release your application.

But I've got a lot to learn before I can do this...

Scott,

I wish it was easy to interact with the API with just a few lines of code! The sample spreadsheet is definitely way more complex than it needs to be - I will need something simpler - not least so I can be 100% confident that I know what it does! But I haven't built that yet - when it does it might be possible to share it.
It will cover choosing a market and selection, and getting best prices, market depth, and traded volume for a single selection, and placing and cancelling bets - with ladder format. It won't use the rest of the API. There will still be a fair bit of code, and will be object oriented, so an understanding of OO principles would make it easier to understand.
On the other hand, I might go straight to the C# .NET app, which would probably be harder to share.

Pete.
PeteB
 
Posts: 258
Joined: Tue May 23, 2006 12:13 pm

Postby AP » Mon May 29, 2006 11:41 pm

Pete great shout on webservice studio, I was just looking for something like this. Now all I have to do is figure out how to work with web services.
AP
 
Posts: 10
Joined: Tue Mar 07, 2006 6:13 am


Return to Discussion

Who is online

Users browsing this forum: No registered users and 105 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.