Komnomnomnom / swigibpy

Third party Interactive Brokers Python API generated from TWS C++ API using SWIG.
http://github.com/Komnomnomnom/swigibpy/
Other
157 stars 35 forks source link

unable to add a comboLeg to contract #3

Closed olafsep01 closed 12 years ago

olafsep01 commented 12 years ago

I am unable to add a comboLeg to a contract:

make comboLeg: leg1 = ComboLeg() leg1.conId = conId leg1.ratio = 1 leg1.action = "BUY" leg1.exchange = "FTA" leg1.openClose = 0 leg1.shortSaleSlot = 0 leg1.designatedLocation = ""

contract = Contract() contract.symbol = "EOE" # abitrary value only combo orders contract.secType = "BAG" # BAG is the security type for COMBO order contract.exchange = "FTA"; contract.currency = "EUR"; contract.comboLegs = ???? <- here I want to add leg1.

In the C++ manual of IB in "Placing a Combination Order": contract.comboLegs = addAllLegs; //including combo order in contract object.

My C++ knowledge is very limited, but I understand comboLegs is a Vector. But I do not know how to translate this to python.

Komnomnomnom commented 12 years ago

Hi Olaf, could you try the latest master. You should be able to add combo legs using the ComboLegList class now

contract.comboLegs = ComboLegList([leg1, leg2])

Let me know if it works ok

olafsep01 commented 12 years ago

Hi Kieran, thanks. I have tested it in 2.7 and it works flawless.

jshellen commented 7 years ago

Were you able to send the order successfully?