Announcement

Collapse
No announcement yet.

placeOrders response SUCCESS when price matched is 0.0

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • placeOrders response SUCCESS when price matched is 0.0

    Hi,
    I am having trouble understanding how the placeOrders request works with the new API-NG, I am getting a response of 'SUCCESS' when placing the order, however the priceMatched is being returned as 0.0 so the bet is actually never being placed.

    Here's an example of my placeOrders request
    Code:
    {
       "jsonrpc": "2.0", 
       "method": "SportsAPING/v1.0/placeOrders", 
       "params": {
           "marketId": "123456",
           "instructions": [{
               "selectionId": 123456, 
               "side": "LAY", 
               "orderType": "LIMIT", 
               "limitOrder": {
                  "size": "2.00", 
                  "price": "3.00", 
                  "persistenceType":"LAPSE"
               } 
           }] 
        },
        "id": 1 
    }

    and here's the response from the server:
    Code:
    {
       "jsonrpc": "2.0", 
       "result": {
          "status": "SUCCESS", 
          "instructionReports": [
             {
                "status": "SUCCESS", 
                "sizeMatched": 0.0, 
                "betId": "123456", 
                "instruction": {
                   "orderType": "LIMIT", 
                   "selectionId": 123456, 
                   "limitOrder": {
                      "price": 2.00, 
                      "persistenceType": "LAPSE", 
                      "size": 3.00
                   }, 
                   "side": "LAY"
                }, 
                "placedDate": "2014-12-20T12:25:01.000Z", 
                "averagePriceMatched": 0.0
             }
          ], 
          "marketId": "123456"
       }, 
       "id": 1
    }
    I am confused, because this doesn't happen with every request and I am using the same request string with two different accounts, each time one account has matched the price asked, while the other fails. This leads me to believe there isn't a problem with my request JSON.

    I am aware that in this response the persistenceType is set to LAPSE and the placedDate is 12:25:01 (one second later than the race is due to begin), however from my experience, races never begin the second they are due to.

  • #2
    Hi FitzPattons,

    The response indicates that the ORDER you placed was successful, which is a different thing than a BET. It looks like the price you wanted to lay has already been matched by someone else, and the market has moved on. Your order will remain on the exchange until either it is matched (if the market swings back your way) or the order lapses (on the actual off of the race).

    In such circumstances, you can either cancel the order and start again (with cancelOrders), or monitor the state of the order with listCurrentOrders. You should be aware that close to the off of a race the market can change really fast, so you should be prepared for the matched status of your order to change between two successive calls.

    On a side note, you can't rely on UK horse races not going off early - the rules of racing used to clearly state that a race which started early was VOID, but when this actually happened ( by about six seconds, sometime in the late eighties / early nineties) it caused so much confusion that they changed the rules. If you've ever met a Starter on a UK racecourse, you will realise that getting them to actually tell the time is just asking too much, and nowadays a couple of races a year will go off a few seconds early.

    Cheers,
    Merlin

    Comment


    • #3
      Hi Merlin,
      Thanks for your response. I fear that monitoring the bet using listCurrentOrders, cancelling and then replacing a bet will take far too long considering the typical response times I am getting from the Betfair server, so I will set my program to do the analysis a bit earlier than it is doing (this does remove one benefit of using a bot versus placing bets manually on the site, and I never had slow communication issues with the old API, but that's another discussion).

      Interesting info about the races running early, the more you know huh!

      Thanks again

      Pat

      Comment

      Working...
      X