简体   繁体   中英

Option spreads with Interactive Brokers' API?

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?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM