For example, when a listMarketBook call is made, it returns a JSON string:
Code:
Public odds As New ClassListMarketBookResult
Dim jss As New JavaScriptSerializer() 'JSON (de)serialiser
' inrec is the JSON string returned from Betfair:
odds = jss.Deserialize(Of ClassListMarketBookResult)(inrec)
ClassListMarketBookResult looks like this:
Public Class ClassListMarketBookResult
Public jsonrpc As String
Public result() As ClassMarketBook
End Class
I'm sure there are other equally valid ways to do this.
So, for the final part of your post, I start my program by getting a list of Events (these are particular football matches). For each, I get the MarketCatalogue data that I'm interested in. All of this is stored in a (one of many) football match object. After that, when I want to get odds, I use a list of MarketIds (a string) from the MarketCatalogue in my listMarketBook call, allowing me to get several markets at once. I don't know whether I can get multiple markets from different events in a single call.


(Y)
Leave a comment: