SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Tue Oct 16, 2018 1:34 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Expiring futures
PostPosted: Fri Sep 25, 2009 9:40 am 
Offline

Joined: Mon Mar 09, 2009 3:49 pm
Posts: 42
First let me clarify, yes, I searched the forum for messages related to rollovers!!!!!!!!!!!!!!
Second, many of the messages lead to following message anyway:
"the topic or post you requested does not exist"

Anton, I've paid over 700$ for that software and I believe, that I deserve just a little attention. So, thanks for that.

So again my question:

I'm planning to start papertrade in near future with interactive broker. As I'm trading 50 markets (only futures) one issue of course is very important: futures rollovers.

I have built historic data based on continous contract data where the switch happened when open interest became large in the back month.
I'm not using any feed for the time being, however once trading start I will be getting data from IB.

So my question is, how can I change the symbol on an existing instrument (that would be manual switch from front to back month). Would I then have to buy/sell, sell/buy resp. to process rollovers?

Anybody experienced with this issue. I guess I'm not the only one facing this problem...

Any comments appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 25, 2009 10:18 am 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6808
You can not have two instruments with the same name, so first of all you should set up several instruments with different expiration dates. Then you subscribe for all these instruments in your strategy and then you sell / buy corresponding contracts at the expiration. I guess this is the only way to do a kind of automatic rollover in OQ, though I think that in practice people sell at the expiration, shut down strategy and start it with a new contract.

Regards,
Anton


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 26, 2009 3:10 am 
Offline

Joined: Thu Jun 08, 2006 3:56 pm
Posts: 537
Location: BC Canada
Maybe I'm missing something, but if I subscribe to multiple instruments in my strategies, OQ creates a new instance for each instrument, so there is no need to rollover anything. When the simulation date reaches the start of some data, the instance for that contract does trading. When an instance runs out of data to process for a contract month, that strategy instance just stops (OnStrategyStop). So I always see one set of strategy stats (printed by OnStrategyStop) for each instrument in the instrument list.

On the other hand, if you have constructed a continuous contract for an instrument, it only has one name in OQ, and so it would trade without rollovers.

Am I missing something?


Top
 Profile  
 
 Post subject: Rollovers
PostPosted: Mon Sep 28, 2009 6:39 pm 
Offline

Joined: Mon Mar 09, 2009 3:49 pm
Posts: 42
Hi, that's the point. My strategy involves various speeds, including long term trendfollowing approach. That's why I need continous contracts (switches when open interest gets higher then the back month). As the system therefore hold an "invalid" symbol (e.g. SPc1 instead of SPZ9) I need some sort of rollover mechansim and I'm not sure yet, how I should do the trading anyway. Most likely I will have to manipulate the Symbol in the Access database behind OpenQuant. Really no idea...
Therefore, any suggestions most welcome.
One idea I'm thinking of is having on symbol where the strategy is running, and 2 running symbol where trading would be affected.
E.g. Strategy instrument is SPc1 (continous), SPZ9 and SPH0. Programmtically I would then have to to the rollovers and trading long or short positions.
Regards
Bill


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 28, 2009 10:23 pm 
Offline

Joined: Thu Jun 08, 2006 3:56 pm
Posts: 537
Location: BC Canada
I see what you mean about using a continuous contract for indicators, but having to trade on a real live contract.

But I'm thinking that my point still holds--there is really no concept of rollovers in OQ (nor should there be). Each instrument (contract) gets its own strategy instance that starts and stops based on the contract data start and end datetimes. So you can't really "rollover" in any tangible way, even if you wanted to.

What you _can_ do is tell which one of your strategy instances (front or back month(s)) should do the real trading. You'll have to disable trading for all those instances that should not trade, and enable the instance that should trade.

All this can be done with flags in the Global (shared) data space that is accessible to all strategy projects. So when your continuous indicator says "more open interest in the back month December", then your code must clear all the EnableTrading flags in all instances except the one trading the December contract. And the flag for that contract should say "true".

Here's an url that shows how to store/retrieve info from the global space.
http://www.smartquant.com/forums/viewtopic.php?t=7366


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

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