SmartQuant Discussion

Support of Ordertypes (IB)
Page 1 of 1

Author:  lantama [ Thu Sep 25, 2008 12:49 pm ]
Post subject:  Support of Ordertypes (IB)

Hi there,
this seems to be a very powerful platform to handle our trading approach. Anyway the execution is crucial and we need MOC and TIF Order types. As I was reading the Documentation I was wondering if that kind of order aren't supported (yet)?

Many thanks

Author:  Alexei Kurov [ Thu Sep 25, 2008 7:34 pm ]
Post subject: 


What is the TIF order type?
We can add support for MOC order type next week.


Author:  lantama [ Fri Sep 26, 2008 1:37 pm ]
Post subject: 


MOC would help many users to exit without slippage end of day.

TIF is time in force. IB says GTD. Means you cancel an order after a specific date/time automaticely.

Also helpful for Autotrading is GAT. Good after Time.

I will recheck to see if MOC has been added.

Thanks for your support.

Author:  Wacka [ Fri Jan 02, 2009 5:19 pm ]
Post subject: 

Has MOC (or any other order types) been added? I really need to be able to do the MOC, for the reasons stated above (reducing slippage). I don't see MOC in the API guide yet (for whatever that's worth) and I don't see it as available in the tooltips when trying to see what order types are out there, though, of course, I just guessing. Is there a ETA for when this new order type will actually be added? :?:

Author:  Wacka [ Tue Jan 06, 2009 6:54 am ]
Post subject: 

The most current API documentation that I have for the "TimeInForce" enumeration lists the following members:
    Member Name -- Description
    Day -- Day
    GTC -- Good Till Cancel
    OPG -- At the Opening
    IOC -- Immediate or Cancel
    FOK -- Fill or Kill
    GTX -- Good Till Crossing
    GTD -- Good Till Date
    ATC -- At the Close

If I understand the usage of TimeInForce correctly, it indicates how long the order can remain open before being either filled or cancelled. So if I use TimeInForce.ATC, then my order must be executed by the close or not be executed at all.

That doesn't meet the need being discussed here, however. What lantama and I have asked about would be an order type of market-on-close - meaning that the order would only be executed at the close. This flows directly into Interactive Broker's market-on-close order type. Is this something in the works for OpenQuant? I sure need to be, otherwise I'll likely have to jump ship with my strategy/ies and find some other solution :evil:

Author:  Alexei Kurov [ Sun Jan 11, 2009 5:08 pm ]
Post subject: 


Sorry for the long time reply - we had holidays upto 10-Jan.

The support of MOC order type has not been added to the latest version of OQ, because we cannot determine order status correctly - TWS does not send information is order ok or not. In other words, such orders always(to the end of trading session) will have PendingNew state, and you are not able to cancel their.
Also, IB does not support TimeInForce.AtTheClose. Only DAY, GTC, GTD, OPG and IOC values are allowed.


Author:  Wacka [ Tue Jan 13, 2009 8:48 pm ]
Post subject: 

That's good to know about the ATC TimeInForce -- thank you.
I'm not too concerned that you cannot cancel a MOC order, since I would never need to, given that it's solely time based (if you consider the close a certain time). IB won't report back anything once the order has been filled?

Author:  Alexei Kurov [ Wed Jan 14, 2009 5:13 pm ]
Post subject: 


Ok, we have added MOC order type(will be included in the next version).
But there are some limitations:
1. Only IB supports such orders.
2. Since TWS does not inform us about the status of such orders(except Rejected), the order will have PendingNew state until it executed.
3. You are able to cancel the order only, but not replace it(f.ex. switch order type to market or limit).


Author:  Wacka [ Thu Jan 15, 2009 5:36 am ]
Post subject: 

That is wonderful news! I (and I'm sure many others) are very much appreciative. :D

Any word on an ETA for that next release?

Author:  Alexei Kurov [ Thu Jan 15, 2009 12:15 pm ]
Post subject: 

I hope this or next week.

Author:  zouy2000 [ Sat Jul 25, 2009 8:54 am ]
Post subject: 

Hi Alex,

It's wonderful to know that you can add useful new features at customer's request. Here I recommend a useful order type -- Relative Order

OQ's competitor --Amibroker support this order type. see

Relative (a.k.a. Pegged-to-Primary) orders provide a means for traders to seek a more aggressive price than the National Best Bid and Offer (NBBO). By acting as liquidity providers, and placing more aggressive bids and offers than the current best bids and offers, traders increase their odds of filling their order. Quotes are automatically adjusted as the markets move, to remain aggressive. For a buy order, your bid is pegged to the NBB by a more aggressive offset, and if the NBB moves up, your bid will also move up. If the NBB moves down, there will be no adjustment because your bid will become even more aggressive and execute. For sales, your offer is pegged to the NBO by a more aggressive offset, and if the NBO moves down, your offer will also move down. If the NBO moves up, there will be no adjustment because your offer will become more aggressive and execute. In addition to the offset, you can define an absolute cap, which works like a limit price, and will prevent your order from being executed above or below a specified level.

You can view it a specialized limit order with parameter(offset), I don't think it change OQ's current code structure much.


BTW, I really like openquant's event-driven mechanism to code reliable trading strategies, but frankly it is a little weak on provider interface. I always use relative orders in my trading and had better fills. I even thought of writing my own IB API modeling Openquant's structure because of this. Hopefully you guys can see its usefulness and add it.

Many thanks in advance!

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group