SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sun Dec 15, 2019 1:32 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Thu May 10, 2007 6:00 pm 
Offline

Joined: Sun Apr 08, 2007 10:41 pm
Posts: 90
Location: Denver, CO
This morning I had to restart SQ after having two active trades with IB. Of course the strategy didn’t know about the trades that had been previously started. Is there a way to enter in-progress trades into the strategy so it can pick up where it left off? I would like to be able to see the charts showing the time the stock was bought and at what price, etc. Then my internal state flags could be set to be accurate. Obviously I would want to be able to reenter the trade info WITHOUT executing the trade again.

Gary


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 10, 2007 7:02 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6816
You can navigate to Tools->Options and then set Persistent to true for Live mode. Then your orders and execution reports (as well as portfolio transactions) will be stored in the database and reloaded next time you run OQ.

Regards,
Anton


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 10, 2007 8:15 pm 
Offline

Joined: Sun Apr 08, 2007 10:41 pm
Posts: 90
Location: Denver, CO
I double checked and I did have live mode set to Persist. But I see no affect from this setting. If I restart SQ and my strategy, how can I get back to the trades that were in progress? I am using OCA so there will be a stop-loss and profit-limit order “queued.�

I have my own log which I built into the strategy to document to a file the trade activity with timestamps. I guess I would want to somehow reissue these to the strategy WITHOUT them being sent for a second time to IB.

Hope that makes sense,

Gary


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 11, 2007 11:59 am 
Offline

Joined: Sun May 20, 2007 9:09 am
Posts: 351
It is neccessary to have a clear documentation on what this Persistent does. These two days, every time I start to run my strategy, I get some orders filled. At first I don't know where these orders come from, later I guessed they might be sent out by the Persistent function.

Exactly what does Persistent do I have still no idea.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 06, 2008 6:37 am 
Offline

Joined: Fri Apr 04, 2008 6:11 am
Posts: 138
TickJob -- Do you preload data in your strategy?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 01, 2009 12:15 am 
Offline

Joined: Sat Sep 26, 2009 12:08 am
Posts: 62
Location: Ireland
Did anyone ever get a clear answer about what Persistent does? I have often wondered....


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 01, 2009 7:52 pm 
Offline

Joined: Thu Jun 08, 2006 3:56 pm
Posts: 537
Location: BC Canada
This is not a definitive answer, but it will probably help. The persistent flag helps OQ to reload the _state_ of the strategy positions, by (I think) reprocessing the original transactions much like a database does during rollback operations.

In a typical scenario, the strategy is not saving real time trades/bars either, so there is no way for OQ to display the original trade orders on the chart, because the chart starts fresh again on real time data at reboot time. (If you save trade/bar data during the run, and then preload all that same data on a new OQ reboot, maybe the original Persistent orders will be visible on the chart, I don't know because I've never done that.)

So after you reboot OQ after a crash/loss of communication, the strategy thinks it has a bunch of open positions. It will try to close them according to strategy rules, which is why you can suddenly see "weird" orders and positions show up after the reboot.

For example, the sequence I always fell into was: (1) strategy runs and opens a position, (2) loss of comm with TWS, (3) I would get scared and manually close out my TWS broker positions, (4) then I would reboot OQ (which under Persistent would pick up the open positions internally--but of course I had manually closed them at the broker, so OQ was out of step with reality, (5) OQ would close the positions according to my strategy rules, and by "closing" them internally, it would actually open them at the broker, (6) I would close them at the broker, and now the broker and OQ were back in sync.

I found the Persistent flag more trouble than it was worth, so I disable it now. For me, it's far easier and less stressful to just manually close the broker positions and start fresh again with a new OQ reboot. Trying to write code to get OQ and the broker back in sync after a random communication event is too much work and hassle for me, with all the problems of having to be sure that all the recovery code works perfectly.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 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:  
Powered by phpBB® Forum Software © phpBB Group