Problem with Place Orders

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • grae
    Junior Member
    • Aug 2011
    • 3

    #1

    Problem with Place Orders

    Hello All

    I am having a problem trying to place bets using the new api. Below is the string that I am sending as a request;

    {"jsonrpc": "2.0", "method": "SportsAPING/v1.0/placeOrders", "params": {"marketId":"1.115889727","instructions":[{"selectionId":"2309797","handicap":"0","side":"BA CK","orderType":"LIMIT","limitOrder":{"size":"5"," price":"70","persistenceType":"LAPSE"}}]}, "id": 1}"

    This always results in the following error message
    Error occurred: -2147024809 - The parameter is incorrect.

    Can anyone see which parameter is incorrect in my string or tell me what the error number might mean I would be very grateful

    cheers
  • betdynamics
    Junior Member
    • Sep 2010
    • 534

    #2
    I think you need to look at the quoting that you are using. From memory, some of the parameters are not strings and therefore should not have surrounding quotes:

    selectionId
    handicap
    size
    price

    So, I would try the following string:

    {"jsonrpc": "2.0", "method": "SportsAPING/v1.0/placeOrders", "params": {"marketId":"1.115889727","instructions":[{"selectionId":2309797,"handicap":0,"side":"BACK", "orderType":"LIMIT","limitOrder":{"size":5,"price" :70,"persistenceType":"LAPSE"}}]}, "id": 1}"

    Comment

    • Merlin
      Junior Member
      • Jan 2009
      • 56

      #3
      grae,

      It's hard to be sure with copy-pasted code, but it looks like you have some extraneous white space in front of your 'price' parameter, so it's listed as " price" instead of "price".

      Merlin

      Comment

      • grae
        Junior Member
        • Aug 2011
        • 3

        #4
        Thanks for the help people, I found the problem

        Thank you everyone who replied and those who took the time to look at my problem. I have discovered the problem and it had nothing to do with the request string. Merlin, I got excited when you pointed out the space but alas it was not in the original string, I must have introduced it during the copy and paste into the forum!! Betdynamics - they still need the quotes (in VBA anyway) even though they are numbers (MarketIds and SelectionIds must always be treated as strings otherwise you will loose trailing zeros on MarketIds and leading zeros on SelectionIds).

        The issue was that I declared a variable to contain the request string for PlaceOrders and made it of type string. This does not work. I can declare the variable name and not give it a type at all and it works (VBA dynamic typecasting to the rescue for once!!) Make it a string and I get the 'parameter incorrect' message. So not sure what type it should be but at the moment it doesn't matter.

        Now there's a week I will never get back

        Comment

        • betdynamics
          Junior Member
          • Sep 2010
          • 534

          #5
          marketIds are strings anyway, so they always need to be quoted.

          selectionIds, handicaps, prices and sizes are all numeric so there are never any leading zeros or trailing zeros (at least not any significant ones).

          However, I know nothing about VBA so if you need quotes round them so be it - just seems rather bizarre to me.

          Comment

          Working...
          X