Bug in listMarketBook?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NielskeP
    Junior Member
    • Feb 2013
    • 8

    #1

    Bug in listMarketBook?

    All,

    I think I found a bug in the listmarketbook when requesting multiple markets and one of the marketids has a trailing zero.
    I think the market is not returned at all..

    Code:
    resp = requests.post(urltouse, data=str(jsonrpc_req), headers=headers)
    print str(jsonrpc_req)
    is what I request, and as example on the current Sharapova match
    it's thus requesting 7 markets; showing the output of the print
    Code:
    {"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketBook", "params": {"marketIds": [1.114061202, 1.114061205, 1.114061206, 1.114061208, 1.114061210, 1.114061211, 1.114061212], "priceProjection":{"priceData":["EX_BEST_OFFERS"],"virtualise":true}}, "id": 1}
    when I receive the response though, I notice only 6 markets, and the market 1.114061210 is missing.
    It happens everytime there is a market with id containing trailing zero.

    Can somebody else verify same is happening?

    When I try to use the virtualizer though I get a different mix of markets returned ..
    Attached Files
    Last edited by NielskeP; 09-05-2014, 02:05 PM. Reason: added : "showing the output of the print"
  • betdynamics
    Junior Member
    • Sep 2010
    • 534

    #2
    Remove the brackets in the visualiser and see what happens.

    At the moment you have:

    Code:
    [1.114061202,1.114061205,...
    so it doesn't recognise the first market (where you have the [ character) or the last market (where you have the ] character)

    I can't verify the listMarketBook call itself at the moment, but will try when I get some time.

    Comment

    • NielskeP
      Junior Member
      • Feb 2013
      • 8

      #3
      Correct, that solves the issue in the visualizer, where it does show 7 correct markets.

      Problem must be thus in python, where I do consider what is being printed to be exactly same as what is being sent to Requests to be posted

      Comment

      • NielskeP
        Junior Member
        • Feb 2013
        • 8

        #4
        Thus my code
        Code:
        print str(jsonrpc_req)
        resp = requests.post(urltouse, data=str(jsonrpc_req), headers=headers)
        By overruling the httplib send command, I am as far as possible printing what is being put on the socket towards the API (link on how-to : stackoverflow-link)

        From this I conclude there is no issue from my side, and I conclude the post-command leaves with all the trailing zeros intact

        and my stdout shows :
        output from the print statement (line 1 of my code):
        {"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketBook", "params": {"marketIds": [1.114057410, 1.114057413, 1.114057414, 1.114057415, 1.114057416, 1.114057418, 1.114057419, 1.114057420, 1.114057421], "priceProjection":{"priceData":["EX_BEST_OFFERS"],"virtualise":true}}, "id": 1}
        output from the print added to the httplib send command when executing the python requests post command (line 2 of my code)
        POST /exchange/betting/json-rpc/v1 HTTP/1.1
        Host: api.betfair.com
        X-Authentication: <my sessionkey>
        Content-Length: 286
        Accept-Encoding: gzip, deflate, compress
        Accept: */*
        User-Agent: python-requests/2.2.1 CPython/2.7.6 Linux/3.14.1-1-ARCH
        X-Application: <my appkey>
        content-type: application/json

        {"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketBook", "params": {"marketIds": [1.114057410, 1.114057413, 1.114057414, 1.114057415, 1.114057416, 1.114057418, 1.114057419, 1.114057420, 1.114057421], "priceProjection":{"priceData":["EX_BEST_OFFERS"],"virtualise":true}}, "id": 1}
        When printing the raw response, i only see 7 markets returned instead of the 9 requested.

        Based on all above, I conclude there is something occuring when parsing the json request at betfair's api side, which however I cannot explain using the visualizer showing correct output.

        What would help if somebody else can try to reproduce the problem , not using the visualizer?

        Comment

        • Fred77
          Junior Member
          • Jan 2009
          • 37

          #5
          Code:
          market_book_req = '{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketBook", "params": {"marketIds":["' + marketId + '"],"priceProjection":{"priceData":["EX_BEST_OFFERS"]}}, "id": 1}'
          In this example from the docs you can see that the marketId has "quotes" around it. They are strings and have to be treated as strings. If you treat e.g. 1.00100 as a number then most systems would assume they could express that as 1.001

          Comment

          • NielskeP
            Junior Member
            • Feb 2013
            • 8

            #6
            Thanks!
            Code:
            {"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketBook", "params": {"marketIds": ["1.114064535", "1.114064538", "1.114064539", "1.114064540", "1.114064541", "1.114064543", "1.114064544", "1.114064545", "1.114064546"], "priceProjection":{"priceData":["EX_BEST_OFFERS"],"virtualise":true}}, "id": 1}
            solves it, now let me go search how to flag issue as solved.

            Comment

            Working...
            X