Lean.Brokerages.InteractiveBrokers
Lean.Brokerages.InteractiveBrokers copied to clipboard
A Few More Order Types - Interactive Brokers
New order type for IB - VWAP.
All or None // Fill or Kill Option on Orders
Also would be nice to have Immediate or Cancel (IOC):
https://www.interactivebrokers.com/en/index.php?f=594
Adaptive Algo https://interactivebrokers.github.io/tws-api/ibalgos.html#gsc.tab=0
Any update on these features? can we at least have all-or-none for now? Thanks!
Not yet sorry but we'll reply here when it is done so no need to ping thread.
Its an internal rule of QC -- bugs before features :) As long as there are red-flags we'll fix them first. If you'd like to push these features through we'd welcome a PR though!
Bugs before Features is a very good policy. But I really need this feature because my algo goes crazy because of the partial fills - so much that I pulled the plug on it today.
I will see if I can contribute. Otherwise looks like I have to wait for you guys to pick it up.
Related issues/pull requests:
Ability to accept GoodTillDate and DurationValue in QC orders for IB: https://github.com/QuantConnect/Lean/issues/971 Support for GoodTillDate with Interactive Brokers: https://github.com/QuantConnect/Lean/pull/1201 Addition of Interactive Brokers Algorithmic orders: https://github.com/QuantConnect/Lean/pull/1203
There are multiple features grouped together in this issue, so we are splitting this issue in the following tasks, to keep pull requests smaller and easier to review:
-
[x] Rename enum
OrderDuration->TimeInForceand renameOrder.DurationtoOrder.TimeInForce -
[x] Implement
TimeInForce.Day(DAY) https://www.interactivebrokers.com/en/software/tws/usersguidebook/ordertypes/time_in_force_for_orders.htm -
[ ] Implement Guaranteed VWAP order type https://www.interactivebrokers.com/en/index.php?f=603
-
[ ] Implement
TimeInForce.GoodTilDate(GTD) https://www.interactivebrokers.com/en/index.php?f=589 -
[ ] Implement
TimeInForce.FillOrKill(FOK) https://www.interactivebrokers.com/en/index.php?f=586 -
[ ] Implement
TimeInForce.ImmediateOrCancel(IOC) https://www.interactivebrokers.com/en/index.php?f=594 -
[ ] Implement
Order.AllOrNone(AON) https://www.interactivebrokers.com/en/index.php?f=577 -
[ ] Implement IB Algorithms with
InteractiveBrokersOrderPropertieshttps://interactivebrokers.github.io/tws-api/algos.html
@StefanoRaggi -- a reminder that for each step we're only implementing them for backtesting and interactive brokers live, which means for all other brokerage models, we'll need to update the CanSubmit method to flag orders with these options as invalid.
Based on many user requests, it would be nice to implement OCA - One Cancels All grouped orders. https://www.interactivebrokers.com/en/index.php?f=617 IB API is OcaGroup
Relative Order type: https://www.interactivebrokers.com/en/general/education/videos/tws-python-api-pair-trades.php