I have asked these under one of my earlier posts but didn't get an answer for them (I couldn't find that thread because my profile only shows the last 5 posts).
1- does QC submit orders as ALL_OR_NONE? or they could be filled partially? (I see a partiallly fill status in the code but am not sure if it's actually used)
2- if partial fill exists and an order is partially filled, what happens to the rest of the order? for example if I have an order of 500 shares but 300 of it is filled, will LEAN (or the broker) keep the remaining 200 shares active until they are filled? or there is a way to void them? (didn't want to use the term cancel here)
3- how long will an order will be active for? is it DAY? GOOD_TIL_DATE? GOOD_UNTIL_CANCELED? or...?
Thanks!
Petter Hansson
1. Orders definitely can get partially filled in Lean's order submissions to IB. All of none would be a useful option, I admit, if nothing else but to simplify logic in certain cases.
2. Order remains, only different is some shares have been filled of the total. To "void" them I understand you would have to use the Cancel method, until the confirmation of which you might get additional fills up to the order total.
3. From I remember from your last thread and from my own experience, Lean's mode is GTC.
Patrick Star
Thanks again Petter. As usual your answers are very helpful.
Jared Broad or Alex, based on Petter's answers, more questions for you:
a. is there any way to make the order all or none?
b. if parial fill happens and the remaining of the order is still active, how do you cancel the remaining portion? by canceling the original order? in that case, will it not be confusing to LEAN that how many shares should be charges for, etc.?
Jared Broad
We don't support All or None yet -- But I've made an issue for you here; and we'll start adding more order types ASAP. Its currently impossible to cancel an order which is partially filled. LEAN uses is GTC durations.
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.
Patrick Star
Great. Thanks!
For now I'm handling it through breaking the order into smaller blocks to reduce number of partial fills. Hopefully I get no (or very few) cases of partial fills.
I also added Immediate or Cancel to the issue. That would be even nicer than FOK.
Patrick Star
I though to update this thread for whoever might need this info later. I called IB today and asked about how IOC works. He said this type of order is not time based. The way that it works is that when the order arrives to the exchange, they look for a match - if they don't find any, they reject it. Finally IB will cancel the order if there are no exchanges that can fill the order.
Patrick Star
Now this method does not seem to be what I'm looking for. Instead I would like to set a timeout for my orders. So the IB person gave me a better option. If we set the time-in-force attribute of the order to GTC (Good Till Canceled), the API allows you to pass two dates: goodAfterTime and goodTillDate. Basically these are start and end times and the format of the string is: FORMAT: 20060505 08:00:00 EST
Whi means it takes a time up to seconds. This is perfer for me because I can now open an order that should be filled withing n seconds.
Jared Broad , Alexandre Catarino - looking at the LEAN code, I found that there is a Duration attribute and it takes Custom as an option. But couldn't find how to pass the custom details.
Also I found some references in the (Onada) Rest API that takes gtdTime. Now my question is, is there any way to place an IB Order through the API? or somehow pass this gtdTime parameter when submitting an Order?
Thanks a lot!
Patrick Verhoeven
My issue is I buy $995 of ETH on Bitfinex and it leaves a $5 order which is fine until I move the price and then LEAN says it's invalid becuase it's less than $10. What do I need in my code to cancel any orders less than $10?
Louis Szeto
Hi Patrick
You may refer to TimeInForce order property for a good till time order.
To cancel the remaining order, you may do:
Best
Louis
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.
Patrick Star
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!