free api

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

Moderator: 2020vision

free api

Postby robcpettit » Tue Apr 18, 2006 4:25 pm

Hi, this is probably not the place to ask this, but here goes. Ive been reading alot about the free api on betfair, and recently Ive started to explore visual c#. I dont want to write anything to place bets or anything along those lines. But Im intested in having ago at writing something to gather data from betfair. What I meen I just want to be able to look at betfair and choose the horse races and monitor the prices, but without the betting. Im looking more towards blackjack as there doesnt seem to be any historical data files. Trouble is betfair seems to lake clues on how to get started. Is this possible with c# and if so could somebody point in the write direction.
Regards Robert
robcpettit
 
Posts: 35
Joined: Thu Feb 23, 2006 9:22 am

Re: free api

Postby thunderfoot » Tue Apr 18, 2006 9:18 pm

robcpettit wrote:Hi, this is probably not the place to ask this, but here goes. Ive been reading alot about the free api on betfair, and recently Ive started to explore visual c#. I dont want to write anything to place bets or anything along those lines. But Im intested in having ago at writing something to gather data from betfair. What I meen I just want to be able to look at betfair and choose the horse races and monitor the prices, but without the betting. Im looking more towards blackjack as there doesnt seem to be any historical data files. Trouble is betfair seems to lake clues on how to get started. Is this possible with c# and if so could somebody point in the write direction.
Regards Robert


Can't answer your question specifically, but when I read about the Free API, I thought it said there were a certain number of restrictions, like how many times you could ask a certain command?
User avatar
thunderfoot
 
Posts: 270
Joined: Sat Nov 19, 2005 2:52 pm
Location: West Country

Postby GeorgeUK » Tue Apr 18, 2006 10:16 pm

Just curious, but is the plackjack and exchange poker on the API?

There were a few threads asking about it on the betair forum when the poker first came out, but never found out.
Don't know anything about programming, but maybe you should make sure of this first.

