by Barb » Wed Dec 22, 2021 5:56 am
I bet on wins and places in gallops. I use triggered Excel with VBA code. I just had a result that should have returned a small profit, but there was a problem. Betfair took an inordinately long time to settle the bets and I know from experience that that's usually a sign that there's grief to follow. Sure enough, I found that place bets had been placed in the next race, which I did not bet on. It was not a mistake at Betfair's end, because I saw the stakes and matches in my spreadsheet and they appear in the BA diagnostic log. The relative positions of the horses in the runner list in the second race - the ones I did not knowingly bet on - were exactly the same as the relative positions of the horses in the runner list of the first race - the ones I did bet on. This can mean only one thing: the BACK-SP triggers were not deleted from the spreadsheet. However, it should be noted that that occurred only in the worksheet in which I do place bets and not the sheet in which I do win bets. Of note are the following:
- as I mentioned, Betfair's settling of the bets took a long time;
- there was a late scratching, just before off;
- I have 'clear bet refs on auto select markets' turned on in the Excel options - maybe it is best to turn this off, because, obviously, the triggers will fire again if, for some reason, they are not deleted (see code below);
- the races were seven minutes apart and I load the new market at 25 secs before off, so there is no chance that triggers for one market fired as another market was loading;
- at the start of the worksheet.change event I run this code:
Application.EnableEvents = False
If Target.Columns.Count = 16 Then
' get the market ID
sNewMarket = wsWinWorksheet.Cells(3, 14).Value
' clear the sheet when a new market loads
If sNewMarket <> sOldMarket Then
With wsWinWorksheet
' clear the trigger column
.Range("q5", "q22").ClearContents
wsPlaceWorksheet.Range("q5", "q22").ClearContents
' clear the stake column
.Range("s5", "s22").ClearContents
wsPlaceWorksheet.Range("s5", "s22").ClearContents
' clear the bet ref column
.Range("t5", "t22").ClearContents
wsPlaceWorksheet.Range("t5", "t22").ClearContents
' clear the bet time column
.Range("u5", "u22").ClearContents
wsPlaceWorksheet.Range("u5", "u22").ClearContents
sRaceDetails = .Cells(1, 1).Value
End With
As you can see from the code, the win and place sheets are cleared at exactly the same time and in the same piece of code, but in this one instance the place sheet did not clear, which would seem to be impossible! This error does not seem to be related to BA, unless BA in some way prevented the sheet from being cleared or undid the deletion of the triggers by my code. I should stress that it has never happened before - as far as I am aware.
I've sent the diagnostic log to admin@ and I would appreciate any thoughts you might have.
Thanks.