JanBoonen / TwsApiCpp

Improved TWS API POSIX C++ library for the Interactive Brokers (IB) TWS (same project as TwsApiC++ in Yahoo TWSAPI).
106 stars 56 forks source link

No support for multileg option spreads? #10

Closed markmcwiggins closed 5 years ago

markmcwiggins commented 5 years ago

Hi ... I am working on a project where I need to support option spreads (strangles, Iron Condors, double Calendars and so forth.)

The TWS API documents and code show support for this, but I can't get it to work.

I was impressed by your approach, but I don't see support for these multileg spreads in your code either ...

Please correct me if I'm wrong! Thanks much.

stevegee58 commented 5 years ago

When you create an instance of Contract you would normally fill in the secType field with "OPT" for a single option. For a spread you set secType to "BAG" and create an instance of ComboLegList, then set comboLegs to it. Fill in instances of ComboLeg for each leg of the spread.

markmcwiggins commented 5 years ago

Yes, I got it to work! I had the code all set up with the standard version of the TWS API and it never worked, but this version did. THANKS!