Reputation: 651
I'm interested in trying the Python wrapper for Interactive Brokers' API, but I trade option spreads (mostly iron condors) and not just single options.
Is there a reasonable way to do this with ibPy?
Upvotes: 1
Views: 3153
Reputation: 31
You could manage each leg of the spread seperately for more precision when placing and modifying orders, rather than using combo orders.
Place the orders for each leg seperately and add any newly placed orders to a collection of orders.
Monitor your orders to see if they have been completely filled or if they require modification. Once each leg of the spread is completely filled, add the spread to a collection of positions.
Upvotes: 0
Reputation: 735
For anyone coming late to the party here's an example straight out of the IB API documentation:
http://interactivebrokers.github.io/tws-api/spread_contracts.html#bag_opt
You will have to locate the correct conids (requestMarketData can help with this). For an iron condor you are placing four legs on your combo.
Bonus points for managing the execution of the order - you can place the limit at the midpoint but filling an iron condor at mid is down to luck and luck is not what you want when you're trying to automate your trading. You may have to cancel and resubmit the order at the new midpoint until it fills.
Upvotes: 4