Market prices from API don't correspond prices from the web site

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Letrix
    Junior Member
    • Aug 2011
    • 10

    #1

    Market prices from API don't correspond prices from the web site

    Hello.

    I wrote function which calculates virtual bets long time ago and most of the time it works correctly but sometimes it doesn't show some prices (best prices) and some amounts.
    I tried to solve the problem, but now I'm not sure that the problem is with my program but not with Betfair API.

    I attached picture where there are response line from GetMarketPricesCompressed function, data from it in excel(for the sake of simplicity) and market on Betfair website.

    As you can see second selection doesn't have prices to Lay among real prices. There are just two selections on this market so due to
    1 / (N –∑ 1/(best to lay price of other runners))
    formula 1.34 price for the first selection should not be there.

    Some people told me about possible delays between web interface and API calls. If this is true could someone tell me about at least approximate quantity of this delay because from what I see it is at least several hours. Not so good for high frequency trading.

    I was logged in both on website and in my program.
    Attached Files
    Last edited by Letrix; 07-11-2013, 11:54 PM.
  • rendalli
    Junior Member
    • Oct 2013
    • 4

    #2
    I can confirm this and was just about to post about the same topic:

    As an example: If I take Match Odds from Phil Taylor vs. Wade on www.betfair.com it says:



    But if I'm sending the following request

    Code:
    [{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketBook", "params": {"marketIds":["1.111903771"],"priceProjection":{"priceData":["EX_BEST_OFFERS"]}}, "id": 1}]
    I'am getting:
    Code:
    "ex":{"[COLOR="Red"]availableToBack":[{"price":1.09,"size":26942.17},{"price":1.08,"size":33439.07},{"price":1.07,"size":16735.3}],[/COLOR]
    [COLOR="Red"]"availableToLay":[{"price":1.11,"size":11698.62},{"price":1.12,"size":9917.03},{"price":1.13,"size":14305.05}][/COLOR],
    "tradedVolume":[]},"status":"ACTIVE"},{"selectionId":2409762,"handicap":0.0,"lastPriceTraded":11.0,"totalMatched":2486.0,
    "ex":{"[COLOR="Red"]availableToBack":[{"price":11.0,"size":55.67},{"price":10.5,"size":330.85},{"price":10.0,"size":158.32}],
    "availableToLay":[{"price":11.5,"size":57.54}[/COLOR]],"tradedVolume":[]},"status":"ACTIVE"}],"status":"OPEN"}],"id":1}]
    Or as an image:



    So there is clearly some data missing. The market I took was not changing bettween the moment I put the request and the moment I took the screenshot.

    This is the case for pretty much any market - I only get part of the data which is annoying, esp. as some of the time the best odds are missing.

    Edit: if I do my request by API-NG-Visualizer it gets me the same thing, so the problem surely isn't in your or my code: either we should change the request somehow or API-NG doesn't responds correctly.
    Last edited by rendalli; 16-11-2013, 04:01 PM.

    Comment

    • rendalli
      Junior Member
      • Oct 2013
      • 4

      #3
      OK, I guess I found the answer myself:

      It has to do with cross-matching. The following text ist taken from http://bdp.betfair.com/index.php?opt...9&limitstart=9

      Why are the prices displayed on the website different from what I see in my API application?

      "The Betfair Sports Exchange tries to match bets against the bets placed by other users as well as equivalent bets where possible. These "virtual" bets follow the rules for cross-matching posted in the Betfair.com Forum. For example, if a customer backs Player A in a tennis match at odds of 2.0, the exchange matches any lay bet at odds of 2.0 or better on Player A. In addition, the exchange also calculates all possible matches that are equivalent to a lay bet on Player A. So, if a customer backs Player B at odds of 2.0 or better, the exchange matches it with the back bet on Player A.

      The Betfair website calculates the possible virtual bets that the Betfair Sports Exchange creates and displays those bets as if they were placed by other customers normally. In other words, bets displayed on the Betfair website may be actual bets placed by customers, or virtual bets that the website knows the Betfair Sports Exchange will match due to the cross-matching rules.

      At the present time, the API returns only actual bets in the getMarketPrices, getMarketPricesCompressed and getCompleteMarketPricesCompressed services. The API does not include the virtual bets that the Betfair Sports Exchange creates for cross-matching.

      NOTE: It is important to understand that bets placed through the API are matched in the exact same way as bets placed on the website. In other words, a bet placed through the API is matched with either direct opposite bets or with the virtual bet, if available.

      Therefore, you may see prices displayed on the Betfair website that are not returned by the API, however the Betfair Sports Exchange still matches any bets placed against all bets and the equivalent cross-matched bets."

      Comment

      • betdynamics
        Junior Member
        • Sep 2010
        • 534

        #4
        In the API-NG you can choose to have the virtual prices returned from the listMarketBook call.

        Check out the "virtualise" parameter as part of PriceProjection

        Comment

        Working...
        X