API Error - Parameter not found

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Simple
    Junior Member
    • Aug 2009
    • 32

    #1

    API Error - Parameter not found

    I have a problem with this test bet

    Code:
    {"jsonrpc":"2.0","method":"SportsAPING/v1.0/placeOrders","params":{"marketId":"1.112253401","instructions":[{"selectionID":"50335","handicap":"0","side":"BACK","orderType":"LIMIT","limitOrder":{"size":"4","price":"20","persistenceType":"LAPSE"}}]},"id":1}
    I do not know which parameter i have no included and when i look at this example

    https://api.developer.betfair.com/se...ts-PlacingABet

    i do not see any difference in the structure.
  • Peter Simple
    Junior Member
    • Aug 2009
    • 32

    #2
    Even when i use long for selectionID and double for handicap, price and size i will get the same error.

    Comment

    • Peter Simple
      Junior Member
      • Aug 2009
      • 32

      #3
      I have noted a very strange behaviour. When i try to place a bet in the API-NG Visualiser i can also not place the bet. It seems that some functions do not work in the Visualiser when i try to use numbers (MarketID or EventID), when i make a textQuery i get results.

      Comment

      • AlgoTrader
        Junior Member
        • Mar 2012
        • 243

        #4
        Your request has multiple problems:
        Code:
        {
            "jsonrpc": "2.0",
            "method": "SportsAPING/v1.0/placeOrders",
            "params": {
                "marketId": "1.112253401",
                "instructions": [
                    {
                        "selectionID": "50335",
                        "handicap": "0",
                        "side": "BACK",
                        "orderType": "LIMIT",
                        "limitOrder": {
                            "size": "4",
                            "price": "20",
                            "persistenceType": "LAPSE"
                        }
                    }
                ]
            },
            "id": 1
        }
        The first one is selectionId is misspeled as selectionID. That's already enough. The second is you do not care that doubles are not strings, why for example handicap is in quotes?

        My Request, that works.
        Code:
        {
          "jsonrpc": "2.0",
          "id": 3,
          "method": "SportsAPING/v1.0/placeOrders",
          "params": {
            "marketId": "1.113019279",
            "instructions": [
              {
                "orderType": "LIMIT",
                "selectionId": 2257314,
                "side": "BACK",
                "limitOrder": {
                  "price": 1000,
                  "size": 5,
                  "persistenceType": "LAPSE"
                }
              }
            ],
            "customerRef": "2014-02-27T07:16:56.591Z"
          }
        }
        Betfair Bots Made Easy

        Comment

        • Peter Simple
          Junior Member
          • Aug 2009
          • 32

          #5
          Thank you very much. It was indeed the "selectionId", generally i write alwasy in my programms "ID".

          The second is you do not care that doubles are not strings, why for example handicap is in quotes?
          I did care and in my first version i used doubles but after i checked the official example code in the documentation i saw that some items were used as strings so i changed my code. Here is an excerpt from the official code:

          {
          "jsonrpc": "2.0",
          "method": "SportsAPING/v1.0/placeOrders",
          "params": {
          "marketId": "1.109850906",
          "instructions": [
          {
          "selectionId": "237486",
          "handicap": "0",
          "side": "LAY",
          "orderType": "LIMIT",
          "limitOrder": {
          "size": "2",
          "price": "3",
          "persistenceType": "LAPSE"
          }
          }
          ]
          },
          "id": 1
          }
          Even size and price are strings instead of doubles.

          Comment

          • AlgoTrader
            Junior Member
            • Mar 2012
            • 243

            #6
            Betfair itself returns numbers as numbers:

            Code:
            ...
            "tradedVolume": [
              {
                "price": 3.05,
                "size": 2.02
              },
              {
                "price": 3.1,
                 "size": 1.29
              }
            ]
            ...
            As to input request, Betfair allows both "price": "1.21" and "price": 1.21

            Personally, I send numbers as numbers, not as strings. But that's my current preference, it may change
            Betfair Bots Made Easy

            Comment

            Working...
            X