Timing - my theory

Advanced automation available in Guardian - Chat with others and share files here.
Post Reply
malky
Posts: 19
Joined: Mon Oct 12, 2009 11:09 am

One thing I have worked out with Automation is "timing is everything" - certainly everything if I want to minimise those nasty red numbers.

Here's my attempt at trying to understand how the timing of transactions of BetAngel trading on Betfair.
Please correct me if I'm wrong or if I have missed anything.

1. Rules run every refresh

2. The "wait X seconds before rearming" option - means the rules will only run on the first refresh after X seconds since the last run of the rules

3. When BetAngel submits a bet this occurs between 0ms and the refresh time. (it could be immediately or up to the refresh interval).

4. All bets in play are subject to a delay. This delay appears to be less than a second inplay on horse races and several seconds on soccer ? Can it be more ? Is there anyway of determining the absolute time delay, betfair as far as I can see does not publish this.

5. BetAngel can only detect an unmatched bet in a market at the next refresh. If the market is inplay it will be the refresh after following the the delay.

6. For the condition time since unmatched bets (U) needs to be greater than Refresh rate (R)

times 2, plus the inplay delay (D) (of course inplay delay = 0 if not inplay)
i.e. U>2R+D must be true to avoid the rule firing when a bet may be either unmatched or being posted to betfair

7. If the market is only in Guardian then the refresh rate must be multiplied by the number of markets Guardian is servicing.
The number of markets Guardian services can be reduced by use of Advance Setting > Restrict Refresh thereby reducing the time to refresh.

Feedback welcome
Bet Angel
Bet Angel
Bet Angel
Posts: 3999
Joined: Tue Apr 14, 2009 3:47 pm

malky wrote: 1. Rules run every refresh
Yes - everytime the prices of a market are refreshed (whether by the Bet Angel trading screen or Guardian) the rules are executed.
malky wrote: 2. The "wait X seconds before rearming" option - means the rules will only run on the first refresh after X seconds since the last run of the rules
Almost... let's say since the last 'trigger' of a rule. i.e. A rule can be processed on every refresh but not triggered due to the state of the conditions. Once triggered it won't be allowed to trigger again until the X seconds delay has expired.
malky wrote: 3. When BetAngel submits a bet this occurs between 0ms and the refresh time. (it could be immediately or up to the refresh interval).
It goes to betfair immediately, but the feedback to Bet Angel will be on the next refresh of bet information (governed by the refresh interval). If an inplay delay applies to the bet then that will need to expire at betfair before the bet shows up as matched or unmatched.
malky wrote: 4. All bets in play are subject to a delay. This delay appears to be less than a second inplay on horse races and several seconds on soccer ? Can it be more ? Is there anyway of determining the absolute time delay, betfair as far as I can see does not publish this.
The delay is one second for in-play horse racing and up to eight seconds for soccer/tennis.
malky wrote: 5. BetAngel can only detect an unmatched bet in a market at the next refresh. If the market is inplay it will be the refresh after following the the delay.
Correct
malky wrote: 6. For the condition time since unmatched bets (U) needs to be greater than Refresh rate (R)

times 2, plus the inplay delay (D) (of course inplay delay = 0 if not inplay)
i.e. U>2R+D must be true to avoid the rule firing when a bet may be either unmatched or being posted to betfair
Yes that sounds pretty reasonable. If your internet connection (or the betfair API) is less than perfect on a particular day, perhaps add another second or two for potential timeouts.
malky wrote: 7. If the market is only in Guardian then the refresh rate must be multiplied by the number of markets Guardian is servicing.
The number of markets Guardian services can be reduced by use of Advance Setting > Restrict Refresh thereby reducing the time to refresh.
Yes, each market will receive an update once every 'refresh rate * number of active markets' seconds. And yes the number of active markets will be reduced by using Restricted Refresh.

If you calculate that each market will receive an update every ten seconds, you should ensure that the time window specified in 'Rule Trigger Times' (difference between start and end times) is larger than ten seconds, otherwise a rule may not execute at all.
malky
Posts: 19
Joined: Mon Oct 12, 2009 11:09 am

thanks - very helpful
Zenyatta
Posts: 1143
Joined: Thu Mar 11, 2010 4:17 pm

Trouble with automation, even it it works as expected 99 out of 100 times, the 1 time something happens you didn't expect can wipe out your bank if you are not there monitoring it. Here are just a few of the more obvious things that can go wrong:

