SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sun Nov 29, 2020 2:10 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 42 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: Mon Aug 18, 2008 7:54 pm 
Offline

Joined: Sat Aug 16, 2008 4:48 pm
Posts: 15
Location: Munich, Germany
Does this work backtesting as well?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 18, 2008 8:21 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
Yes, why not? The only thing you should remember is that during backtesting there is no continuous time axis and current time is defined by current market data time.

Regards,
Anton


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 14, 2010 8:23 pm 
Offline

Joined: Tue May 27, 2008 10:44 pm
Posts: 41
What if I wanted to use 2 different timers on the same instrument? For example, let's suppose I had 2 orders on the same instrument. What would I do if I wanted to cancel Order #1 after 10 seconds and Order #2 after 20 seconds (if they were not already filled)?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 14, 2010 8:34 pm 
Offline

Joined: Wed Sep 23, 2009 10:05 am
Posts: 66
Location: The Netherlands
Hi bfq3000,

OQ has one timer but you can (re)set this timer as much as you want. So in your case, fire the timer at 10s and (re)set the timer again with 10s (= 20s total).

With regards,
Rob.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 02, 2010 7:08 pm 
Offline

Joined: Mon Mar 05, 2007 7:02 am
Posts: 58
I use a lot of timers in my strategies to do processing of positions, orders, data cleaning, connectivity checks etc. The current timer functionality works for this but is a bit messy when there are multiple timers with different objectives.

Is there a way to do something similar to the code below? I'd basically like to overload OnTimer to take an ID or something similar so its easy to keep track of what the timer is used for.

Code:
    public override void OnTimer(DateTime dateTime, int TimerID)
    {     
        switch (myInt)
        {
            case 1:
                ResolveBadOrders();
                break;
            case 2:
                CheckReportingConnection();
                break;
            case 3:
                CompressBars();
                break;
            default:
                ResolveBadOrders();
                CheckReportingConnection();
                break;
        }
}


Thanks,
Eric


Top
 Profile  
 
PostPosted: Thu Sep 23, 2010 8:21 pm 
Offline

Joined: Wed Apr 27, 2005 4:41 pm
Posts: 609
Location: Helsinki, Finland
How can I cancel a timer before it fires?

Thanks,
Eelofi


Top
 Profile  
 
PostPosted: Fri Sep 24, 2010 10:36 am 
Offline
Site Admin

Joined: Thu Jul 17, 2003 10:39 am
Posts: 1478
Hi All,

You can cancel an existing timer by calling RemoveTimer(DateTime) method.
We can add an aditional parameter to AddTimer and OnTimer methods and they will look like:
AddTimer(DateTime, object)
OnTimer(DateTime, object)

Regards,
Alex

_________________
SmartQuant Development Team


Top
 Profile  
 
PostPosted: Thu Oct 21, 2010 12:38 pm 
Offline

Joined: Wed Apr 27, 2005 4:41 pm
Posts: 609
Location: Helsinki, Finland
Hi Alex,

is
Quote:
AddTimer(DateTime, object)
already available? (I'm still running a very old version of OQ, because it's working fine).

Regards,
Eelofi


Top
 Profile  
 
PostPosted: Thu Oct 21, 2010 12:47 pm 
Offline
Site Admin

Joined: Thu Jul 17, 2003 10:39 am
Posts: 1478
yes, this feature was introduced in version 2.9.10

_________________
SmartQuant Development Team


Top
 Profile  
 
PostPosted: Thu Oct 21, 2010 12:54 pm 
Offline

Joined: Wed Apr 27, 2005 4:41 pm
Posts: 609
Location: Helsinki, Finland
Cool! :D :D

Now I need to upgrade.


Top
 Profile  
 
PostPosted: Mon Jun 13, 2011 1:41 pm 
Offline

Joined: Thu Mar 10, 2011 10:09 pm
Posts: 582
Couple of questions:
1)Sorry for silly question, but I havn't got it completely.
What exactly should I pass as an object to AddTimer().
And how to check it in OnTimer?
Maybe you provide a two lines example code.

2) How to remove all timers ? Or to remove timer regardless of its DateTime parameter. I do not want to pass DateTime as an exact time for exact timer to RemoveTimers(DateTime).


Top
 Profile  
 
PostPosted: Tue Jun 14, 2011 10:50 am 
Offline
Site Admin

Joined: Thu Jul 17, 2003 10:39 am
Posts: 1478
1.
object is any object you want to get in OnTimer callback.
parameter, flag, etc.

2.
RemoveTimers(datetime) removes all timers at specified date/time
RemoveTimer(datetime, object) removes a timer which matches to specified argument(object)
RemoveTimer(datetime) equals to RemoveTimer(datetime, null) - timer with no argument specified.

_________________
SmartQuant Development Team


Top
 Profile  
 
PostPosted: Tue Jun 14, 2011 11:52 am 
Offline

Joined: Thu Mar 10, 2011 10:09 pm
Posts: 582
Quote:
RemoveTimers(datetime) removes all timers at specified date/time

Sorry, still not completely clear.
What this "specified date/time" means ?
E.g. if I have

1. AddTimer(10:30);
2. AddTimer(10:45, obj1);
3. AddTimer(10:50, obj2);

4. AddTimer(11:00);
5. AddTimer(11:00, obj1);
6. AddTimer(11:10, obj2);

And then I do
RemoveTimers(11:00)
Could you write which timers will still persist ?

And for this one would be nice also: RemoveTimers(11:00, obj1)


Top
 Profile  
 
PostPosted: Tue Jun 14, 2011 12:03 pm 
Offline
Site Admin

Joined: Thu Jul 17, 2003 10:39 am
Posts: 1478
RemoveTimers(11:00) removes (11:00), (11:00, obj1), (11:00, obj2) - all timers at 11:00
RemoveTimer(11:00) removes (11:00) only
RemoveTimer(11:00, obj1) removes (11:00, obj1) only

_________________
SmartQuant Development Team


Top
 Profile  
 
PostPosted: Tue Jun 14, 2011 12:14 pm 
Offline

Joined: Thu Mar 10, 2011 10:09 pm
Posts: 582
I would expect some function which deletes really all timers including
1. AddTimer(10:30);
2. AddTimer(10:45, obj1);
3. AddTimer(10:50, obj2);

but not only ones set to 11:00.

Or as an alternative I need some array of Existing timers or possibilyty to get referrence to timer when creating it. E.g. myTimer= AddTimer(10:30);

Otherwise it looks really dengerous - it fact we have many timers in background and no direct access to them.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 42 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group