There are definately restrictions on the free API as thunderfoot says - makes it cumbersome for those betting inrunning, which i think was on purpose. A screenscraper/crawler might be doable though. (Sorry, can't comment on the language)
previously known as Gaseous (on the betfair forum)
User avatar
GeorgeUK
 
Posts: 315
Joined: Sat Nov 19, 2005 10:18 pm
Location: Scotland

Postby robcpettit » Tue Apr 18, 2006 10:22 pm

Hi, thanks for your replys. On further checking, it turns out that blackjack/poker is not open to free api. Ive downloaded a sample excel workbook thats using free api, which looks good. There is restrictions to api, but as im not wanting to place any bets, view my account etc, this maybe ok. Although its a bit vague on price refreshing. Its either every 6 secs uncompressed prices or every 1 sec compressed. Havent worked out the difference yet. Also the excel sheets a bit advanced for me, but its a challange. Doesnt auto refresh. Screenscraper sounds interesting Ill google and have ago.
Regards Robert
robcpettit
 
Posts: 35
Joined: Thu Feb 23, 2006 9:22 am

Postby Captain Sensible » Tue Apr 18, 2006 11:27 pm

If you're not looking to place bets at the moment I'd suggest screen scraping is the way forward. The betfair blackjack markets are in xml format so should be easy to scrape and parse with any programming language.

Market info odds etc is under this url

http://www.betfairgames.com/betting/Loa ... ue&bd=true

The gsi number appears to be revelant to the game stream, I imagine 1444077 is for blackjack. 1444074 is for the poker streams.

i.e.

http://www.betfairgames.com/betting/Loa ... ue&bd=true

The cards are numbered 0-51 - Clubs 0-12 Diamonds 13-25 Hearts 26-38 Spades 39-51

Just google for xml and C# and you should find enough sample code to get you started. Far too many bots betting on there already though so I doubt it'd be worth your while writing another one.


If you're just looking to scrape past results just use

http://www.betfairgames.com/gamex/LoadG ... pe=1444073

and set your code to scrape results through all the 2522812 eventID's
User avatar
Captain Sensible
 
Posts: 2883
Joined: Sat Nov 19, 2005 2:29 pm

Postby robcpettit » Thu May 04, 2006 7:20 pm

Sorry captain sensible, I over looked your reply. Thanks for the information. Very usefull. Is horse racing in xml as well.
Regards Robert
robcpettit
 
Posts: 35
Joined: Thu Feb 23, 2006 9:22 am

Postby Captain Sensible » Thu May 04, 2006 10:59 pm

Not at the moment but only a matter of time I reckon.

Current info is stored in the following url where mi is the market info number

http://www.betfair.com/betting/LoadMark ... mi=4772641

Clicking the link wont show much but view source and you'll see the data is in the form below so it's easy enough to scrape



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Betfair - online sports betting exchange, bet on football & horse racing fixed odds</title>
<script language="Javascript">
var p = parent.parent.main;
p.interface_compareVersions("V6.1.0-17");
var oM = p.m_M(4772641,'Next General Election - Overall Majority','For further information please see <a href=http://content.betfair.com/aboutus/content.asp?sWhichKey=Rules%20and%20Regulations#undefined.do style=color:0163ad; text-decoration: underline; target=_blank>Rules & Regs</a>.<br><br>Which party will gain an overall majority at the next UK General Election? This market will be turned in play at the start of voting on the day of the Election. Thereafter the market will not be actively managed. Any Other Party Majority covers a party other than Labour or Conservatives gaining an overall majority. Users should be aware they are NOT allowed to bet on this event if they are physically present in Austria or Germany.','GBP&nbsp;12,868',2378961,1115741628000,'16:13','Odds',false,false,1,2725553,0,'Standard',null,0.0,5.0,true,60.0,null,null,null,null,null,false);
p.m_R(7688585,1405187,4772641,'Labour Majority',0,false,3.2,12.0,3.3,165.0,3.4,55.0,3.5,15.0,3.55,4.0,3.65,100.0,oM);
p.m_R(7688586,1405188,4772641,'Conservative Majority',1,false,3.7,15.0,3.75,29.0,3.8,2.0,3.9,190.0,3.95,50.0,4.0,129.0,oM);
p.m_R(7688587,1405189,4772641,'Any Other Party Majority',2,false,55.0,6.0,60.0,15.0,65.0,10.0,100.0,3.0,110.0,10.0,120.0,2.0,oM);
p.m_R(7688588,1076592,4772641,'No Overall Majority',3,false,2.08,20.0,2.12,14.0,2.14,10.0,2.24,50.0,2.26,10.0,2.28,50.0,oM);
var oCPLs = new p.m_CMLC();
p.interface_setCouponParentLinks(oCPLs);
p.interface_setMarket(oM);

</script>
</head>
<body>
</body>
</html>
User avatar
Captain Sensible
 
Posts: 2883
Joined: Sat Nov 19, 2005 2:29 pm

Postby robcpettit » Thu May 04, 2006 11:24 pm

Thankyou for your reply. Very usefull. Keep me entertained for a while.
Regards Robert
robcpettit
 
Posts: 35
Joined: Thu Feb 23, 2006 9:22 am

Postby robcpettit » Thu May 11, 2006 1:43 pm

Hi, Ive been working in csharp, with screen scraping in mind. And I dont seem to be getting anywhere. I trying the games history firs to see if I can get all the data. Ive got as far as creating a streem reader. But the problem is the results dont seem to be in the html but as text. Ive googled loads. Any ideas on som good reading material.
Regards Robert
robcpettit
 
Posts: 35
Joined: Thu Feb 23, 2006 9:22 am

Postby Captain Sensible » Thu May 11, 2006 7:19 pm

rob, the data is compiled to a html screen using javascript which is downloaded. I've no idea what you want to do with the data but the won/ lost can easily be obtained just by scraping the section within the html as below

playersHands[0] = new Array();
playersHands[0][0] = 14
playersHands[0][1] = 17
playersHands[1] = new Array();
playersHands[1][0] = 13
playersHands[1][1] = 3
playersHands[2] = new Array();
playersHands[2][0] = 35
playersHands[2][1] = 47
playersHands[3] = new Array();
playersHands[3][0] = 43
playersHands[3][1] = 48
communityCards[0] = 12
communityCards[1] = 30
communityCards[2] = 16
communityCards[3] = 51
communityCards[4] = 42
handNames[0] = 'Two Pairs, King and Five, Four High';
handStatus[0] = 'L';
handNames[1] = 'Full House, Four full of King';
handStatus[1] = 'W';
handNames[2] = 'Two Pairs, King and Four, Ten High';
handStatus[2] = 'L';
handNames[3] = 'Two Pairs, King and Five, Ten High';
handStatus[3] = 'L';


Just use

http://www.betfairgames.com/gamex/LoadG ... Id=2542487

and alter the eventId number to get the different games
User avatar
Captain Sensible
 
Posts: 2883
Joined: Sat Nov 19, 2005 2:29 pm

Postby robcpettit » Thu May 11, 2006 10:06 pm

Thanks for your reply. Im getting there. Ive downloaded the historical file from betfair, but with the blackjack data in particular, they do not contain dealer results. Strange.
Regards Robert
robcpettit
 
Posts: 35
Joined: Thu Feb 23, 2006 9:22 am

Postby Captain Sensible » Sun May 14, 2006 1:12 pm

The dealer is listed as the community cards


playersHands[0] = new Array();
playersHands[0][0] = 25
playersHands[0][1] = 17
playersHands[0][2] = 39
playersHands[0][3] = 21
playersHands[1] = new Array();
playersHands[1][0] = 39
playersHands[1][1] = 13
playersHands[1][2] = 0
playersHands[1][3] = 26
playersHands[1][4] = 47
playersHands[2] = new Array();
playersHands[2][0] = 49
playersHands[2][1] = 29
playersHands[2][2] = 42
playersHands[3] = new Array();
playersHands[3][0] = 6
playersHands[3][1] = 20
playersHands[3][2] = 16
communityCards[0] = 38
communityCards[1] = 4
communityCards[2] = 17
communityCards[3] = null
communityCards[4] = null
handNames[0] = '25 Points - Bust';
handStatus[0] = 'L';
handNames[1] = '13 Points - 5 Card Charlie';
handStatus[1] = 'W';
handNames[2] = '18 Points';
handStatus[2] = 'L';
handNames[3] = '19 Points';
handStatus[3] = 'L';

If all hands lost the dealer won
User avatar
Captain Sensible
 
Posts: 2883
Joined: Sat Nov 19, 2005 2:29 pm

Postby robcpettit » Sun May 14, 2006 6:58 pm

Thankyou for that. When I view the page as view source in firefox, I can see this layout as youve posted it. Is there a way of grabbing just that bit. I can get the html ok. And im working on grabbing the bits I want. I seem to be getting my streem from the end of all the ifs, so getting card layouts etc.
Regards Robert
robcpettit
 
Posts: 35
Joined: Thu Feb 23, 2006 9:22 am

Postby Captain Sensible » Sun May 14, 2006 9:38 pm

All depends what language you're programming in I guess php would be something like sticking the code below in some loop and passing the values for the eventId's you want to snatch. just have $ei being passed each time as $ei=$ei+1 at the start of the loop



$url = "http://www.betfairgames.com/gamex/LoadGamexHistoryAction.do?gsi=1444077&eventId=$ei";
$fd=file_get_contents($url);
$start= strpos($fd, "communityCards[0]");
$finish= strpos($fd, "function showGame()");
$length= $finish-$start;
$code=Substr($fd, $start, $length);

Then the contents are stored in $code so you can add to a database file or whatever else you wish to do with the info

Just lookup parsing for whatever language you're using - I only know a little php so won't be able to help with the syntax or commands for C#
User avatar
Captain Sensible
 
Posts: 2883
Joined: Sat Nov 19, 2005 2:29 pm

Postby robcpettit » Wed May 17, 2006 1:43 pm

Thanks for advise with this. Just let you know Ive cracked it. Turns out that when I was getiing the data and writing to console, it was showing the last part of the data only. So I couldnt see the data you listed, to grab. Anyway thanks again. Its a good way to learn c#.
Regards Robert
robcpettit
 
Posts: 35
Joined: Thu Feb 23, 2006 9:22 am


Return to Discussion

Who is online

Users browsing this forum: No registered users and 97 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.