Technical Support Questions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AlgoTrader
    Junior Member
    • Mar 2012
    • 243

    #1

    Technical Support Questions

    I dared to open a new thread, it is intended for technical questions regarding the new API.

    The API calls listCompetitions, listCountries, listEvents, listEventTypes work as expected.

    The one I cannot handle is listMarketCatalogue:
    Code:
    Request:{
      "jsonrpc": "2,0",
      "id": 1,
      "method": "SportsAPING/v1.0/listMarketCatalogue",
      "params": {
        "filter": {},
        "marketProjection": [
          "EVENT",
          "EVENT_TYPE"
        ],
        "sort": "FIRST_TO_START",
        "maxResults": 1000
      }
    }
    
    Response:{
      "jsonrpc": "2.0",
      "error": {
        "code": -32099,
        "message": "ANGX-0006",
        "data": {
          "exceptionname": "APINGException",
          "APINGException": {
            "errorDetails": "ServiceUnavailable : DSC-0026",
            "errorCode": "UNEXPECTED_ERROR",
            "requestUUID": "prdang004-12121028-0000012c91"
          }
        }
      },
      "id": 1
    }
    Can you please look of what is wrong there?
    Betfair Bots Made Easy
  • MarkL
    Junior Member
    • Oct 2008
    • 29

    #2
    Hi,

    Yes, we're aware of this issue and it will be fixed in the next release. If you limit the request to about 100, it works as expected.

    Comment

    • AlgoTrader
      Junior Member
      • Mar 2012
      • 243

      #3
      Thanks. I found a strange thing.

      maxResults 399 returns
      Code:
      { code: -32099,
        message: 'ANGX-0001',
        data: 
         { exceptionname: 'APINGException',
           APINGException: 
            { errorDetails: 'operation restricts amount of data being returned',
              errorCode: 'TOO_MUCH_DATA',
              requestUUID: 'prdang003-12120940-0000012801' } } }
      while maxResults 400 returns
      Code:
       code: -32099,
        message: 'ANGX-0006',
        data: 
         { exceptionname: 'APINGException',
           APINGException: 
            { errorDetails: 'ServiceUnavailable : DSC-0026',
              errorCode: 'UNEXPECTED_ERROR',
              requestUUID: 'prdang001-12120939-00000124dd' } } }
      The second error text is very misleading.

      One more question: is it possible to make "Connection: keep-alive" work? Now it reconnects after any invocation, so expensive HTTPS handshake required for every API call.
      Betfair Bots Made Easy

      Comment

      • AlgoTrader
        Junior Member
        • Mar 2012
        • 243

        #4
        I am really impressed with so precise volumes:

        Code:
                      {
                        "price": 3.9,
                        "size": 31.400486618004862
                      },
                      {
                        "price": 3.95,
                        "size": 5.233414436334145
                      },
                      {
                        "price": 4.3,
                        "size": 15.098400648824004
                      }
        All the money sums are there with extreme precision. I would suggest to drop the "nanocents" though, I cannot imagine anyone is interested in money that is a millionth fraction of a cent.
        Betfair Bots Made Easy

        Comment

        • StefanBelo.
          Junior Member
          • Jan 2009
          • 105

          #5
          What is value representation of enums? By default in C based languages the first value is 0, the next value is 1 and so on.

          On the other hand in your new api some enums could be flags so better representation for instance for MarketProjection enum is:

          COMPETITION = 0x01,
          EVENT = 0x02,
          EVENT_TYPE = 0x04, and so on so one could write:

          MarketProjection.COMPETITION | MarketProjection.RUNNER_DESCRIPTION
          instead of array/list/set representation you specify for listMarketCatalogue, and other methods.

          I believe it is possible to use value represenation of enums when setting parameters for jsonrpc, not only name representation.

          I tested all methods of your new api and it seems that all works fine, but not listMarketCatalogue method that did not set Description, Runners, EventType, Competition and Event properties.

          Yes, I set marketProjections to request mentioned data.
          betfair bot platform, bfexplorer bot sdk

          Comment

          • AlgoTrader
            Junior Member
            • Mar 2012
            • 243

            #6
            Originally posted by StefanBelo. View Post
            What is value representation of enums? By default in C based languages the first value is 0, the next value is 1 and so on.

            COMPETITION = 0x01,
            EVENT = 0x02,
            EVENT_TYPE = 0x04, and so on so one could write:
            You think of enums in C/C++ way. JSON is related to JavaScript (JSON is JavaScript Object Notation), so there is no C style enums! JSON has constants and arrays of constants. So when you need competition, event and eventType you just provide an array of strings

            Code:
            var what = ['COMPETITION ', 'EVENT', EVENT_TYPE'];
            In C/C++ you need a JSON library, all JSON libs have array manipulation methods. Of course, you may misspell "enum" words, you will get API error then like this

            Code:
            {
              "jsonrpc": "2.0",
              "error": {
                "code": -32602,
                "message": "DSC-0018"
              },
              "id": 1
            }
            Making enums is just extra work, you will need map them in JSON arrays when sending requests. What JSON library you use? Betfair JSON API is language independent, so I think the C/C++ problems of not having native string arrays is not a Betfair problem. For example QT is like this

            Code:
            // Array of strings
            QStringList what;
            what << "COMPETITION" << "EVENT" << "EVENT_TYPE";
            
            // JSON Array
            QJsonArray list = QJsonArray::fromStringList(what);
            Qt5 also has exellent JSON parser/serializer
            Last edited by AlgoTrader; 25-12-2012, 01:37 PM.
            Betfair Bots Made Easy

            Comment

            • AlgoTrader
              Junior Member
              • Mar 2012
              • 243

              #7
              Originally posted by StefanBelo. View Post
              I tested all methods of your new api and it seems that all works fine, but not listMarketCatalogue method that did not set Description, Runners, EventType, Competition and Event properties.

              Yes, I set marketProjections to request mentioned data.
              That's strange. Here is my example:

              Code:
              Request:{
                "jsonrpc": "2.0",
                "id": 1,
                "method": "SportsAPING/v1.0/listMarketCatalogue",
                "params": {
                  "filter": {
                    "eventTypeIds": [
                      1
                    ],
                    "marketTypeCodes": [
                      "MATCH_ODDS"
                    ]
                  },
                  "marketProjection": [
                    "EVENT",
                    "RUNNER_DESCRIPTION"
                  ],
                  "maxResults": 60,
                  "sort": "FIRST_TO_START"
                }
              }
              and the result is:
              Code:
              Response:{
                "jsonrpc": "2.0",
                "result": [
                  {
                    "marketId": "1.107800437",
                    "marketName": "Match Odds",
                    "isMarketDataDelayed": false,
                    "runners": [
                      {
                        "selectionId": 5322977,
                        "runnerName": "Samsunspor (Res)",
                        "handicap": 0
                      },
                      {
                        "selectionId": 5303937,
                        "runnerName": "Trabzonspor (Res)",
                        "handicap": 0
                      },
                      {
                        "selectionId": 58805,
                        "runnerName": "The Draw",
                        "handicap": 0
                      }
                    ],
                    "event": {
                      "id": "26939459",
                      "name": "Samsunspor (Res) v Trabzonspor (Res)",
                      "countryCode": "TR",
                      "timezone": "Europe/London",
                      "openDate": "2012-12-26T11:00:00.000Z"
                    }
                  },
                  ... skipped ...
                ],
                "id": 1
              }
              Check marketProjection, it should bot be marketProjections
              Betfair Bots Made Easy

              Comment

              • StefanBelo.
                Junior Member
                • Jan 2009
                • 105

                #8
                Thanks Algo, you are right in my code I used plural name of the parameter: marketProjection, and that was the problem.

                I develop in .net languages. I already tested value and name based enums parameters and both works, so you can write as well for marketProjection:

                "marketProjection": [
                "EVENT",
                "RUNNER_DESCRIPTION"
                ]

                or

                "marketProjection": [
                1,
                4
                ]

                What I meant when talking about enum flags is performance issue, as instead of sending array of numbers as above, you could write "marketProjection": 17.

                This approach simplifies query creation on the server side as well, because instead querying set for occurrence of MarketProjection values, they could mask marketProjection vlaue by bit operation.

                if ((marketProjection & MarketProjection.EVENT) == MarketProjection.EVENT)
                {
                // Add Event data ...
                }
                betfair bot platform, bfexplorer bot sdk

                Comment

                • AlgoTrader
                  Junior Member
                  • Mar 2012
                  • 243

                  #9
                  I don't think "marketProjection": 17 is worth to have. Optimization can be a road to hell.
                  Betfair Bots Made Easy

                  Comment

                  • AlgoTrader
                    Junior Member
                    • Mar 2012
                    • 243

                    #10
                    Problem reports:

                    1. Nanocents fun: (diff of two identical invocations)

                    182,183c182,183
                    < "totalMatched": 601.226483574127,
                    < "totalAvailable": 3218296.947817091,
                    ---
                    > "totalMatched": 601.2264835741269,
                    > "totalAvailable": 3218296.94781709,

                    A lot of similar stuff skipped. Two consecutive invocations return quite different money volumes differing in "nanocents"

                    2. orderProjection and matchedProjection in listMarketBook

                    When I ask for orderProjection I will get "matches" array also. When I ask for matchedProjection I get "orders" array included. "Orders" and "Matches" are always come together. I think if I need "matches" then no orders are of interest and vice versa.

                    If I need both "orders" and "matches" I will ask for both orderProjection and matchProjection in request
                    Betfair Bots Made Easy

                    Comment

                    • AlgoTrader
                      Junior Member
                      • Mar 2012
                      • 243

                      #11
                      No bet persistance field in listMarketBook orders:

                      Code:
                                  {
                                    "betId": "1:24260388106",
                                    "orderType": "LIMIT",
                                    "status": "EXECUTABLE",
                                    "side": "BACK",
                                    "price": 1000,
                                    "size": 4,
                                    "bspLiability": 0,
                                    "placedDate": "2012-12-26T07:07:29.000Z",
                                    "avgPriceMatched": 0,
                                    "sizeMatched": 0,
                                    "sizeRemaining": 4,
                                    "sizeLapsed": 0,
                                    "sizeCancelled": 0,
                                    "sizeVoided": 0
                                  },
                                  {
                                    "betId": "1:24260387419",
                                    "orderType": "LIMIT",
                                    "status": "EXECUTABLE",
                                    "side": "LAY",
                                    "price": 1.01,
                                    "size": 5,
                                    "bspLiability": 0,
                                    "placedDate": "2012-12-26T07:07:07.000Z",
                                    "avgPriceMatched": 0,
                                    "sizeMatched": 0,
                                    "sizeRemaining": 5,
                                    "sizeLapsed": 0,
                                    "sizeCancelled": 0,
                                    "sizeVoided": 0
                                  }
                      That's very important field, one order will be cancelled at start, the other will survive.
                      Betfair Bots Made Easy

                      Comment

                      • StefanBelo.
                        Junior Member
                        • Jan 2009
                        • 105

                        #12
                        listMarketCatalogue sort problem

                        It seems that listMarketCatalogue method does not sort returned market data according to set sort (MarketSort) parameter.
                        betfair bot platform, bfexplorer bot sdk

                        Comment

                        • DivideByZeroError
                          Junior Member
                          • May 2009
                          • 13

                          #13
                          listMarketCatalogue details

                          Hi,

                          I'm finally catching up with the new API (which is excellent) and most things are fine but I can't seem to get the runner details from listMarketCatalogue. I see from the known errors that the marketId filter is not working but I don't seem to be getting the details using marketProjection either.

                          My request looks like this:

                          Code:
                          {"id":1,
                          "method":"SportsAPING\v1.0\listMarketCatalogue",
                          "params":[
                              {"sort":"FIRST_TO_START",
                               "marketProjection":["EVENT",
                                                   "RUNNER_DESCRIPTION"],
                               "marketIds":["1.108462056"],
                               "maxResults":100}],
                          "jsonrpc":2.0}
                          And the results are a big array with just the name and id, like this:

                          Code:
                          {"marketId":"1.108462056","marketName":"1m2f Hcap"}

                          Your help is much appreciated.

                          Comment

                          • BetfairDeveloperProgram
                            Administrator
                            • Oct 2008
                            • 680

                            #14
                            listMarketCatalogue details

                            Hi,

                            The request should look like this:

                            Code:
                            [{"jsonrpc": "2.0", "method": "SportsAPING/v1.0/listMarketCatalogue", "params": {"filter":{"exchangeIds":[1],"eventTypeIds":[7]},"sort":"FIRST_TO_START","maxResults":"100","marketProjection":["RUNNER_DESCRIPTION","EVENT"]}, "id": 1}]
                            This request will return the applicable horse racing markets and runner names.

                            Thanks

                            Neil

                            Comment

                            • DivideByZeroError
                              Junior Member
                              • May 2009
                              • 13

                              #15
                              A belated thanks for helping me get my param/filter hierarchy sorted.

                              I've noticed that there is an inconsistent limit of the data on getMarketCatalogue. When I call with marketProjection "RUNNER_DESCRIPTION" and maxResults = 200 it works fine, but when I use marketProjection "MARKET_DESCRIPTION" and maxResults with anything higher than 60 I get the error code TOO_MUCH_DATA.

                              Given that the marketFilter isn't working yet and there are more than 60 horse-racing markets, is there a work-around to get the market details? I've tried using textQuery with the marketName but not having any joy with that.

                              Thanks.

                              Comment

                              Working...
                              X