Betfair Developers


Exchange API
Discussion about the Betfair Sports Application Programming Interface - API NG

Thread Closed
wotsisname wotsisname is offline
Senior Member
 
Default

About time, too. I suggested this over 2 years ago: http://forum.bdp.betfair.com/showthread.php?t=896. Surely I must be due some kind of suggestion fee? lol.

Apart from the obvious benefits of using JSON formatted data, I think the "universal" data is a major step forward. As I said in the above linked thread, the website returns more information per packet and includes things like form figures and jockey names, which the API doesn't. This new format will reduce Betfairs' server maintenance, significantly reduce data costs, and more importantly satisfy all customers by taking away all advantages/disadvantages between the various http platforms.

Will the new format also allow for multiple or combined responses? Say for instance we have a market id and want to read market description, runner names and prices, that is currently at least 2 API calls. Returning it in one makes a lot of sense.
__________________
http://www.bespokebots.com
AlgoTrader AlgoTrader is offline
Senior Member
 
Default

The current API has lots of legacy that makes problems to both its users and Betfair.

For example, getMarket is just 6pm, so I use getMarketProfitAndLoss to get selectionIds and selectionNames. On the other hand, I rarely use getMarketProfitAndLoss for getting balances to avoid request charges and inconsistency with MUBets, I calculate ifWins from getMUBets.

My pattern is that I use getCompleteMarketPricesCompressed, getMUBets and sometimes getMarketTradedVolumeCompressed to refresh a single market.

I use lots of "obsolete" calls to overcome throttling. For example, I use both CompletePrices and Prices to increase prices rate from 60 to 120. I use getCurrentBets to increase bets rate from 60 to 90 (two getCurrentBets replace a single getMUBets).

Many current calls are very inconvenient. In many cases, I have to store request to parse response correctly. For example getMarketTradedVolume has no marketId in response - no problem, we have request saved.

Hopefully, we can provide feedback and participate in API development
__________________
Betfair Bots Made Easy
https://github.com/AlgoTrader/betfair
AlgoTrader AlgoTrader is offline
Senior Member
 
Default

I agree with wotsisname, we have to issue too much of calls. For example getMarketProfitAndLoss is just called to get runner balances, two digits in my case, pretty calculable from getMUBets.

There are lots of tricks. getCompleteMarketPricesCompressed has no marketStatus field, but... there is calculation method. OK means ACTIVE, EVENT_SUSPENDED means SUSPENDED and EVENT_CLOSED means CLOSED. getMarketPricesCompressed on the other hand has normal marketStatus field. getCompleteMarketPricesCompressed and getMarketPricesCompressed has very different formats, I need two different handlers for the almost the same information. The same for tradedVolume

The most strange APIs are certainly placeBets/updateBets/cancelBets. placeBets require marketId for each bet, but market for all the bets should be the same. placeBets and updateBets return strange errorCode replicated for all the input betlist. updateBets even more fun! for example I placed bet lay $100@1,01. Then I can call updateBets, put oldSize=$5000 and newSize $6000, there will be another bet placed for $1000. I strongly avoid updateBets for increasing bet sizes (just placeBets), updateBets is only for canceling. I know several more tricks.

I use lots of calls to overcome throttling, lots of calls to get missing info from other calls - it makes unnecessary load to Betfair.
__________________
Betfair Bots Made Easy
https://github.com/AlgoTrader/betfair
MarkL MarkL is offline
BDP Team
 
Default

Quote:
Originally Posted by AlgoTrader View Post

My pattern is that I use getCompleteMarketPricesCompressed, getMUBets and sometimes getMarketTradedVolumeCompressed to refresh a single market.
The new API will allow you to make a request that retrieves the complete market depth, your current position (i.e., getMUBets), and the traded volume of the market in a single response, for 1 or more markets.


Quote:
Originally Posted by AlgoTrader View Post

Hopefully, we can provide feedback and participate in API development
Well, that's the point of opening this discussion up on the forum.
MarkL MarkL is offline
BDP Team
 
Default

Quote:
Originally Posted by wotsisname View Post
Will the new format also allow for multiple or combined responses? Say for instance we have a market id and want to read market description, runner names and prices, that is currently at least 2 API calls. Returning it in one makes a lot of sense.
Yes, and more. We also expect you'll be able to get your current bet position as well.
AlgoTrader AlgoTrader is offline
Senior Member
 
