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

Bracket orders for combo legs #35

Open
simonskok opened this issue Oct 28, 2019 · 0 comments
Open

Bracket orders for combo legs #35

simonskok opened this issue Oct 28, 2019 · 0 comments

Comments

@simonskok
Copy link

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant