mattsta / icli

interactive brokers ibkr api command line interface cli giving you the fastest way to lose all your money
Other
84 stars 19 forks source link

Support for multiple OCO stop limit and stop market orders? #3

Open kpapad904 opened 1 year ago

kpapad904 commented 1 year ago

Hello and thank you very much for creating icli, I've just come across it and both its current functionality as well as the TODO roadmap look incredible!

I have a question: Could icli be used to manage / automate a multi-leg options strategy that includes multiple OCO stop orders, such as the 0-DTE SPX Breakeven Iron Condor ?

More info here: https://www.sandvand.net/2022/08/21/learnings-from-0dte-breakeven-iron-condor/ https://www.sandvand.net/2022/01/02/0dte-breakeven-iron-condor/

mattsta commented 1 year ago

That's a good question!

Short answer: partially yes, but it's not done yet, but it will probably get added eventually? It would be another nice tool to add for an "automatic profit accumulation" option.

Longer answer:

I do have an unreleased IC command automation where you give it a symbol name, percent width from current price to start the wings, the point width of the wings, and the spend amount; then it places the 4-leg order based on the current ATM price and each leg quantity based on the amount of spend/margin needed for the width (also adjusted for the credits received).

But, I never got around to testing the command extensively on live trades before my toy account blew up again. Maybe next year when I can jump above PDT again.

As for stops and OCO or OTOCO orders, icli is currently fairly weak in those areas when it comes to posting broker-side complex orders.

I had mostly ignored the interface for creating stops (or OCO et al) due to focusing on active algo day trading automation where we create client side live price trackers then immediately place orders to enter/exit based on various signal/trigger/crossover scenarios (so basically we are managing our own stops external to the broker/exchange then placing a live exit order when prices move against our positions too much). Theoretically it's better to use a live pricing model instead of static entry / exit numbers due to the adversarial interactions of stop loss level hunts paired against cutting winners too early when they are still working in our favor (sometimes a more useful exit for profit taking can be "trailing stop limit if touched" orders, but those are also tricky to get right across different instrument classes).

kpapad904 commented 1 year ago

Hi Matt, I'll be looking forward to new features!

Regarding the PDT restriction, I'm not affected (EU resident) but I've seen many who were affected moving to Options on Futures (e.g. ES, MES, ZB, ZN and sometimes commodities like metals, agricultural etc), typically with defined risk strategies like ICs.

I could point you to a couple of strategies which have been mentioned favorably by folks at Reddit, and which would not require constant monitoring during market hours (like many 0-DTE SPX strategies do ...)

kpapad904 commented 1 year ago

Hi again Matt,

Quick comment to let you know about the 0-DTE SPX MEIC (Multiple Entries Iron Condor) strategy, which has been quite popular recently among the members of the "Tastytrade Options" Facebook group https://www.facebook.com/groups/1930565613719977/

There is also a video presentation by Tammy Chambless: https://www.youtube.com/watch?v=cOoOaKvHRqk