(1) Your computer can crash/lose power/lose internet connection. Ideally,you need to use automation on a VPS with a constant high-speed internet connection.

(2) Betfair website can crash. The fail-safe is to immediately change the bet persistence of all unmatched bets to 'Take SP'

(3) The race can go off early. Same solution as above, use 'Take SP'

(4) The 'Take SP'solution won't always work because Betfair somtimes forget to change the market to 'In-Play'. Need perhaps to Green All at a fixed time relative to the event time.

(5) The automation commands occasionally won't work because of things such as suspended markets, missed bets, problems with account balances etc, etc. Need to make sure you fire the important ones ('Green All', 'Take SP') at least twice.

I hope these few examples show folks they need to be very very careful with the automation....
User avatar
fadamadrinha
Posts: 9
Joined: Sun Jul 11, 2010 1:48 pm
Location: Portugal

Great topic and information! ...Supose you are making a scalping rulethat fires to the market Back bets with offset active ...So the back bet was eated but the lay bet still waiting, then the Horse Race begins and your lay bet was cancelled and you got exposed to lose.

Is there any way to change that lay bet persistance to KEEP IN PLAY and have the probability to be eaten ?


Any help and feedback will be positive to all the automation fans!
User avatar
OnGoldWires
Posts: 49
Joined: Mon Jul 20, 2009 7:07 pm

Thanks Zenyatta, that is a good list of what can go wrong.

If I can add to it from my experience.

6) Event starts late and falls outside the scope of a restricted refresh.

7) Occasionally Inplay markets can be suspended for long periods for no apparent reason.

8) Lack of competition in the markets means the Book percentage conditions are not met.

Plus some that I haven't worked out yet.

I think it is always best to work out the worst case scenario if you are leaving you bets unattended and it might help to limit the liability in your account or put some of it out of harm's way (Australian Wallet or Bank Account - OR Lay Everton to win the league at 2.00 :lol: )
sarwanov
Posts: 2
Joined: Mon May 11, 2015 8:43 am

you really have done great work.well done
User avatar
Frogmella
Posts: 220
Joined: Mon May 30, 2011 2:44 pm
Location: Towcester

Does this thread still apply now we are streaming?
User avatar
Dallas
Posts: 22673
Joined: Sun Aug 09, 2015 10:57 pm
Location: Working From Home

Frogmella wrote:Does this thread still apply now we are streaming?
Yes its all still applicable just you can get market info upto 10 times faster now
mcmwh
Posts: 14
Joined: Thu Sep 05, 2019 9:19 pm

Apologies for the thread resurrection on my first post! I have another question on timing.

I have a rule that is supposed to fire exactly 10 mins after the event goes in-play.

After checking the log file I am finding that very occasionally the rule is firing on the next refresh after the 10minute mark.
so for example
09:00:00 inplay
09:09:45 set signal value = 1
09:10:00 set signal value = 2
09:10:15 set signal value = 3
09:10:15 rule that should have fired at 10 mins now grabs signal value = 3 instead of signal value = 2.

My hunch is that BetAngel is measuring times and firing rules down to the millisecond, and the log file shows times down to the second. Am I correct or am I missing something?
User avatar
Dallas
Posts: 22673
Joined: Sun Aug 09, 2015 10:57 pm
Location: Working From Home

mcmwh wrote:
Mon Mar 15, 2021 7:43 pm
Apologies for the thread resurrection on my first post! I have another question on timing.

I have a rule that is supposed to fire exactly 10 mins after the event goes in-play.

After checking the log file I am finding that very occasionally the rule is firing on the next refresh after the 10minute mark.
so for example
09:00:00 inplay
09:09:45 set signal value = 1
09:10:00 set signal value = 2
09:10:15 set signal value = 3
09:10:15 rule that should have fired at 10 mins now grabs signal value = 3 instead of signal value = 2.

My hunch is that BetAngel is measuring times and firing rules down to the millisecond, and the log file shows times down to the second. Am I correct or am I missing something?
That's correct

Whenever a market is refreshed all the rules in a automation file applied to it get checked and if they are armed and conditions met etc they will trigger, and a rule can trigger up to 50 times every second

But the log is only painted once every second, so if you incremented a signal every refresh (and where refreshing at 20ms) your log would show all 50 increments at the same time, or possibly split across two seconds after rounding
Post Reply

Return to “Bet Angel - Automation”