Going through changes

For my analysis code I wanted to record everything that happened with navigation, bet placement, matching and cancelling. After some trialling I got what I thought was everything I needed. It’s not until you run the code for some time that you pull out all the bugs.

In the image below, between the thick black lines, a complete trade appears to be recorded within a 2 second period. However, on closer inspection the figures don’t add up.

2003042231

This shows, at the line numbers –

  • 28. back bet of 2.17@4 placed into the market @ 39secs to off
  • 29. 1.42@4 Back Unmatched @ 39s
  • 30. 0.75@4 Back Matched @ 39s
  • 31. Below £2 bet entry @ 39s
  • 32. 0.76@3.95 Lay Matched @ 39s (This is the offset from line 30)
  • 33. Below £2 bet entry @ 38s
  • 34. Offset bet matched flag reported before actual offset bet data @ 38s
  • 35. 1.44@3.95 Lay Matched @ 37s

The missing information is the 1.42 Back bet getting matched. Why is the split Lay recorded but not the split back? This is the result of how I’d coded to handle changes to the MyBets sheet. I was comparing bet references and checking the Matched column, which shows U or F (Unfilled or Filled). When a bet gets a partial match the remaining portion stays in the market with the same bet reference. The initial match shows as F. So when the remaining bet is matched there is an updated line with the same bet reference and showing as F in the matched column, the code was skipping this as it had already recorded that reference as matched/filled; this is how I was missing it. Offset bets, lay bets in this case, are placed for each portion of the initial bet taken, so each has a different bet reference.

I added further code to capture changes to stake figure when showing as F. This has worked well so far.