SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sun Aug 18, 2019 6:50 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Fri Oct 10, 2014 4:15 pm 
Offline

Joined: Thu Sep 18, 2014 5:32 pm
Posts: 28
Hi -

I would like to check the price sometimes in a time frame lower than 1 sec, which is the lowest resolution bar in OQ 2013.

Even in the overnight, sometimes a price will go without update for several minutes.

For these reasons I have used a recursive call to Timer;

I create a custom timestamp variable which is unique to each date and time. It is also monotonically increasing.


public override void OnTimer(DateTime datetime, Object data)
{

currentTimeStamp = (ulong) (100000000 * (ulong) ( Clock.Now.Year*10000 + Clock.Now.Month*100 + Clock.Now.Day ) + (ulong) (1000 * (Clock.Now.Hour * 3600 + Clock.Now.Minute * 60 + Clock.Now.Second) + Clock.Now.Millisecond) );

if ( currentTimeStamp/1000 >= 1 + last1SecTimeStamp/1000 ) {
//Call event handler to handle precision time update event
onBar1sec( currentTimeStamp );
last1SecTimeStamp = currentTimeStamp;
}

//Console.WriteLine( datetime.ToString() + datetime.Millisecond );
AddTimer(Clock.Now.AddMilliseconds(25));

}


My question here is am I destroying OQ 2013 runtime performance by launching and destroying a timer thread without a thread pool here?

Is there a better way to do this?

Thanks
Peek


Top
 Profile  
 
PostPosted: Fri Oct 10, 2014 6:58 pm 
Offline
Site Admin

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

OQ built-in timer has a resolution of one second. So, you will never get a callback more often than one second.
But, why do you need a timer to check prices rather than use OnTrade callback which is called on every price change?

_________________
SmartQuant Development Team


Top
 Profile  
 
PostPosted: Mon Oct 13, 2014 10:21 pm 
Offline

Joined: Thu Sep 18, 2014 5:32 pm
Posts: 28
Hi,

This is needed to
1) Make a decision in a time frame lower than 1 second.
2) There can be no price trade or book event for more than 1 second.

Therefore a timer is needed.

Peek


Top
 Profile  
 
PostPosted: Mon Oct 13, 2014 10:57 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6816
OQ2014 ?

Regards,
Anton


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 2 guests


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