listmarketbook resulting in limited results

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lemnur.
    Junior Member
    • Jul 2016
    • 15

    #1

    listmarketbook resulting in limited results

    Hi guys,
    I am having trouble getting an incomplete response from listmarketbook
    I dont see the exchange information (availabletolay or availabletoback) info on each runner.

    my function to retrieve the info is this (in powershell) :-
    ##########################
    #Getting Runners and Prices
    ##########################
    Function get-marketbook {
    $method = "SportsAPING/v1.0/listMarketBook"
    $postdata = [ordered]@{"jsonrpc" = "2.0";
    "method" = $method
    "params" = @{"marketIds" = @($marketID);"priceProjection" = @{"PriceData" = "EX_TRADED"}}
    }


    $postdata = $postdata | ConvertTo-Json -depth 5
    $getmarketbook = invoke-webrequest -uri https://api-au.betfair.com/exchange/betting/json-rpc/v1 -Method Post -Headers @{"X-Application"="";"X-Authentication"=$sessiontoken} -ContentType "application/ json" -body $postdata
    $getmarketbook | convertfrom-json

    }

    by doing $getmarketbook.result.runners I obtain this info for each of the runner :-

    selectionId
    handicap
    status
    adjustmentfactor
    totalmatched

    (shouldnt I be getting sp and ex info on each of the runner as well?)

    thanks for your help,
  • jabe
    Senior Member
    • Dec 2014
    • 705

    #2
    Could you show us these?

    1. The JSON string you send

    2. The JSON string you receive

    3. The definition of the object you're hoping the data will end up in.

    Comment

    • lemnur.
      Junior Member
      • Jul 2016
      • 15

      #3
      Please look at this attached pdf
      Attached Files

      Comment

      • jabe
        Senior Member
        • Dec 2014
        • 705

        #4
        This is a JSON string from my current prog

        Code:
        {"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketBook", "params": {"marketIds" : ["1.125521170","1.125521187","1.125521188","1.125521197"], "priceProjection" : {"priceData": ["EX_BEST_OFFERS"] }},"id": 1}
        And this is an example of what is returned. It includes some odds.

        Code:
        {"jsonrpc":"2.0","result":[{"marketId":"1.125497318","isMarketDataDelayed":false,"status":"CLOSED","betDelay":5,"bspReconciled":false,"complete":true,"inplay":false,"numberOfWinners":1,"numberOfRunners":19,"numberOfActiveRunners":0,"totalMatched":0.0,"totalAvailable":0.0,"crossMatching":false,"runnersVoidable":false,"version":1371319903,"runners":[{"selectionId":1,"handicap":0.0,"status":"WINNER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":4,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":9,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":16,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":2,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":3,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":8,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":15,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":5,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":6,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":7,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":14,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":10,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":11,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":12,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":13,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":9063254,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":9063255,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":9063256,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}}]},{"marketId":"1.125497324","isMarketDataDelayed":false,"status":"CLOSED","betDelay":5,"bspReconciled":false,"complete":true,"inplay":false,"numberOfWinners":1,"numberOfRunners":2,"numberOfActiveRunners":0,"totalMatched":0.0,"totalAvailable":0.0,"crossMatching":false,"runnersVoidable":false,"version":1371319699,"runners":[{"selectionId":1222344,"handicap":0.0,"status":"WINNER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":1222345,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}}]},{"marketId":"1.125497309","isMarketDataDelayed":false,"status":"CLOSED","betDelay":5,"bspReconciled":false,"complete":true,"inplay":false,"numberOfWinners":1,"numberOfRunners":3,"numberOfActiveRunners":0,"totalMatched":0.0,"totalAvailable":0.0,"crossMatching":false,"runnersVoidable":false,"version":1371320103,"runners":[{"selectionId":44625,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":44823,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":58805,"handicap":0.0,"status":"WINNER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}}]},{"marketId":"1.125497319","isMarketDataDelayed":false,"status":"CLOSED","betDelay":5,"bspReconciled":false,"complete":true,"inplay":false,"numberOfWinners":1,"numberOfRunners":2,"numberOfActiveRunners":0,"totalMatched":0.0,"totalAvailable":0.0,"crossMatching":false,"runnersVoidable":false,"version":1371319729,"runners":[{"selectionId":47972,"handicap":0.0,"status":"WINNER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}},{"selectionId":47973,"handicap":0.0,"status":"LOSER","ex":{"availableToBack":[],"availableToLay":[],"tradedVolume":[]}}]}],"id":1}
        Is that any help? I defined my own classes to receive the conversions of the JSON data. I'm using VB.Net, so it's not the same code as yours.
        Last edited by jabe; 16-07-2016, 09:38 PM.

        Comment

        • lemnur.
          Junior Member
          • Jul 2016
          • 15

          #5
          Hi Jabe,
          thanks for your quick response, I see you are asking the server with 4 marketIds , (where as I tweak my germarketcatalogue to a max result of 200). Ill try now with maxresult of 4

          ##########################
          #Getting Market Catalogue
          ##################################
          Function get-marketcatalogue {
          $method = "SportsAPING/v1.0/listMarketCatalogue"
          $postdata = [ordered]@{"jsonrpc" = "2.0";
          "method" = $method
          "params" = @{"filter" = @{"eventTypeIds" = [object[]]"7";"marketTypeCodes" = [object[]]"WIN"} #event type id 7 is for horse racing event type id "4339" is for uk dogs
          "maxResults" = "200"
          "marketProjection" = @(
          "COMPETITION"
          "EVENT"
          "EVENT_TYPE"
          "RUNNER_DESCRIPTION"
          "RUNNER_METADATA"
          "MARKET_START_TIME"
          )
          "sort" = "FIRST_TO_START"
          }
          }
          $postdata = $postdata | ConvertTo-Json -depth 5
          $getcatalogue = invoke-webrequest -uri https://api.betfair.com/exchange/betting/json-rpc/v1 -Method Post -Headers @{"X-Application"="";"X-Authentication"=$sessiontoken} -ContentType "application/ json" -body $postdata
          $getcatalogue | convertfrom-json
          }

          (just a side question do you always get the exchange information? and is your bot stable? If I cant figure this out in powershell I might try a diffrent language)

          thanks again

          Comment

          • jabe
            Senior Member
            • Dec 2014
            • 705

            #6
            It's not actually a bot, though the betting part will be done automatically, but I haven't finished coding it yet. It has been stable when I've run it for any length of time, but I think the error trapping in it needs some work. I still don't quite know what to do about loss of internet connection.

            My program gets a whole load of marketCatalogues based on certain criteria, and then goes through each event to see if it those particular markets exist for it.

            I'm not sure what you mean about always getting exchange information.

            Comment

            • lemnur.
              Junior Member
              • Jul 2016
              • 15

              #7
              By exchange information I mean if you get the "availabletolay" and "availabletoback" info, to be honest in powershell its quite stable but there is no support for the info I need (just like this one).

              I still dont see why Powershell is not getting the complete runner information.
              I had a look through your code, we are doing the same thing....

              Comment

              • jabe
                Senior Member
                • Dec 2014
                • 705

                #8
                Sorry, yes, I'm getting the prices.

                I think the problem may be the EX-TRADED parameter. It looks like it asks for amounts that have already been matched; according to the PDF you posted, nothing had been matched, so there is no data to show for each runner.

                Try adding EX_AVAILABLE to the price projection parameter.

                Can I refer you to these ?

                http://forum.bdp.betfair.com/showthread.php?t=2857

                http://docs.developer.betfair.com/do...nums-PriceData

                Comment

                • lemnur.
                  Junior Member
                  • Jul 2016
                  • 15

                  #9
                  thanks for your help , still cant figure it out though.

                  about the vb net ? there is a sticky thread , are you using the code provided there?

                  Comment

                  • jptrader
                    Junior Member
                    • Nov 2009
                    • 82

                    #10
                    To get the prices you should include EX_BEST_OFFERS or EX_ALL_OFFERS in the request. EX_TRADED is for 'Amount traded on the exchange'.

                    Comment

                    • jabe
                      Senior Member
                      • Dec 2014
                      • 705

                      #11
                      Originally posted by lemnur. View Post
                      thanks for your help , still cant figure it out though.

                      about the vb net ? there is a sticky thread , are you using the code provided there?
                      I believe EX-TRADED just asks for the amounts that have been matched, i.e: traded, so far. The market you enquired about hadn't had anything matched yet, so nothing showed up.

                      I borrowed a log-in routine from somewhere, and a general routine for adding the API method and parameters to a post string, and then sending/receiving it. Other than that, I've coded it myself.

                      Comment

                      • lemnur.
                        Junior Member
                        • Jul 2016
                        • 15

                        #12
                        HI, for me I get the same response no matter what I use (EX_TRADED, EX_BEST_OFFERS , EX_ALL_OFFERS)

                        I have attached a pdf showing it
                        Attached Files

                        Comment

                        • jabe
                          Senior Member
                          • Dec 2014
                          • 705

                          #13
                          Any chance you get hold of the $getmarketbook string between the API call and the conversion from JSON, just to make sure it's not losing the data you want?

                          Comment

                          • lemnur.
                            Junior Member
                            • Jul 2016
                            • 15

                            #14
                            Hi , I just got on to do that this is my function :-
                            ##########################
                            #Getting Runners and Prices
                            ##########################
                            Function get-marketbook {
                            $method = "SportsAPING/v1.0/listMarketBook"
                            $postdata = [ordered]@{"jsonrpc" = "2.0";
                            "method" = $method
                            "params" = @{"marketIds" = @($marketID);"priceProjection" = @{"PriceData" = "EX_BEST_OFFERS"}}
                            }


                            $postdata = $postdata | ConvertTo-Json -depth 5
                            $postdata | Out-File c:\users\guru\kildo.txt
                            $getmarketbook = invoke-webrequest -uri https://api.betfair.com/exchange/betting/json-rpc/v1 -Method Post -Headers @{"X-Application"="";"X-Authentication"=$sessiontoken} -ContentType "application/ json" -body $postdata
                            $getmarketbook | convertfrom-json

                            }


                            and the file "kildo" yeilds this :-
                            {
                            "jsonrpc": "2.0",
                            "method": "SportsAPING/v1.0/listMarketBook",
                            "params": {
                            "priceProjection": {
                            "PriceData": "EX_BEST_OFFERS"
                            },
                            "marketIds": [
                            "1.125655315"
                            ]
                            }
                            }


                            is this what is expected?

                            Comment

                            • jabe
                              Senior Member
                              • Dec 2014
                              • 705

                              #15
                              I'm a little confused about the missing "id": 1 part, but perhaps it's not important.

                              Could you also send $getmarketbook to a file before its conversion and show us that too?

                              Cheers.

                              Comment

                              Working...
                              X