Greening up problem

Discussion regarding the spreadsheet functionality of Bet Angel.
Post Reply
Johnedale
Posts: 60
Joined: Sat Jul 21, 2018 10:28 pm

I’ve been using a modified version of the BA spreadsheet to automatically place bets pre race and then green up just before the off. My method for greening up at the moment is to put in one GREEN_ALL command 30 seconds before the off and then as a safeguard put in a second one at 15 seconds before and then a third at the scheduled start time. This normally works fine as long as my connection doesn’t fail, but yesterday in the 15.10 at Hamilton none of the commands succeeded and I was left with an unmatched back bet which lost, although luckily only minimum stakes. When I looked back later the Global Command cell had been set to GREEN_ALL but the Global Status cell was empty. It looks like the price was rising steeply for most of the last 30 seconds so I suspect that all the green up bets just got left behind as there were no issues with my connection and as far as I can see no issues with BF. One of the problems I’m having in trying to figure out how to stop this happening again is that I don’t fully understand what goes on when a green up command is made. Are the resulting bets fill or kill? What happens to any unmatched green up bets when a second green up instruction is made, or when the race goes in play? Thanks in advance for any advice.
Johnedale
Posts: 60
Joined: Sat Jul 21, 2018 10:28 pm

Don’t know if this will be of interest to anyone, or whether there are better ideas already out there, but thought I’d share a couple of methods I’ve found for dealing with this issue.

Method 1 :

My theory about why all three GREEN_ALL commands failed is that they were trying to place lay bets while the price was drifting, and none of the bets had time to be matched before the odds went up.

I’ve therefore replaced the first GREEN_ALL with VBA code that calculates the required lay stake using :

LayStake = (BackBetStake * BackBetOdds) / CurrentLayOdds

The code then places the lay bet at ten ticks above the current price. If the price has moved between the calculation being made and the bet being matched then the stake will no longer be the optimal amount, so there may be some loss of profit, although the remaining two GREEN_ALL commands should usually tidy things up to an extent.

Another issue I have had in the past with greening up is that if the connection is failing then multiple green up commands seem to get stuck in the pipeline and then, instead of being executed a few seconds apart, they all get executed simultaneously and all try to close the same position at once, resulting in too many lay bets.

To try to prevent this I monitor the connection before making each of the GREEN_ALL commands. This is done by calculating the number of seconds between the time value in the ‘Last Updated’ cell, (3, "C") and the system time.

Lag = DateDiff("s", tw.Worksheets(RaceNumber).Cells(3, "C"), Time)

The DateDiff function rounds up so if the connection is ok then the lag will be 1.

This is done once per second for the five seconds leading up to the GREEN_ALL command being made and the total lag is then calculated. If it’s greater than 7 then the GREEN_ALL isn’t issued.


Method 2:

This involves sending an email notification whenever the spreadsheet places a bet. To do this I use the VBA code from this article :

https://www.makeuseof.com/tag/send-emails-excel-vba/

The code is pretty straightforward to configure, although one thing the article doesn’t mention is that if you’re using gmail then you will need to go to your google account settings and, under the security tab, select the option to give access to less secure apps, otherwise google will prevent Excel from accessing the account.

I’ve set up a separate gmail account for this which I use as both the send and receive address. I have the gmail app on my iPhone and I find that I get a notification within a couple seconds of a bet being placed. I’ll then use the BF app just before start time to check that the position has been closed and if it hasn’t then I’ll cash out manually.
Post Reply

Return to “Bet Angel - Spreadsheet / Excel chat”