Back/Lay odds coming back the same

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pete101
    Junior Member
    • Sep 2019
    • 22

    #1

    Back/Lay odds coming back the same

    Hi guys,

    Trying to get the current football odds via the API.
    (Home win, Away win & Draw for both BACK & LAY).

    When I run the below code it returns 3 values.

    {"jsonrpc": "2.0",
    "method": "SportsAPING/v1.0/listMarketBook",
    "params": {"marketIds": ["1.172593235"],
    "priceProjection": {"priceData": ["SP_AVAILABLE"],
    "side": ["BACK"],
    "MarketBettingType": "Line",
    "virtualise": "true" }},
    "id": 1}

    LastPriceTraded: 12.0
    LastPriceTraded: 3.4
    LastPriceTraded: 5.59

    However, when I change [BACK] to [LAY] it still returns the exact same values???
    i.e. The server response string is the exact same.

    I suspect that I have made some sort of typo, but for the life of me I can't seen where.

    My limited "understanding" of the API is that the above 3 values represent the BACK home, BACK away, BACK draw.
    If I changed the [BACK] to [LAY] then I would get the LAY odds instead.

    Any guru out there who can advise where I have gone wrong?

    Many thanks,

    Pete



  • jabe
    Senior Member
    • Dec 2014
    • 705

    #2
    Recent prices traded on the market are just that. They are not dependent on your request. When prices match, someone backing matched with someone laying, perhaps several someones in each case. The only prices related to your BACK or LAY parameter are ones available - i.e: unmatched. The ones you had returned are history, but useful history. Those prices may be currently available but not necessarily.

    The prices available, and the current amounts available at each price are in arrays a little deeper down.

    The market book includes this (my class items, written in VB):

    Code:
    Public runners() As ClassRunner     ' Information about the runners (selections) in the market.
    The runner class includes this:

    Code:
    Public ex As ClassExchangePrices        ' The Exchange prices available for this runner
    ExchangePrices is this

    Code:
    Public Class ClassExchangePrices
       Public availableToBack() As ClassPriceSize
       Public availableToLay() As ClassPriceSize
       Public tradedVolume() As ClassPriceSize
    End Class
    and PriceSize is this

    Code:
    Public Class ClassPriceSize
       Public price As Double
       Public size As Double
    End Class
    So the current prices you seek are in arrays

    marketBook.runners.ex.availableToBack().price
    marketBook.runners.ex.availableToBack().size

    marketBook.runners.ex.availableToLay().price
    marketBook.runners.ex.availableToLay().size


    Hope that helps.
    Last edited by jabe; 31-08-2020, 04:51 PM.

    Comment

    • Pete101
      Junior Member
      • Sep 2019
      • 22

      #3
      Hi Jabe,

      Many thanks for the response. It is much appreciated. :-)

      I don't actually use VB, but your answer has given me some food for thought.

      Basically, I am trying to get as close to obtaining the current back/lay odds as possible, although I fully appreciate that they do flucuate.

      Comment

      • LiamP
        Junior Member
        • Oct 2015
        • 284

        #4
        What are you expecting here? Side isn’t a valid variable to that endpoint and last price traded is last price traded:

        https://docs.developer.betfair.com/d...listMarketBook

        Comment

        Working...
        X