listClearedOrders

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gus
    Senior Member
    • Jan 2009
    • 134

    #1

    listClearedOrders

    I'm calling listClearedOrders (using REST), and sending the params:

    {"groupBy":"RUNNER","betIds":["32775228465","32775243611"],"includeItemDescription":false,"betStatus":"SETTL ED"}

    but all I get back is:

    {"clearedOrders":[],"moreAvailable":false}

    the betIds are definitely correct (I checked on the website 'Bet History' page) and the Bets were settled this afternoon (horse Races at Bangor)

    I tried entering the same betIds in the Validator (same betIds), but no output from that either.

    Am i missing something?
  • gus
    Senior Member
    • Jan 2009
    • 134

    #2
    That's weird.

    The same query:

    Code:
    {"groupBy":"RUNNER","betIds":["32775228465","32775243611"],"includeItemDescription":false,"betStatus":"SETTLED"}
    is working this morning and returns the correct response:


    Code:
    {"clearedOrders":[{"marketId":"1.112294091","profit":-0.13,"selectionId":8156340,"eventId":"27119869","betCount":2,"pric
    eReduced":false,"handicap":0.0,"eventTypeId":"7","betId":"32775243611"}],"moreAvailable":false}
    oh well ... onward and upward!

    Comment

    • HazuRek
      Junior Member
      • Aug 2013
      • 21

      #3
      At this moment I receive empty result (as you posted) only for bets with BetStatus=CANCELLED. The request is: {"betStatus":"CANCELLED","betIds":["32787795135"]}
      For other statuses it is ok. Also sometimes I get server timeout exception when calling this method.

      Comment

      • HazuRek
        Junior Member
        • Aug 2013
        • 21

        #4
        I've found some interesting thing. If some bet was cancelled (by user) or lapsed but market is not already closed, we cannot get info about this bet using listClearedOrders. Is it bug or feature? Old API's method getBet returns correct data for such bets despite market status.

        Comment

        • betdynamics
          Junior Member
          • Sep 2010
          • 534

          #5
          Presumably the bet is not yet "cleared" as it relates to a currently active market.

          listCurrentOrders may return information about the bet in this case.

          Comment

          • gus
            Senior Member
            • Jan 2009
            • 134

            #6
            Well, I've just been testing it again this afternoon on Greyhound Racing.

            My app waits until listMarketBook shows that there was a 'WINNER' or 'LOSER', at which point I'd have thought the Market must be settled and orders cleared, so that's when the app calls listClearedOrders but all I get back at that time is an empty array, the same as yesterday afternon.

            I've just checked again (about 5 minutes after a WINNER was indicated by listMarketBook), and now I do get the correct Response.

            Which rather begs the question, when are orders 'Cleared' if it's not the same time as when a WINNER is declared?

            Obviously I could just put the listClearedOrders in a do .. while loop, but yesterday it appeared to be several hours before listClearedOrders showed my settled Bet!

            Comment

            • gus
              Senior Member
              • Jan 2009
              • 134

              #7
              just tried it again using the MarketStatus of 'CLOSED' to trigger listClearedOrders, but still get an empty array, then, at some indeterminate time after that, i get the correct response, so I guess it will have to be a do .. while loop, but of course, in that case it will have to be looking for not only SETTLED Bets but also LAPSED, CANCELLED and VOIDED (to tell whether the Race has actually been settled and it should stop the do ... while loop).

              I'd rather hoped the new listClearedOrders would put an end to that sort of thing.

              Comment

              • gus
                Senior Member
                • Jan 2009
                • 134

                #8
                Just in case anyone is avidly following this thread to find out what happens next, I've put the listClearedOrders into a while loop with a 1 second delay.

                So, when a Race that I know I have matched Bets in shows as 'CLOSED' in listMarketBook i start the loop (which iterates at once per second).

                and the loop looks something like:

                Code:
                boolean settled = false;
                
                JSONObject obj;
                JSONArray resArray;
                
                while(!settled)
                	{
                		obj = JSONQuery.listClearedOrders(betStatus, betIds, groupBy, includeItemDescription);
                		resArray = new JSONArray();
                
                		if(obj != null)
                			{
                				if(obj.containsKey("clearedOrders"))
                					{
                						resArray = (JSONArray)obj.get("clearedOrders");
                
                						if(resArray.size() > 0)
                							settled = true;
                					}
                			}
                	}
                
                // do something with the resArray
                and that seems to work ... it usually seems to take about 15 - 30 iterations (15 - 30 secs) to get the clearedOrders.

                The only problems i anticipate are if all of the matched Bets were VOIDED (could happen), in which case they presumably wouldn't show as SETTLED, so the loop would go on for ever, ... will probably have to check for that too, or if it takes an inordinately long time for between the market being CLOSED and the bets being settled.
                Last edited by gus; 23-12-2013, 09:11 PM.

                Comment

                • HazuRek
                  Junior Member
                  • Aug 2013
                  • 21

                  #9
                  Originally posted by betdynamics View Post
                  Presumably the bet is not yet "cleared" as it relates to a currently active market.

                  listCurrentOrders may return information about the bet in this case.
                  Yes, but listCurrentOrder also does not return data for bets that were canceled by user on markets that is not already closed. So how can I get data for such kind of bets?

                  Comment

                  • AlgoTrader
                    Junior Member
                    • Mar 2012
                    • 243

                    #10
                    Yes, but listCurrentOrder also does not return data for bets that were canceled by user on markets that is not already closed. So how can I get data for such kind of bets?
                    What's for?

                    I placed the bet, then I cancelled while not matched. Why should I know of cancelled bets that were not matched?

                    The cancelled unmatched bet is completely equivalent to the bet that never existed.
                    Betfair Bots Made Easy

                    Comment

                    • HazuRek
                      Junior Member
                      • Aug 2013
                      • 21

                      #11
                      Originally posted by AlgoTrader View Post
                      What's for?
                      It is another question. In old API using getBet method I could get data for EVERY kind of bet. So I tnink that functionality of new should not be reduced, should it?

                      Comment

                      • kennedystewart
                        Junior Member
                        • Aug 2022
                        • 1

                        #12
                        Originally posted by HazuRek View Post

                        It is another question. In old API using getBet method I could get data for EVERY kind of bet. So I tnink that functionality of new should not be reduced, should it? drift boss
                        yes i agree with your point

                        Comment

                        Working...
                        X