SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Wed Dec 13, 2017 6:40 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Thu Aug 13, 2015 11:11 am 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 352
Hi,

Writing a new custom provider I faced the problem that in order to enter a short position I need to specify SHORT to the broker. The OQ allows only Buy and Sell. So my question is - how the custom provider can understand that the Sell in fact means Short? One of the ways would be to check a position for the instrument and if no position exists then treat Sell ans Short. But it seems like there is no access from the provider to Portfolio nor Position.

Any ideas?

Ed


Top
 Profile  
 
PostPosted: Thu Aug 13, 2015 5:34 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6783
Hi,

I think you can use Order.Fileds ObjectTable to pass any information to the broker along with the order.

Regards,
Anton


Top
 Profile  
 
PostPosted: Thu Aug 13, 2015 5:35 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6783
By the way are you working with OQ or OQ2014?

Regards,
Anton


Top
 Profile  
 
PostPosted: Thu Aug 13, 2015 6:01 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 352
Ok,

I thought there is some way to access Portfolio from UserProvider. I thought that the need to set Short is required by many brokers. Up to now we have created 5 providers to different brokers and 3 of them required Short. We pass the needed info in the order as you suggested. Just thought there is a more elegant way I missed.

It is OQ.

E


Top
 Profile  
 
PostPosted: Thu Aug 13, 2015 6:17 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6783
I don't really think it's a good idea to check some position in the provider. Not even sure what portfolio you can refer to since you can have long position in one subportfolio (Order strategy portfolio, Order.Portfolio) and short in the other and resulting can be either short or long, so what portfolio would you take then?

Usually it's the broker who does just this. He checks your global account position and then treats your order as sell or sell short or even as two orders (reverse from long to short). I guess if your broker requires to pass exactly sell or sell short, your strategy should decide what order it's sending?

Otherwise I think you can access Order.Portfolio in the provider and then check order instrument position in this portfolio.

Regards,
Anton


Top
 Profile  
 
PostPosted: Thu Aug 13, 2015 7:07 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 352
In general I agree with you. Unfortunately most of the brokers are not so flexible as IB. My experience with more than 10 brokers shows that majority of them demand Short to be specified. From 5 providers we implemented only 2 of them were ok with Sell for short. And I'm talking about major brokers such as Sterling, RealTick (not to mention smaller ones). Of course in this situation it is up to the strategy to decide but most of our strategies and that is what we do by putting the words "Enter Short", "Exit Short" etc. in the Text field of the order. I just thought if there is a better way somebody might come across.

probably not. Thanks a lot.

best regards
e


Top
 Profile  
 
PostPosted: Thu Aug 13, 2015 7:25 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6783
Well, if you want to make it a kind of semiautomatic in OQ2014 world, I would say you can get to the root strategy portfolio using portfolio.Parent and then check instrument position in this global portfolio. But again there is no guarantee that it's synchronized with the broker account.

On the other hand I know that many brokers require sell short, we have this situation with Chinese brokers. But they also separate sell and sell short on the position level, so that you can have both long and short position in your portfolio and the broker doesn't sum up these positions. Then of course it's your strategy who decides what you want to do and what position you want to open / close with sell or sell short.

Our Chinese partners use OQ strategy trees to solve this and keep long buy/sell positions in one sub-startegy / portfolio and short sell short/buy cover in another.

Regards,
Anton


Top
 Profile  
 
PostPosted: Thu Aug 13, 2015 7:39 pm 
Offline

Joined: Mon Oct 04, 2010 5:13 pm
Posts: 352
Thanks. It's been a pleasure to hear from you as always during the last 7 (!) years :). Hope everything is well on your side. Keep in touch.
Ed


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

All times are UTC + 3 hours


Who is online

Users browsing this forum: Google [Bot] and 4 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