FOK and IOC orders


So finally I found a clue about how to get better/faster orders. In this thread, Nab talks about about 93% fill rate when he uses FOK/IOC LMT through Interactive Brokers.

From IB's description in this page,  they are saying that partial fill comes with this feature! This makes it even better because now you don't have to track the volume, or handle workflow and all kinds of logics to track orders etc. - instead you can simply submit orders at full capacity and let the broker fill it at the highest possible number of shares and cancel the rest.


Now my question is, is there any way in LEAN to place an order with Fill-Or-Kill and/or Immediate-Or-Cancel?


Update Backtest

My guess is Lean currently does not support FOK/IOC, but I could be wrong. Best to make a feature request.

I'm confused by that thread, as I thought MKT orders had higher priority than LMT orders, but apparently that is incorrect?

Musings on FOK: obviously the latency is going to be lower if there's no requirement for the broker to fill the order with the specified volume. I imagine this can be a good thing to reduce slippage between order and its execution (particularly if your alpha comes from price movements shortly afterwards). On the other hand, to guarantee closing a position as opposed to entering it, you obviously need a 100% fill and FOK is inappropriate.


Good point Petter. I came to the same conclusion that for closing the holdings we have to send a relatively more liberal order at the market price AND unlimited time to fill.

"I'm confused by that thread, as I thought MKT orders had higher priority than LMT orders, but apparently that is incorrect?"

Are you referring to the first thread? I did not get that impression from the discussions, though. I think you are right, market orders should be preferred for any system for obvious reasons.

To make feature request I have to do it in github?



- I'm referring to this:

I remember reading about it in detail few years back when I realized that market orders do not have highest priority and this applies mostly to fast moving markets when most market orders will be executed with delay usually at the local top or bottom price range.

Then I found out that limit order with price higher/lower than current bid/ask - meaning it is crossing NBBO should be execute faster based on price priority.

- Yeah ticket in GH, they might not reply but at least it's recorded for posterity.


hmm... for some reasons I totally missed that. But how valid is that claim though? we really need an experienced trader in our conversations rather than a bunch of geeky techies LOL

BTW, I no longer get emails when new comments are posted here. I came to check the community and accidentally saw your comments otherwise I wouldn't know you posted something.


Didn't get email from my algo either today nor forum :/

Will look around regarding LMT vs MKT order latency. Indeed 99% of info one can find via a google search is too basic.


Update Backtest


The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


This discussion is closed