BetId Confusion

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • geoffw123
    Senior Member
    • Mar 2014
    • 250

    #1

    BetId Confusion

    Hi

    I was struggling to understand how betids work when we have a partially matched bet. Unless I have missed it the manual just doesn't explain it at all.

    If a single bet is sent with placeOrders(), it may or may not get matched initially, or maybe just partially matched.
    So lets say it was initially £10.00 not matched. That would have a bet ID x.

    Then some time later we get a match of £4.00, this appears as execution_complete order in listOrders() with a betId of y and sizeMatched 4.00.
    Presumably we then see a remaining bet of £6.00, execution_incomplete in listOrders(), lets say this appears as betId = z.

    Then some further time later that last portion is matched and will appear as execution_complete order in listOrders() with a bet Id of z and sizeMatched 6.00.

    Can anyone clarify if this description is correct or not ?

    Also, does the execution_incomplete portion also change its betId as portions are matched or maintain its original ID ? Don't know ?

    The Betfair docs should be much clearer on this especially as its something that is very awkward to test to figure out.

    Thanks for any clarification.

    Geoff
  • betdynamics
    Junior Member
    • Sep 2010
    • 534

    #2
    If we are purely talking about placeOrders, then the betId remains the same throughout.

    If the bet is partially matched and you query it via listCurrentOrders, then it will show a status of EXECUTABLE and it will show how much of the bet has been matched (sizeMatched) and how much has not been matched (sizeRemaining).

    When the bet is fully matched, the status changes to EXECUTION_COMPLETE.

    So - the betId remains constant and all the necessary information is shown in the listCurrentOrders response.

    Comment

    • geoffw123
      Senior Member
      • Mar 2014
      • 250

      #3
      Hi BetDynamics

      Thanks for the reply, sorry I am still unclear on this though.

      Lets say we placed a large bet with placeOrders(), that was initially unmatched. PlaceOrders() returns it as betId = x.

      Then over a period of minutes lets say that becomes fully matched in 3 fragments. I can see two possible ways this could work with listOrders().

      1) ListOrders() could show the individually matched fragments, and would appear 3 times as betIds say a,b,c.

      or alternatively

      2) When all 3 fragments are matched, you just see a single response in listOrders() where we see the original betId=x as EXECCUTION_COMPLETE. In other words, you now cant see that it got matched as 3 fragments.

      Option 2 sounds more likely to me, but I am fairly sure I remember seeing an instance a while back when a bet I placed got matched in individual fragments that I could seed as COMPLETE. Hence my confusion.

      I haven't been able to test this, as when I tried to test I never get a partial match grrrrr.

      Thanks for any further clarification

      Regards Geoff

      Comment

      • Merlin
        Junior Member
        • Jan 2009
        • 56

        #4
        Hi Geoff,
        my understanding of this is as follows:-
        You place an 'order'; as soon as this is successfully placed on the exchange it is given a 'betId', which is a unique identifier that stays with the entire order throughout it's life (replaceOrders is a special case, as it is actually a combination of cancelOrders and placeOrders, so you are effectively placing a new order). Calling it a 'betId' is a little confusing, as it is really an 'order id'.
        Various things can happen to the order during it's lifetime - it can be fully matched in one go, or fully matched in several pieces (called 'fragments' or 'matches') or partially matched in one or more fragments, or stay completely unmatched until it lapses. The point is that whatever happens to it, and however many fragments it gets split into, the entire order will retain a single betId.
        Now when it comes to keeping track of the order, you have a couple of options. If you call listCurrentOrders you will get a partially aggregated view of the order, in that it will show how much is matched and how much is unmatched, and the average price of the matched portion, but it won't give you a breakdown of the individual matched fragments. If you need to know that, you have to call listMarketBook with matchProjection set to 'NO_ROLLUP' and orderProjection set to 'ALL'. If you look under Runner->matches in the response it will give you a breakdown of all the matched fragments identified by betId and matchId. As far as I know, this is the only way of getting this information, and the only place the individual fragment identifier matchId is used in the API.
        Hopefully I haven't confused you further :-)
        Merlin

        Comment

        • geoffw123
          Senior Member
          • Mar 2014
          • 250

          #5
          Hi

          Thanks for the excellent description Merlin. I think that makes sense to me now. It is quite complicated though, have to let it digest a while

          It does show how woefully inadequate Betfair's API-NG documentation is though. They explain none of the subtleties like this even briefly.

          Regards Geoff

          Comment

          • geoffw123
            Senior Member
            • Mar 2014
            • 250

            #6
            Final question.

            The answer to this is probably no, but does anyone have any tricks or tips for triggering a partial bet match without having to place large bets into a market ? That would be very handy for testing this stuff.

            Geoff

            Comment

            • PLV
              Junior Member
              • Feb 2010
              • 12

              #7
              Just find a market with very low liquidity ex. Corners Over/Under. And you can easily make a bet be partial matched with very few money.

              Comment

              Working...
              X