Default

Quote:
Originally Posted by MarkL View Post
The new API will allow you to make a request that retrieves the complete market depth, your current position (i.e., getMUBets), and the traded volume of the market in a single response, for 1 or more markets.
It really looks too fantastic to update all the markets of interest with all the data there in a single request. Well, if I ask for 20 markets with all the data bundled, won't it hurt latency? If the response is one megabyte, the response download time will kill the benefits of bundling 20 markets together.

It should be gzipped 4-8 times at least though. getAllMarkes currenlty gzipped in 10 times (lots of repeating strings), while login only 2 times.

Look forward to see anything real :-)
__________________
Betfair Bots Made Easy
https://github.com/AlgoTrader/betfair
shuba shuba is offline
Member
 
Default

I like Java and so I like XML, I like SOAP :-) And I try to defend it.
Somebody, please explain me hysteria around JSON.
What the significant difference between Betfair XML and Betfair JSON for the Betfair developer?

1. Traffic difference? But I forgot for traffic since I had turned on gZip encoding on my software.
2. More simplest parsers? I dont think so. JSON and SOAP parsers already made for any programming language/framework. You never need to write you own one. May be just for misteriuos GetCompleteMarketPricesCompressed raw string. But after implementing Betfair JSON you need to rewrite you Betfair framework. Again.
3. New features? I dont need it. I implemented all features I need by manual.

BDP! All of my software is STABLE now. I don need neither JSON nor new features. I made workarounds and fixes for all Betfair bugs. I DONT NEED to suffer from new bugs, to write new workarounds, to stick to my wall near PC new "Betfair API defects" sheet and whole night to look inside debug window.

BDP! Please keep XML/SOAP as long as possible or dont reject it at all!
__________________
Betting developers forum (russian speaking) - bettingdeveloper.org

BetOnDroid - ladder interface for Android platform.
AlgoTrader AlgoTrader is offline
Senior Member
 
Default

Quote:
Originally Posted by shuba View Post
I like Java and so I like XML, I like SOAP :-) And I try to defend it.
Somebody, please explain me hysteria around JSON.
1. JSON is much shorter
2. JSON is much simpler, no namespaces, WSDL, xsi/xds types
3. JSON is easily mapped to most languages native types without any libs
4. JSON is human eye friendly
5. JSON parse is hell of fast

Quote:
Originally Posted by shuba View Post
What the significant difference between Betfair XML and Betfair JSON for the Betfair developer?
No need for ugly SOAP libs. Less trafic (you have limist for traffic if you use VPS). Easy to implement.

Quote:
Originally Posted by shuba View Post
BDP! Please keep XML/SOAP as long as possible or dont reject it at all!
I understand you try to protect your investments in SOAP. But as soon as people switch to JSON you will be underdog. The less network traffic and parsing latency decrease (just several milliseconds, but faster) will make SOAP users in great disadvantage. There will be much less traffic because of much less invocations to server, BF people tell us we will need just 1 JSON invocation to update market.
__________________
Betfair Bots Made Easy
https://github.com/AlgoTrader/betfair
Toy Toy is offline
Junior Member
 
Default

Quote:
Originally Posted by shuba View Post
I like Java and so I like XML, I like SOAP :-) And I try to defend it.
Somebody, please explain me hysteria around JSON.
You gotta move with times, this will be a major leap forward. Plus you will have 18 months+ to migrate.
shuba shuba is offline
Member
 
Default

Quote:
Originally Posted by AlgoTrader View Post
1. JSON is much shorter
2. JSON is much simpler, no namespaces, WSDL, xsi/xds types
3. JSON is easily mapped to most languages native types without any libs
4. JSON is human eye friendly
5. JSON parse is hell of fast
t.
I think JSON shorter, faster and simpler on 10Mb server response. But not on 1-2K Bet fair response. I think JSON lib and "ugly" SOAP lib will parse 1K for identical time.

To my mind XML more human eye friendly then JSON hieroglyphs
:-)
__________________
Betting developers forum (russian speaking) - bettingdeveloper.org

BetOnDroid - ladder interface for Android platform.
Thread Closed

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump