No announcement yet.

Cannot return a bet I can see on the site as settled

  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot return a bet I can see on the site as settled


    I placed a bet using the API earlier - BetID: 53596398193 which I can see on the website as Settled (it won) - a PLACE bet of £3.00 winning £4.26.

    It was supposed to be the first leg in a place accumulator which I have now lost as all the other legs won but because I could not get a settled status from this bet I could not move on to the next leg.

    I can see the bet on the website fine, betID, price, size etc are all correct however when I use my BOT in my JSON Response I have no details about this bet at all..

    The response seems to go back days and days when all I really need is today's info plus I add the actual BetID that I am looking for in the JSON Request.

    What do I have to do to :
    a) get the bet I want in the response if it has been settled?
    b) not get bets going back weeks and weeks. Just today really is all I need?

    I am thinking that somehow I am supposed to add a market ID into the request or the bet type e.g PLACE or WIN. However the methods in the C# library doesn't support this.

    This is the core part of a method I made to find a Bets Current Status it returns a single character which represents the old values from the SOAP system e.g S =Settled, C=Canclled, V=Voided, L=Lapsed, M=Matched,U=Unmatched) etc.

    I do this by checking if the race is in the past and if so I get the Settled and then the Voided, Cancelled and Lapsed data to check if my bet is in any of them if it hasn't been settled. I can then check my bet objects bet amount to see if it was fully settled or voided, lapsed or cancelled etc.

    I can see the bet on the website with the same ID with a settled status.

    The BetID I am looking for is 53596398193

    On the website it is settled in the 3 To Be Placed Market with £3.00 stake @ 2.42 = £4.26 profit.

    Is it because I am not passing in the MarketID or a value to say only return "PLACE" bets?

    The C# code is basically this

    ISet<String> betIds = new HashSet<String>();
    string currentBetID = currentBet.BetID.ToString(); // the values in JSON are strings in my DB they are bigint/long
    betIds.Add(currentBetID); // add my bet ID to the betIds filter passed into all the cleared requests (settled, cancelled, lapsed, voided etc)

    // do I need to pass in something like a marketID to say its a PLACE market or something plus how do I limit the no of records when I don't know how many bets will be placed in a day
    // I could just set the record count value in black at the end to 100 or something??
    settledOrdersReport = this.Client.listClearedOrders(BetStatus.SETTLED, betIds, GroupBy.MARKET, false, null, 0, 0);

    // now loop through results
    var reportsSettled = settledOrdersReport.ClearedOrders;

    foreach (ClearedOrderSummary cl1 in reportsSettled)
    // does the bet ID match MY bet ?
    if (cl1.BetId == currentBetID)
    // yes so log and then check sizes to work out if settled or partially settled

    // if the size of the settled amount > 0 then we have a settled bet
    if (Convert.ToInt64(cl1.SizeSettled) > 0)
    // code to handle settled bet

    // first I will show you the cancelled, lapsed, voided data I get back. Even here in the lapsed response I have a bet from the 3rd of June 2015.
    // So I would like to know how to get back just the data for the BetIDs I have passed in e.g 53596398193

    // I am guessing I am missing a parameter to say it is the PLACE markets or pass in the market ID even though I have passed in the BetID?

    // getting cancelled, voided, lapsed bets

    Calling: SportsAPING/v1.0/listClearedOrders With args: {"betStatus":"CANCELLED","betIds":["53596398193"],"groupBy":"MARKET","includeItemDescription":false ,"locale":null,"fromRecord":0,"recordCount":0};

    Got Response: {"jsonrpc":"2.0","result":{"ClearedOrders":[],"moreAvailable":false},"id":1};
    EndPoint =;
    Calling: SportsAPING/v1.0/listClearedOrders With args: {"betStatus":"VOIDED","betIds":["53596398193"],"groupBy":"MARKET","includeItemDescription":false ,"locale":null,"fromRecord":0,"recordCount":0};

    Got Response: {"jsonrpc":"2.0","result":{"ClearedOrders":[{"eventTypeId":"7","eventId":"27493021","marketId" :"1.119606148","selectionId":9659894,"handicap":0. 0,"betId":"53079199243","placedDate":"2015-07-22T13:21:30Z","persistenceType":"MARKET_ON_CLOSE", "orderType":"LIMIT","side":"BACK","priceRequested" :1.2,"settledDate":"2015-07-22T14:07:11Z","betCount":1,"commission":0.0,"price Matched":1.2,"priceReduced":false,"sizeSettled":2. 0,"profit":0.0,"sizeCancelled":0.0},{"eventTypeId" :"7","eventId":"27456795","marketId":"1.119045785" ,"selectionId":9511868,"handicap":0.0,"betId":"513 34192525","placedDate":"2015-06-03T11:45:15Z","persistenceType":"LAPSE","orderType ":"LIMIT","side":"BACK","priceRequested":11.5,"set tledDate":"2015-06-03T12:18:10Z","betCount":1,"commission":0.0,"price Matched":11.5,"priceReduced":false,"sizeSettled":2 .0,"profit":0.0,"sizeCancelled":0.0},{"eventTypeId ":"7","eventId":"27456795","marketId":"1.119045786 ","selectionId":9511868,"handicap":0.0,"betId":"51 334204741","placedDate":"2015-06-03T11:45:31Z","persistenceType":"LAPSE","orderType ":"LIMIT","side":"BACK","priceRequested":3.0,"sett ledDate":"2015-06-03T12:18:10Z","betCount":1,"commission":0.0,"price Matched":3.05,"priceReduced":false,"sizeSettled":2 .0,"profit":0.0,"sizeCancelled":0.0}],"moreAvailable":false},"id":1};

    EndPoint =;
    Calling: SportsAPING/v1.0/listClearedOrders With args: {"betStatus":"LAPSED","betIds":["53596398193"],"groupBy":"MARKET","includeItemDescription":false ,"locale":null,"fromRecord":0,"recordCount":0};

    Got Response: {"jsonrpc":"2.0","result":{"ClearedOrders":[],"moreAvailable":false},"id":1};

    // getting Settled info - doesn't have my bet in it which is on the website and settled PLUS it goes back weeks when I only need a day

    Calling: SportsAPING/v1.0/listClearedOrders With args:

    {"betStatus":"SETTLED","betIds":["53596398193"],"groupBy":"MARKET","includeItemDescription":false ,"locale":null,"fromRecord":0,"recordCount":0};

    Got Response:

    {"jsonrpc":"2.0","result":{"ClearedOrders":[{"eventTypeId":"7","eventId":"27503597","marketId" :"1.119830396","selectionId":9654710,"handicap":0. 0,"betId":"53594777530","placedDate":"2015-08-04T14:10:04Z","persistenceType":"MARKET_ON_CLOSE", "orderType":"MARKET_ON_CLOSE","side":"BACK","price Requested":1.98,"settledDate":"2015-08-04T17:53:52Z","betCount":1,"commission":0.24,"pric eMatched":1.98,"priceReduced":false,"sizeSettled": 5.0,"profit":4.88,"sizeCancelled":0.0},{"eventType Id":"7","eventId":"27503596","marketId":"1.1198303 89","selectionId":9430434,"handicap":0.0,"betId":" 53597225871","placedDate":"2015-08-04T15:32:11Z","persistenceType":"MARKET_ON_CLOSE", "orderType":"LIMIT","side":"BACK","priceRequested" :1.28,"settledDate":"2015-08-04T16:54:17Z","betCount":1,"commission":0.0,"price Matched":1.28,"priceReduced":false,"sizeSettled":2 .0,"profit":-2.0,"sizeCancelled":0.0},{"eventTypeId":"7","event Id":"27503596","marketId":"1.119830388","selection Id":9430434,"handicap":0.0,"placedDate":"2015-08-04T15:07:29Z","persistenceType":"LAPSE","orderType ":"LIMIT","side":"BACK","settledDate":"2015-08-04T16:53:27Z","betCount":2,"commission":0.0,"price Matched":2.54,"priceReduced":false,"sizeSettled":6 .0,"profit":-6.0,"sizeCancelled":0.0},{"eventTypeId":"7","event Id":"27503601","marketId":"1.119830472","selection Id":8902719,"handicap":0.0,"betId":"53594625565"," placedDate":"2015-08-04T14:04:28Z","persistenceType":"LAPSE","orderType ":"LIMIT","side":"BACK","priceRequested":1.64,"set tledDate":"2015-08-04T15:42:10Z","betCount":1,"commission":0.16,"pric eMatched":1.64,"priceReduced":false,"sizeSettled": 5.0,"profit":3.2,"sizeCancelled":0.0},{"eventTypeI d":"7","eventId":"27503601","marketId":"1.11983047 1","selectionId":8902719,"handicap":0.0,"placedDat e":"2015-08-04T15:30:24Z","persistenceType":"MARKET_ON_CLOSE", "orderType":"LIMIT","side":"BACK","settledDate":"2 015-08-04T15:38:53Z","betCount":2,"commission":0.32,"pric eMatched":2.28,"priceReduced":false,"sizeSettled": 5.0,"profit":6.38,"sizeCancelled":0.0},{"eventType Id":"7","eventId":"27503601","marketId":"1.1198304 70","selectionId":8902719,"handicap":0.0,"betId":" 53596509853","placedDate":"2015-08-04T15:07:28Z","persistenceType":"MARKET_ON_CLOSE", "orderType":"LIMIT","side":"BACK","priceRequested" :4.5,"settledDate":"2015-08-04T15:36:21Z","betCount":1,"commission":0.35,"pric eMatched":4.5,"priceReduced":false,"sizeSettled":2 .0,"profit":7.0,"sizeCancelled":0.0}, -- cut off due to size limit

    Thanks for your help in advance!


  • #2
    Not sure I can answer why you cannot see the bet, but the listClearedOrders function DOES support the use of a market id - see

    Remember the C# library is a starting point (I'm not sure it is actively maintained) so if the library doesn't support marketIds you can always just extend the library.


    • #3


      Thanks for the reply.

      This is what pisses me off.

      I started with their C# libraray 2 years ago now and even fixed about 5+ bugs for them and added in new classes to return Runner Meta Data and so on but I don't get told when new functionality is being added to their example core code base.

      I don't know if there is a way to do this or not - e.g an email that would tell me new code has been added to class X or Y etc.

      I will hack about now with the Interface class then the two JSON classes then the calling BetfairAPI class that actually wants the data!




      • #4
        I'm pretty sure that the use of a marketId has been in the listClearedOrders call from the very beginning (I certainly don't remember adding it at any point)

        Updates to the core functionality are listed in the Release Notes - see