Using an If command I check if the following 2 conditions are met and if they are then an UPDATE trigger is fired at the now available odds:
- Bet placed more than 5 minutes ago
I have some unmatched stake
My code for the above works fine, but one down side to it is that once 5 minutes have elapsed it continually UPDATES until my entire stake is matched - this stands to reason based on the way I coded it.
The problem with this is that if my stake is fairly big compared to the market I can very quickly go down through the odds, ie 1.95 then 1.94 then 1.93 etc........
One solution I have thought of is that (as I am running a 15 second refresh) that I add in another condition for the UPDATE trigger to fire, so I now have 3 conditions to be met:
- Bet placed more than 5 minutes ago but less than 5 minutes and 20 seconds ago
I have some unmatched stake
My reason for adding the extra condition in, ie less than 5 mins 20 seconds, is that as I am running a 15 second refresh I thought this would enable the UPDATE trigger to fire once and once only.
This would then give my new bet time to be matched rather than just blazing down through all the available odds.
Unfortunately, it didn't work as I thought it would. My initial bet was placed at 1.95, the Update trigger fired at 5 mins and placed a bet at 1.94, however immediately another UPDATE was fired so that the balance of my stake was matched at 1.93.
Anyone got a solution for what I am trying to do? Perhaps I am going about it entirely the wrong way - it should be fairly simple to do (I would have thought).
Thanks in advance.