¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: How to link 2 orders on 2 different contracts so that the 2nd one is executed only if the 1st one gets filled and have this sit on the IB side?


 

Just realized you were looking for an SPX option. As expected, TWS accepts an execution condition for "SPXW 231115C04350000" via the API as well:




On Sat, Nov 4, 2023 at 04:45 PM, ´³¨¹°ù²µ±ð²Ô Reinold wrote:
I don't have too much hands-on experience with options, Bart. But TWS did accept an order I just placed via TWS API in a paper account with this ExecutionCondition:
  • symbol="SPY 231108C00430000"
  • exchange="CBOE"
  • secType="OPT"

The order was a MKT BUY order for one contract of ESZ3 and the condition shows up in the TWS OrderTicket like this:




Hope that helps,
´³¨¹°ù²µ±ð²Ô


On Sat, Nov 4, 2023 at 02:31 PM, Bart D wrote:
Jurgen, thank you for the suggestion - obviously that should be the 'accepted answer' IF it works.
But I'm not sure it does for a specific option contract as the OP asked for.
When I try this in TWS, it lets me enter a 'Trade' condition and then opens a dialog box to specify 'Underlying', 'Exchange' and 'Type'. When you enter 'SPY' (or 'SPX' for that matter which is my interest) it doesn't let you specify the specific option contract. So seems it would trigger on any trade of any SPY (or SPX) option in the account, which is not the intended use case.
See attached for TWS screenshot.


rgds, Bart
On Nov 4, 2023 at 11:55?AM -0700, joanmarcel119 via groups.io <joanmarcel@...>, wrote:
Hi Jurgen, I think it doesn't monitor any "conid" execution, instead just symbol, sectype and exchange, does this equals to the conid of an instrument?
?
?

El s¨¢b, 4 nov 2023 a las 18:06, ´³¨¹°ù²µ±ð²Ô Reinold via (<TwsApiOnGroupsIo=[email protected]>) escribi¨®:

We don't know all requirements, but a simple on Order 2 should do the trick. Not sure why that did not come up before on the more active twin-post over at the isync group.

The Execution Condition makes Order 2 ready but inactive until the conid it monitors has an execution in the same account.The two orders are entirely independent of each other and there are no restrictions on the combination of instruments and instrument types for the two orders.

The Execution Condition can be combined with other conditions (Price, Margin, Percentage, Time, Volume) for a much richer and more precise definition of when Order 2 should become active (or get canceled)

Off-loading automated order placement/activation into the IBKR infrastructure or maybe even the exchange makes a lot of sense, but it may be beneficial for the client application to stay connected to monitor the orders and instruments for unforeseen events such as incremental or partial fills of Order 1, cancellation or rejection of Order 1, sudden restrictions on the instruments for Order 1 and Order2, ...

´³¨¹°ù²µ±ð²Ô

On Wed, Nov 1, 2023 at 11:35 AM, Ace wrote:
Hi,
Is there a way in the API to link two orders on two different options contracts so that the 2nd one is executed only if the 1st one gets filled?
So not at the same time like in a combo order.
?
Example:
Order 1: Buy 1 SPY 420 put
Order 2: Sell 1 SPY 415 put (only when order 1 is filled)
?
I want that to sit on the IB side and not have to monitor the execution in my code.
?
Thank you
F

?

?

Join [email protected] to automatically receive all group messages.