listmarketbook resulting in limited results

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

    #16
    Originally posted by jabe View Post
    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.
    HI yeah so this is my getmarketcatalogue code :-

    ##########################
    #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" = "100"
    "marketProjection" = @(
    "COMPETITION"
    "EVENT"
    "EVENT_TYPE"
    "RUNNER_DESCRIPTION"
    "RUNNER_METADATA"
    "MARKET_START_TIME"
    )
    "sort" = "FIRST_TO_START"
    }
    }
    $postdata = $postdata | ConvertTo-Json -depth 5
    $postdata | Out-File c:\users\guru\marketcata.txt
    $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
    }

    the file "marketcata" yeilds :-

    {
    "jsonrpc": "2.0",
    "method": "SportsAPING/v1.0/listMarketCatalogue",
    "params": {
    "filter": {
    "eventTypeIds": [
    "7"
    ],
    "marketTypeCodes": [
    "WIN"
    ]
    },
    "maxResults": "100",
    "sort": "FIRST_TO_START",
    "marketProjection": [
    "COMPETITION",
    "EVENT",
    "EVENT_TYPE",
    "RUNNER_DESCRIPTION",
    "RUNNER_METADATA",
    "MARKET_START_TIME"
    ]
    }
    }

    Comment

    • jabe
      Senior Member
      • Dec 2014
      • 705

      #17
      That's almost what I'm after - could you move the line

      $postdata | Out-File c:\users\guru\marketcata.txt

      so that it's just before the line

      $getcatalogue | convertfrom-json

      and change it so that it says

      $getcatalogue | Out-File c:\users\guru\marketcata.txt

      and try running that.

      Cheers.

      Comment

      • lemnur.
        Junior Member
        • Jul 2016
        • 15

        #18
        Originally posted by jabe View Post
        That's almost what I'm after - could you move the line

        $postdata | Out-File c:\users\guru\marketcata.txt

        so that it's just before the line

        $getcatalogue | convertfrom-json

        and change it so that it says

        $getcatalogue | Out-File c:\users\guru\marketcata.txt

        and try running that.

        Cheers.
        sure here is the modified function :-

        ##########################
        #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" = "100"
        "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 | Out-File c:\users\guru\marketcata.txt
        $getcatalogue | convertfrom-json
        }

        and this yields :-



        StatusCode : 200
        StatusDescription : OK
        Content : {"jsonrpc":"2.0","result":[{"marketId":"1.125655267","marketName":"1m2f Hcap","marketStartTime":"20
        16-07-18T19:10:00.000Z","totalMatched":747845.8820389999 ,"runners":[{"selectionId":1374640,"runnerN
        am...
        RawContent : HTTP/1.1 200 OK
        Vary: Accept-Encoding, User-Agent
        Transfer-Encoding: chunked
        Cache-Control: no-cache
        Content-Type: application/json
        Date: Mon, 18 Jul 2016 19:13:02 GMT
        Server: Cougar - 4.4.2 (Co...
        Forms : {}
        Headers : {[Vary, Accept-Encoding, User-Agent], [Transfer-Encoding, chunked], [Cache-Control, no-cache],
        [Content-Type, application/json]...}
        Images : {}
        InputFields : {}
        Links : {}
        ParsedHtml : mshtml.HTMLDocumentClass
        RawContentLength : 774733

        Comment

        • jabe
          Senior Member
          • Dec 2014
          • 705

          #19
          Right, that helps. The 200 value for StatusCode means it worked (and the StatusDescription = OK is a clue too).

          The part I'm particularly interested in is the Content: part. Was there more?

          Was the race in progress when you ran your routine?

          Comment

          • lemnur.
            Junior Member
            • Jul 2016
            • 15

            #20
            Originally posted by jabe View Post
            Right, that helps. The 200 value for StatusCode means it worked (and the StatusDescription = OK is a clue too).

            The part I'm particularly interested in is the Content: part. Was there more?

            Was the race in progress when you ran your routine?


            Hi , yeah the race was in progress , it's pretty much yesterday's uk race . Do you get more ? In a few hours I can.show you what I am getting in my list market book as well.

            Comment

            • jabe
              Senior Member
              • Dec 2014
              • 705

              #21
              Originally posted by lemnur. View Post
              Hi , yeah the race was in progress , it's pretty much yesterday's uk race . Do you get more ? In a few hours I can.show you what I am getting in my list market book as well.
              Ah, right, I missed that it was the catalogue. It's the list market book data I'd like to see.

              Comment

              • lemnur.
                Junior Member
                • Jul 2016
                • 15

                #22
                StatusCode : 200
                StatusDescription : OK
                Content : {"jsonrpc":"2.0","result":[{"marketId":"1.125655272","isMarketDataDelayed":fa lse,"status":"OPEN","b
                etDelay":0,"bspReconciled":false,"complete":true," inplay":false,"numberOfWinners":1,"numberOfRunner
                s"...
                RawContent : HTTP/1.1 200 OK
                Vary: Accept-Encoding, User-Agent
                Content-Length: 2565
                Cache-Control: no-cache
                Content-Type: application/json
                Date: Mon, 18 Jul 2016 19:31:03 GMT
                Server: Cougar - 4.4.2 (Cougar 2...
                Forms : {}
                Headers : {[Vary, Accept-Encoding, User-Agent], [Content-Length, 2565], [Cache-Control, no-cache],
                [Content-Type, application/json]...}
                Images : {}
                InputFields : {}
                Links : {}
                ParsedHtml : mshtml.HTMLDocumentClass
                RawContentLength : 2565

                thats what I get

                Comment

                • jabe
                  Senior Member
                  • Dec 2014
                  • 705

                  #23
                  What language is it you're using? It looks PHP-like. I thought you'd mention scripting but couldn't find it again.

                  There should be more to the Content: part; there's the remainder of the string that begins with
                  {"jsonrpc":"2.0","result":[{"marketId

                  I feel there ought to be a way to access the Content part, but I need to look up how to do it in whatever language your code is in.

                  Ideally, I'd like to see that for a current or upcoming market.

                  Comment

                  • lemnur.
                    Junior Member
                    • Jul 2016
                    • 15

                    #24
                    Originally posted by jabe View Post
                    What language is it you're using? It looks PHP-like. I thought you'd mention scripting but couldn't find it again.

                    There should be more to the Content: part; there's the remainder of the string that begins with
                    {"jsonrpc":"2.0","result":[{"marketId

                    I feel there ought to be a way to access the Content part, but I need to look up how to do it in whatever language your code is in.

                    Ideally, I'd like to see that for a current or upcoming market.
                    HI sorry for the late reply, How can I access the content part? so you can confirm there is missing information? (that means the server is not providing me the full info , or when I convert from json I am losing information?)

                    thanks again for your help.

                    Comment

                    • jabe
                      Senior Member
                      • Dec 2014
                      • 705

                      #25
                      Originally posted by lemnur. View Post
                      HI sorry for the late reply, How can I access the content part? so you can confirm there is missing information? (that means the server is not providing me the full info , or when I convert from json I am losing information?)

                      thanks again for your help.
                      No rush here - there should be more to that string, but why it's cut short I have no idea at all. But that's where all the marketBook data should be. The 200 return code appears to indicate the the listMarketBook call was successful. The data you're saving to the file is before the conversion from JSON, so we don't yet know if that's where the lost exchange data has disappeared.

                      I'll assume it's PHP and see if I can work out how to isolate the Content: part of the returned string.

                      Comment

                      • lemnur.
                        Junior Member
                        • Jul 2016
                        • 15

                        #26
                        Originally posted by jabe View Post
                        No rush here - there should be more to that string, but why it's cut short I have no idea at all. But that's where all the marketBook data should be. The 200 return code appears to indicate the the listMarketBook call was successful. The data you're saving to the file is before the conversion from JSON, so we don't yet know if that's where the lost exchange data has disappeared.

                        I'll assume it's PHP and see if I can work out how to isolate the Content: part of the returned string.
                        I just upgraded from windows 8.1 to windows 10 (thinking an upgraded version of powershell will help ), wrong decision, now my code doesnt run , Id like to start in another language, would you recommend php?

                        Comment

                        • jabe
                          Senior Member
                          • Dec 2014
                          • 705

                          #27
                          Well, there's only 7 days left to get W10, so probably the right thing to do.

                          Surprised that PowerShell (which I have almost no experience of) is no longer working. I would have thought it could be persuaded to work. Not that I'd be much help.

                          What other language would I recommend? I really don't know. I'm using Visual Basic.Net because when I started that was the PC language I had the most experience with.

                          Perhaps your best course of action might be to consider/review the examples used in the documentation and on this forum and all the languages the examples are written in. It's a steep learning curve whichever way you do it, and I wish you luck. Perhaps Python? Maybe PHP? I really don't know.

                          Comment

                          • lemnur.
                            Junior Member
                            • Jul 2016
                            • 15

                            #28
                            Originally posted by jabe View Post
                            Well, there's only 7 days left to get W10, so probably the right thing to do.

                            Surprised that PowerShell (which I have almost no experience of) is no longer working. I would have thought it could be persuaded to work. Not that I'd be much help.

                            What other language would I recommend? I really don't know. I'm using Visual Basic.Net because when I started that was the PC language I had the most experience with.

                            Perhaps your best course of action might be to consider/review the examples used in the documentation and on this forum and all the languages the examples are written in. It's a steep learning curve whichever way you do it, and I wish you luck. Perhaps Python? Maybe PHP? I really don't know.

                            Yeah, about the listmarketbook, can you tell me what I am missing? like can you post what does your listmarketbook function looks like in json?
                            If you can show me that maybe I can ask someone about it or try to change my function.

                            (I reverted back to windows 8 and now my code works......trust microsoft for software lol)

                            Comment

                            • jabe
                              Senior Member
                              • Dec 2014
                              • 705

                              #29
                              This is an example of a listMarketBook call from my program in JSON format. You can see all the brackets balance. I'll insert a few line breaks to make it more readable.

                              I included a test page when I wrote the program, and this call was done using one of the marketIds related to a current event.

                              {"jsonrpc": "2.0",
                              "method": "SportsAPING/v1.0/listMarketBook",
                              "params": {"marketIds" : ["1.125591131"],
                              "priceProjection" : {"priceData": ["EX_BEST_OFFERS"] }},
                              "id": 1}

                              The current event is a Brazilian soccer match that starts in a few minutes - Criciuma v Parana. The market is for matched odds.

                              Thhe returned JSON string looks like; you can see that some of the runners have money available (I'm not sure why the tradedVolume parts are showing as blank):

                              {"jsonrpc":"2.0",
                              "result":
                              [
                              {"marketId":"1.125591131",
                              "isMarketDataDelayed":true,
                              "status":"OPEN",
                              "betDelay":0,
                              "bspReconciled":false,
                              "complete":true,
                              "inplay":false,
                              "numberOfWinners":1,
                              "numberOfRunners":3,
                              "numberOfActiveRunners":3,
                              "lastMatchTime":"2016-07-22T22:02:40.103Z",
                              "totalMatched":90135.82,
                              "totalAvailable":37319.46,
                              "crossMatching":true,
                              "runnersVoidable":false,
                              "version":1378061746,
                              "runners":
                              [
                              {"selectionId":356589,
                              "handicap":0.0,
                              "status":"ACTIVE",
                              "lastPriceTraded":1.99,
                              "totalMatched":0.0,
                              "ex":
                              {
                              "availableToBack":
                              [
                              {"price":1.98,"size":202.19},
                              {"price":1.97,"size":676.94},
                              {"price":1.96,"size":755.37}
                              ],
                              "availableToLay":
                              [
                              {"price":1.99,"size":12.03},
                              {"price":2.0,"size":141.71},
                              {"price":2.02,"size":872.81}],
                              "tradedVolume":
                              [
                              ]
                              }
                              },

                              {"selectionId":198129,
                              "handicap":0.0,
                              "status":"ACTIVE",
                              "lastPriceTraded":4.8,
                              "totalMatched":0.0,
                              "ex":
                              {
                              "availableToBack":
                              [
                              {"price":4.7,"size":307.39},
                              {"price":4.6,"size":321.6},
                              {"price":4.5,"size":326.36}],
                              "availableToLay":
                              [
                              {"price":4.8,"size":110.34},
                              {"price":4.9,"size":497.38},
                              {"price":5.0,"size":492.53}
                              ],
                              "tradedVolume":
                              [
                              ]
                              }
                              },

                              {"selectionId":58805,
                              "handicap":0.0,
                              "status":"ACTIVE",
                              "lastPriceTraded":3.5,
                              "totalMatched":0.0,
                              "ex":
                              {
                              "availableToBack":
                              [
                              {"price":3.45,"size":330.16},
                              {"price":3.4,"size":451.45},{"price":3.35,"size":7 06.06}
                              ],
                              "availableToLay":
                              [
                              {"price":3.5,"size":125.01},
                              {"price":3.55,"size":350.16},
                              {"price":3.6,"size":786.86}
                              ],
                              "tradedVolume":
                              [
                              ]
                              }}]
                              }
                              ]
                              }

                              For reference, the listMarketCatalogue for that market is this:

                              {"jsonrpc":"2.0",
                              "result":
                              [
                              {"marketId":"1.125591131",
                              "marketName":"Match Odds",
                              "marketStartTime":"2016-07-22T22:15:00.000Z",
                              "totalMatched":85127.51,
                              "runners":[
                              {"selectionId":356589,
                              "runnerName":"Criciuma",
                              "handicap":0.0,
                              "sortPriority":1},

                              {"selectionId":198129,
                              "runnerName":"Parana",
                              "handicap":0.0,
                              "sortPriority":2},

                              {"selectionId":58805,
                              "runnerName":"The Draw",
                              "handicap":0.0,
                              "sortPriority":3}

                              ],
                              "competition":{"id":"321319","name":"Brazilian Division 2"}
                              }
                              ]}

                              This tells us the selectionId for each of the match outcomes.

                              You might want to try copying some of the above JSON strings and pasting them into something (NotePad++ perhaps?) that will indent properly. You might need to remove the line breaks I added.

                              Comment

                              • lemnur.
                                Junior Member
                                • Jul 2016
                                • 15

                                #30
                                Originally posted by jabe View Post
                                This is an example of a listMarketBook call from my program in JSON format. You can see all the brackets balance. I'll insert a few line breaks to make it more readable.

                                I included a test page when I wrote the program, and this call was done using one of the marketIds related to a current event.

                                {"jsonrpc": "2.0",
                                "method": "SportsAPING/v1.0/listMarketBook",
                                "params": {"marketIds" : ["1.125591131"],
                                "priceProjection" : {"priceData": ["EX_BEST_OFFERS"] }},
                                "id": 1}

                                The current event is a Brazilian soccer match that starts in a few minutes - Criciuma v Parana. The market is for matched odds.

                                Thhe returned JSON string looks like; you can see that some of the runners have money available (I'm not sure why the tradedVolume parts are showing as blank):

                                {"jsonrpc":"2.0",
                                "result":
                                [
                                {"marketId":"1.125591131",
                                "isMarketDataDelayed":true,
                                "status":"OPEN",
                                "betDelay":0,
                                "bspReconciled":false,
                                "complete":true,
                                "inplay":false,
                                "numberOfWinners":1,
                                "numberOfRunners":3,
                                "numberOfActiveRunners":3,
                                "lastMatchTime":"2016-07-22T22:02:40.103Z",
                                "totalMatched":90135.82,
                                "totalAvailable":37319.46,
                                "crossMatching":true,
                                "runnersVoidable":false,
                                "version":1378061746,
                                "runners":
                                [
                                {"selectionId":356589,
                                "handicap":0.0,
                                "status":"ACTIVE",
                                "lastPriceTraded":1.99,
                                "totalMatched":0.0,
                                "ex":
                                {
                                "availableToBack":
                                [
                                {"price":1.98,"size":202.19},
                                {"price":1.97,"size":676.94},
                                {"price":1.96,"size":755.37}
                                ],
                                "availableToLay":
                                [
                                {"price":1.99,"size":12.03},
                                {"price":2.0,"size":141.71},
                                {"price":2.02,"size":872.81}],
                                "tradedVolume":
                                [
                                ]
                                }
                                },

                                {"selectionId":198129,
                                "handicap":0.0,
                                "status":"ACTIVE",
                                "lastPriceTraded":4.8,
                                "totalMatched":0.0,
                                "ex":
                                {
                                "availableToBack":
                                [
                                {"price":4.7,"size":307.39},
                                {"price":4.6,"size":321.6},
                                {"price":4.5,"size":326.36}],
                                "availableToLay":
                                [
                                {"price":4.8,"size":110.34},
                                {"price":4.9,"size":497.38},
                                {"price":5.0,"size":492.53}
                                ],
                                "tradedVolume":
                                [
                                ]
                                }
                                },

                                {"selectionId":58805,
                                "handicap":0.0,
                                "status":"ACTIVE",
                                "lastPriceTraded":3.5,
                                "totalMatched":0.0,
                                "ex":
                                {
                                "availableToBack":
                                [
                                {"price":3.45,"size":330.16},
                                {"price":3.4,"size":451.45},{"price":3.35,"size":7 06.06}
                                ],
                                "availableToLay":
                                [
                                {"price":3.5,"size":125.01},
                                {"price":3.55,"size":350.16},
                                {"price":3.6,"size":786.86}
                                ],
                                "tradedVolume":
                                [
                                ]
                                }}]
                                }
                                ]
                                }

                                For reference, the listMarketCatalogue for that market is this:

                                {"jsonrpc":"2.0",
                                "result":
                                [
                                {"marketId":"1.125591131",
                                "marketName":"Match Odds",
                                "marketStartTime":"2016-07-22T22:15:00.000Z",
                                "totalMatched":85127.51,
                                "runners":[
                                {"selectionId":356589,
                                "runnerName":"Criciuma",
                                "handicap":0.0,
                                "sortPriority":1},

                                {"selectionId":198129,
                                "runnerName":"Parana",
                                "handicap":0.0,
                                "sortPriority":2},

                                {"selectionId":58805,
                                "runnerName":"The Draw",
                                "handicap":0.0,
                                "sortPriority":3}

                                ],
                                "competition":{"id":"321319","name":"Brazilian Division 2"}
                                }
                                ]}

                                This tells us the selectionId for each of the match outcomes.

                                You might want to try copying some of the above JSON strings and pasting them into something (NotePad++ perhaps?) that will indent properly. You might need to remove the line breaks I added.

                                HI , firstly thanks for your help on this. I got the marketbook to work on matlab, its a slow one but it works what my question is availabletoback is the money available for me to back? (which is the lay information in betfair?) am I right?

                                Comment

                                Working...
                                X