Best Practice for Tracking Bet Changes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dsfibber
    Junior Member
    • Jun 2015
    • 4

    #1

    Best Practice for Tracking Bet Changes

    I'm looking for the best practice for keeping track of all bets for a particular market.

    I must revisit this part of my code every 6 months as my current method seems pretty inefficient - get ALL bets for the market, every few seconds.

    I'd like to just get bets that have changed since X (including new bets) - that would be ideal. But it doesn't seem like its possible unless I'm missing something?

    Could anyone suggest the best way to go about this?

    tia
  • jptrader
    Junior Member
    • Nov 2009
    • 82

    #2
    This is a good question, I have wondered about this myself! After searching the documentation I have found that Betfair suggests best practices for this. If you use listMarketBook for getting orders:

    Best Practice
    Customers seeking to use listMarketBook to obtain price, volume, unmatched (EXECUTABLE) orders and matched position in a single operation should provide an OrderProjectionof “EXECUTABLE” in their listMarketBook request and receive all unmatched (EXECUTABLE) orders and the aggregated matched volume from all orders irrespective of whether they are partially or fully matched. The level of matched volume aggregation (MatchProjection) requested should be ROLLED_UP_BY_AVG_PRICE or ROLLED_UP_BY_PRICE, the former being preferred. This provides a single call in which you can track prices, traded volume, unmatched orders and your evolving matched position with a reasonably fixed, minimally sized response.
    If you use listCurrentOrders:
    Best Practice
    To efficiently track new bet matches from a specific time, customers should use a combination of the dateRange, orderBy "BY_MATCH_TIME" and orderProjection “ALL” to filter fully/partially matched orders from the list of returned bets. The response will then filter out any bet records that have no matched date and provide a list of betIds in the order which they are fully/partially matched from the date and time specified in the dateRange field.
    I haven't yet implemented this myself (do not think this was part of the documentation when I implemented my bet handling), but it is on my prioritized list.

    Comment

    • dsfibber
      Junior Member
      • Jun 2015
      • 4

      #3
      yeah I have read those best practices. They don't quite fit.

      the listMarketBook will not give you new fully matched bets, and the listCurrentOrders "BY_MATCH_TIME" only includes bets that have some matched portion changed since X.

      Even a combination of the 2 doesn't work. If there is a withdrawal and the price of a matched bet subsequently gets changed then you simply won't know about it with the above api calls.

      Comment

      • dsfibber
        Junior Member
        • Jun 2015
        • 4

        #4
        Looks like I'll be sticking to getting all bets again for the next 6 months then?

        Comment

        • merecat_
          Junior Member
          • May 2009
          • 35

          #5
          Matched bets are important to me on one bot. I can put down a few thousands positions on a market. I track matches by pulling the matched positions by date order (most recent first to least recent last) in small batches until I reach the current checkpoint, then record the datetime of the most recent position and use that to limit the retrieval next time around. It's not particularly elegant, and it does't pay attention to voided positions, so there's always a slight possibility of some drift (whenever you maintain state outside of the exchange).

          Comment

          Working...
          X