Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Bracket orders for combo legs #35

Description

@simonskok

Hi Ran,

thank you for writing this great module! It makes interaction with IB much easier.
As I am focused towards automating placing option spread combos, I have encountered the following issue: Combining your two examples from Readme file on placing an option combo and a bracket order, I get the following:

`import ezibpy
import time

ibConn = ezibpy.ezIBpy()
ibConn.connect(clientId=100, host="localhost", port=7496)

contract_to_buy = ibConn.createOptionContract("AAPL", expiry=20191101, strike=250, otype="CALL")
contract_to_sell = ibConn.createOptionContract("AAPL", expiry=20191101, strike=252.5, otype="CALL")

leg1 = ibConn.createComboLeg(contract_to_buy , "SELL", ratio=1)
leg2 = ibConn.createComboLeg(contract_to_sell , "BUY", ratio=1)
contract = ibConn.createComboContract("AAPL", [leg1, leg2])

order = ibConn.createBracketOrder(contract,
quantity = 1,
entry = 0.02,
target = 0.05,
stop = 0.01)
`

Missing or invalid NonGuaranteed value. REL+MKT, LMT+MKT, and REL+LMT order of two legs can only be set as non-guaranteed.

I have configured my API setting in IB TWS to allow Non-guaranteed execution, but the error remains. Looking through your source code, I also havent been able to locate the variable corresponding to this setting.

Any idea how to solve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions