SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Mon Sep 23, 2019 2:23 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Thu Jun 07, 2012 5:12 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 257
Dear Team,

I am running OQ 2.9.13. And TWS: 926.5

I have been using OQ and TWS for a few year now, but now with the latest build, IB seemed to have changed something for FA account order placement.

If I place this for any given US stock:
Order Test = MarketOrder(Instrument, OrderSide.Sell, 1);
Test.IB.FaGroup = "All"; //oder "All" for all the FA accounts
Test.IB.FaMethod = IBFaMethod.PctChange;
Test.IB.FaPercentage = -100;
Test.Send();

I get an IB error stating: "Invalid percentage" - with error code: 10012.
I then contacted IB and send them my TWS logs, and they claimed, I should try submitting the order without a size information. "Please leave out the Quantity value, when using FaMethod = PctChange the number of shares being closed out would be based on the FAPercenatage value. ". I believe OQ does not allow for this behavior.

Can you please look into this or let me know, what I should consider changing?

Regards
Mike


Top
 Profile  
 
PostPosted: Thu Jun 07, 2012 5:28 pm 
Offline
Site Admin

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

did you try to set order's quantity to zero?

_________________
SmartQuant Development Team


Top
 Profile  
 
PostPosted: Thu Jun 07, 2012 6:06 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 257
yes, I tried that already. And it passes that information right through TWS and then I was not even able to Preview the order with an order ticket, since TWS said, order has 0 position size.

Regards
Mike


Top
 Profile  
 
PostPosted: Thu Jun 07, 2012 8:30 pm 
Offline
Site Admin

Joined: Thu Jul 17, 2003 10:39 am
Posts: 1478
Sorry, Mike, it was a bad idea to do that.
I will check the issue tomorrow

_________________
SmartQuant Development Team


Top
 Profile  
 
PostPosted: Fri Jun 08, 2012 3:01 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 257
Hi Alexei,

did you have time to check into this?

Regards
Michael


Top
 Profile  
 
PostPosted: Fri Jun 08, 2012 3:08 pm 
Offline
Site Admin

Joined: Thu Jul 17, 2003 10:39 am
Posts: 1478
Hi Mike, not yet. I will inform you about results

_________________
SmartQuant Development Team


Top
 Profile  
 
PostPosted: Thu Jun 14, 2012 1:06 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 257
found the solution - you need to provide a 0 as the order size. and once the order is send, you can still change the Qty value as desired, so that you have something to track in OQ....

Order Test = MarketOrder(Instrument, OrderSide.Sell, 0); //< --- instead of giving an orders size set to 0
Test.IB.FaGroup = "All"; //oder "All" for all the FA accounts
Test.IB.FaMethod = IBFaMethod.PctChange;
Test.IB.FaPercentage = -100;
Test.Send();
Test.Qty = 100 //you can still change the Qty value as desired, so that you have something to track in OQ....

This change needs to be implemented since TWS 926.5


Top
 Profile  
 
PostPosted: Sun Jul 07, 2013 4:26 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 257
Dear all,

one issue you will face with this setup, is that if you receive partial fills for your order placed like above, is that you will end up with a negative quantity for the order:
Test.LeavesQty

Since, Test.LeavesQty is still at 0 after OQ placed the order. And when you get a partial fill, this quantity is subtracted(in above case since it is a sell example) from Test.LeavesQty, and then goes negative.
This is a bug and there is no way around it so far, since OQ only allows read only access to Test.LeavesQty. And actually, you would need to set it to the same as Test.Qty to avoid the issue. This bug becomes an issue, when you want to check how much of the order is filled. This is not so an issue for above market order, but it is for Limit orders.

I hope you can come up with a solution to fix this problem.


Top
 Profile  
 
PostPosted: Mon Jul 08, 2013 10:05 am 
Offline
Site Admin

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

By setting Test.Qty = 100 you do not change order quantity directly.
This possibility (setter of Qty property) allows you to set new value of Qty property
when you replace an order.
Code:
Test.Qty = 100;
Test.Replace();

_________________
SmartQuant Development Team


Top
 Profile  
 
PostPosted: Tue Jul 09, 2013 1:22 am 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 257
ok, but if I would place the replacing order, then this order will be send to IB with the quanity != 0 and that would throw an error message (see my description above when posting with an qty > 0)

Or are you imlpying, I then should just ignore that error message since IB will have ignored the replacing of that order - but then - if I get a rejection in the replace of that order, OQ will not update the Qty, will it?

Thanks
Mike


Top
 Profile  
 
PostPosted: Tue Jul 09, 2013 11:23 am 
Offline
Site Admin

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

I cannot reproduce the situation on my PC - IB rejects an order with "Order size cannot be zero" message.

_________________
SmartQuant Development Team


Top
 Profile  
 
PostPosted: Tue Jul 09, 2013 6:09 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 257
That is strange. Which version of TWS did you test that with? I am using:
Build 926.6, Jun 11, 2012

So, you have tested with the full demo code which I posted above?
Sorry to ask, but you also have an FA account, correct?

Thanks
Mike


Top
 Profile  
 
PostPosted: Wed Jul 10, 2013 10:06 am 
Offline
Site Admin

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

I have TWS version 939.2 - the latest build on May or June 2013
I'm using fdemo login for testing (free FA account)

_________________
SmartQuant Development Team


Top
 Profile  
 
PostPosted: Wed Aug 07, 2013 6:02 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 257
HI, I have just upgraded my TWS to the one being build: 26.Jul 2013

And when I place my order, with
Test.Qty = 100;
before sending it, as above, then I get this error message:
"10012: Provider Error from: IB - Details: Invalid percentage" and the order does not get placed.

Any idea how we can debug this situation? What can I provide you that would help you?

Regards
Mike


Top
 Profile  
 
PostPosted: Thu Aug 08, 2013 10:20 am 
Offline
Site Admin

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

I'm able to send such order, but get another error:
"Percent Change orders must have size or percent change but not both".

_________________
SmartQuant Development Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  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