Bug in API? INVALID_ODDS reply

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Zhong
    Junior Member
    • May 2009
    • 14

    #1

    Bug in API? INVALID_ODDS reply

    Hi all,

    Recently I often encounter the failure of placing the order from time to time.

    The execution report looks like this:

    PlaceExecutionReport : Status=FAILURE : ErrorCode=BET_ACTION_ERROR : MarketId=1.112329375 : CustomerRef= : InstructionReport[0]={Status=FAILURE : ErrorCode=INVALID_ODDS : Instruction={OrderType=LIMIT : SelectionId=6987980 : Handicap=0 : Side=BACK : LimitOrder=Size=2 : Price=3.1 : PersistenceType=LAPSE} : BetId= : PlacedDate= : AveragePriceMatched= : SizeMatched=}

    I cannot see why the price 3.1 is an invalid odds.

    Do you also encounter this problem? Is it a bug?

    Thanks a lot!
  • AlgoTrader
    Junior Member
    • Mar 2012
    • 243

    #2
    Your JSON is seems to be broken.

    LimitOrder=Size=2

    That's certainly nonsense. Please provide exact JSON request, it should be something like this for JsonRPC:

    Code:
    {
      "jsonrpc": "2.0",
      "id": 3,
      "method": "SportsAPING/v1.0/placeOrders",
      "params": {
        "marketId": "1.112335290",
        "instructions": [
          {
            "orderType": "LIMIT",
            "selectionId": 2248499,
            "side": "LAY",
            "limitOrder": {
              "price": 3.1,
              "size": 5,
              "persistenceType": "LAPSE"
            }
          }
        ],
        "customerRef": "2013-12-30T11:01:40.969Z"
      }
    }
    Betfair Bots Made Easy

    Comment

    • Zhong
      Junior Member
      • May 2009
      • 14

      #3
      Hi AlgoTrader, first of all, thanks a lot for your reply during the holiday period! And wish you happy new year!

      I checked my C# code and it seems that the error is because of the odds that I submitted: 3.1000000001d as represented by the C# double value. Even though it's shown as 3.1 as feedbacked by the Betfair report, it's not valid. So I added a rounding function to 2 decimals and it works perfect now.

      Comment

      • RDFHDFFDDVG
        Junior Member
        • Jan 2014
        • 2

        #4
        Zhong, 3.1 is valid, however the further up you go the further apart the valid odds for example 6.1 is not valid (if I copied the terms correctly) as it is to 0.2 decimal places. In C# you should look at a precision decimal type to avoid floating point rounding issues.

        (<= 1M basp 2.01M) basp
        (<= 2.02M basp 3.04M) (resolve-to 0.02M basp dir)
        (<= 3.05M basp 4M) (resolve-to 0.05M basp dir)
        (<= 4.01M basp 6M) (resolve-to 0.1M basp dir)
        (<= 6.01M basp 10M) (resolve-to 0.2M basp dir)
        (<= 10.01M basp 21M) (resolve-to 1M basp dir)
        Last edited by RDFHDFFDDVG; 04-01-2014, 07:34 AM.

        Comment

        Working...
        X