Code help

Please post any questions regarding the program here.

Moderator: 2020vision

Code help

Postby Smokin Joe » Sat Oct 11, 2008 4:07 pm

Using an excel trigger a bet is placed.

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.
Smokin Joe
 
Posts: 115
Joined: Sat May 31, 2008 6:25 am

Postby laffo16 » Mon Oct 13, 2008 2:36 am

imo, it depends how the your are running the timer in your code. you say the code initialy works for the first 5 minutes. so the first time stamp you take is what your comparing the current time to. so after the trigger has been fired, this timer needs to be updated to the current time so that it will need to wait a further 5 minutes before updating.

$time_stamp = 13:55
$current_time = 14:00
- bet is triggered
$time_stamp = $current_time (14:00)

hope this helps.
User avatar
laffo16
 
Posts: 172
Joined: Sun Jan 27, 2008 6:52 pm

Postby Smokin Joe » Mon Oct 13, 2008 7:15 am

laffo, not sure I follow.

The way the timer works at present is that I have a cell which counts (in seconds) the length of time since my bet was placed - and it works perfectly.

The problem I have is that I just want my UPDATE trigger to fire once after a set time (5 minutes), at the moment it fires continuously as my code simply states if time > 5 minutes then UPDATE.

Is there any way to get it fire just one UPDATE?
Smokin Joe
 
Posts: 115
Joined: Sat May 31, 2008 6:25 am

Postby Smokin Joe » Mon Oct 13, 2008 7:16 am

Another thought, is there a way to count the UPDATEs fired and stop once Count = 1, would that be another potential solution?
Smokin Joe
 
Posts: 115
Joined: Sat May 31, 2008 6:25 am

Postby Ian » Mon Oct 13, 2008 8:05 am

Couldn't you just have a switch which you set at FALSE initially, test it is FALSE in your code and set it to TRUE when your update is triggered.
Ian
 
Posts: 834
Joined: Sat Nov 19, 2005 8:35 am
Location: Birmingham

Postby laffo16 » Mon Oct 13, 2008 9:06 am

using the TRUE / FALSE or 1 / 0, its basicly the same output. so you want to stick in a "Write to Cell AA: 1" after the first UPDATE, and include and add an "IF" at the begining of your UPDATE bet to check this cell is 0. are you using VBA?
User avatar
laffo16
 
Posts: 172
Joined: Sun Jan 27, 2008 6:52 pm

Postby Smokin Joe » Mon Oct 13, 2008 1:59 pm

Ian / Laffo, thanks for your comments.

What you are suggesting dawned on me as soon as I typed my reply this morning.

I am using VBA and already use 2 or 3 IF conditions before the UPDATE fires, so it'll not be difficult to add another one.

:oops:

Thanks
Smokin Joe
 
Posts: 115
Joined: Sat May 31, 2008 6:25 am


Return to Help

Who is online

Users browsing this forum: No registered users and 42 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.