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?
Jurgen, Do you think it checks for any execution or a full order filled? Because if as soon as one contract of the main order is filled the companion market order gets triggered with more contracts, it will cause a margin deficit.
Since my goal is to place an order on the long leg of a combo, when I place an individual order on the long leg with a goodAftertime near market close, the order is rejected becausce it "would cause a margin deficit" even though there is? a goodAftertime condition on the short leg which is sooner.
Bart, My attempts at using hedging orders for my scenario have not worked yet. I may have another idea for linking a hedging order.
|
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?
This seems to confirm what I thought: They don¡¯t do string validation on the entered ¡®symbol¡¯ when entering it via the API so it just accepts anything and since it¡¯s called ¡®underlying¡¯ in TWS it doesn¡¯t work for options.?
I believe the solution is to do a hedge order of ¡®pair¡¯ type. See my post of Nov1 in the other similar thread in the ib-insync group.Since the ¡®pair¡¯ is a child to the original order, the order should only be entered when the first executes.?
I just tried in TWS and when you enter SPX in the pair edit box, TWS opens the dialog to specify to let you select option, and even an option combo.?
See attached where both original and pair order are a vertical spread.?
rgds, Bart
On Nov 6, 2023 at 11:57?PM +0100, ´³¨¹°ù²µ±ð²Ô Reinold via groups.io <TwsApiOnGroupsIo@...>, wrote:
toggle quoted message
Show quoted text
Thank you for letting us know.
The local symbol does not seem to work and it probably needs to be what the contract calls "symbol" (though please try yourself and confirm). I tried it Sunday evening with "SPXW 231106C04365000" in a paper account.
I placed the order after the exchange opened at 19:15 US/Central and it took a couple hours before the the option order was filled. The execution condition on the companion order was not triggered, though. When I closed the option position later, I tried
the execution condition with "SPX" and that worked just fine.
If you confirm this behavior, I can think of two scenarios:
It depends on your complete requirements whether this is acceptable.
´³¨¹°ù²µ±ð²Ô
On Mon, Nov 6, 2023 at 04:28 PM, Ace wrote:
Thanks ´³¨¹°ù²µ±ð²Ô!
I made a quick test today an an execution condition on SPY to sell QQQ and it worked.
I will try with options tomorrow using the options contract localSymbol as the symbol:
<>
IB doesn't check if the entered symbol is valid though:
<>
You enter anything as a symbol and it goes through without getting an error:
<>
|
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?
Thank you for letting us know.
The local symbol does not seem to work and it probably needs to be what the contract calls "symbol" (though please try yourself and confirm). I tried it Sunday evening with "SPXW? 231106C04365000" in a paper account.
I placed the order after the exchange opened at 19:15 US/Central and it took a couple hours before the the option order was filled. The execution condition on the companion order was not triggered, though. When I closed the option position later, I tried the execution condition with "SPX" and that worked just fine.
If you confirm this behavior, I can think of two scenarios:
It depends on your complete requirements whether this is acceptable.
´³¨¹°ù²µ±ð²Ô
On Mon, Nov 6, 2023 at 04:28 PM, Ace wrote:
toggle quoted message
Show quoted text
Thanks ´³¨¹°ù²µ±ð²Ô!
I made a quick test today an an execution condition on SPY to sell QQQ and it worked.
I will try with options tomorrow using the options contract localSymbol as the symbol:
IB doesn't check if the entered symbol is valid though:
You enter anything as a symbol and it goes through without getting an error:
|
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?
Thanks ´³¨¹°ù²µ±ð²Ô! I made a quick test today an an execution condition on SPY to sell QQQ and it worked. I will try with options tomorrow using the options contract localSymbol as the symbol:  IB doesn't check if the entered symbol is valid though:  You enter anything as a symbol and it goes through without getting an error:
|
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?
Hi both,
This "SPY 231108C00430000" is not the conid because I've always seen a long numeric when looking for the conid of an instrument.? You can check also the conid of an options contract by checking the details website provided on the TWS, so for example when I right click on the options contract and select details, the TWS opens a website?which url carries the conid number:?
?conid=662053722&action=CONTRACT_DETAILS&detlev=2&loginType=2&mid=001&clt=1&site=IB&sess=1699184296
but also it can be found on the opened web page by searching "conid"
So another check I did is by placing the local symbol or local name (also found on the web page) and entering this local symbol directly on the TWS, it gets the options contract without searching for it on the TWS. Try to place on the TWS (Financial instrument) this: "SPXW ?231106C04350000" This seems to identify the exact options contract without the conid number, so this may work on the execution condition filter.
But when I try the same for the SPY options contract "SPY 231108C00430000" it doesn't get the data on the TWS, I don't know why the SPY options contract doesn't work the same.
Please Bart tell us if that worked on the API for you
Thank you
toggle quoted message
Show quoted text
Thanks. It will try this in the coming week when the exchange is open. I¡¯m still sceptical for 2 reasons:
- The TWS dialog specifies to enter the??¡°underlying¡± and so that would be ¡°SPX¡± not the option contract.?
- The fact that the APi just asks for a ¡°symbol¡± (which could be the underlying symbol) and not for a conId.
But it¡¯d be great if it really works.?
rgds, Bart
On Nov 4, 2023 at 3:18?PM -0700, ´³¨¹°ù²µ±ð²Ô Reinold via <TwsApiOnGroupsIo= [email protected]>, wrote:
Just realized you were looking for an SPX option. As expected, TWS accepts an execution condition for "SPXW 231115C04350000" via the API as well:
<ExecutionConditionSPX.png>
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 <joanmarcel= [email protected]>, 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
?
?
|
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?
Thanks. It will try this in the coming week when the exchange is open. I¡¯m still sceptical for 2 reasons:
- The TWS dialog specifies to enter the??¡°underlying¡± and so that would be ¡°SPX¡± not the option contract.?
- The fact that the APi just asks for a ¡°symbol¡± (which could be the underlying symbol) and not for a conId.
But it¡¯d be great if it really works.?
rgds, Bart
On Nov 4, 2023 at 3:18?PM -0700, ´³¨¹°ù²µ±ð²Ô Reinold via groups.io <TwsApiOnGroupsIo@...>, wrote:
toggle quoted message
Show quoted text
Just realized you were looking for an SPX option. As expected, TWS accepts an execution condition for "SPXW 231115C04350000" via the API as well:
<ExecutionConditionSPX.png>
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
?
?
|
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: 
toggle quoted message
Show quoted text
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
?
?
|
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?
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, ´³¨¹°ù²µ±ð²Ô
toggle quoted message
Show quoted text
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
?
?
|
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?
The "Contract ID" (aka conId) uniquely identifies all attributes of an instrument except, potentially, the exchange. that is traded on multiple exchanges, a separate object may be returned for each exchange and the same currency, but all contracts generally have the same conid.
´³¨¹°ù²µ±ð²Ô
toggle quoted message
Show quoted text
On Sat, Nov 4, 2023 at 01:55 PM, joanmarcel119 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
?
?
|
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?
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:
toggle quoted message
Show quoted text
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
|
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?
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¨®:
toggle quoted message
Show quoted text
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
|
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?
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:
toggle quoted message
Show quoted text
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
|
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?
Order.hedgeType as pair probably? Never tried this though.
|
Re: Requesting HIstorical Bar Data Slower Lately?
toggle quoted message
Show quoted text
In the last two months, I've noticed my code that loops over symbols and requests historical bar data with ib_insync has significantly slowed down.? I'm aware of the pacing guidelines and stay within them and haven't made any changes to my code so this seems to all be on IB's side (although I did updated TWS).? Has anyone else experienced this or talked to someone at IB about it???
|
Requesting HIstorical Bar Data Slower Lately?
In the last two months, I've noticed my code that loops over symbols and requests historical bar data with ib_insync has significantly slowed down.? I'm aware of the pacing guidelines and stay within them and haven't made any changes to my code so this seems to all be on IB's side (although I did updated TWS).? Has anyone else experienced this or talked to someone at IB about it???
|
Simulate subscription in Paper account
hi there,?
I have a Paper account. I have set up a subscription for reqHistoricalData as below.?
the contract I am using is AAPL, exchange="SMART".?
I get the historical data but no updates thereafter. the strange bit is that if I request data again, I can see updates, just no real time updates.
1. Is this because I am using a Paper account? 2. Do I need a separate subscription for Real time Trades.?
thanks!
|
Re: TWS API earning dates..
Seems like I miss some subscription but what and where?
Log in to the Client Portal and go to "Settings". Under "User Settings" go to "Research Subscriptions". Select "Manage Subscriptions". Turn on "Wall Street Horizon Corporate Event Data for Retail users".
|
Re: Downloading historical SPY options data
The following arguments to the Contract structure worked for me:
Contract contract; contract.secType = "OPT"; contract.currency = "USD"; contract.lastTradeDateOrContractMonth = "20231117"; contract.strike = 430; contract.right = "C"; contract.symbol = "SPY"; contract.exchange = "SMART"; So "symbol" is the underlying and exchange had to be "SMART" although other might work, "ARCA" did not.
On Friday, November 3, 2023 at 08:07:59 AM EDT, Marcus via groups.io <haupt_marcus@...> wrote:
When I request historical options data from IB using the following structure I get a? "Code: 200, Msg: No security definition has been found for the request" error.
The symbol is the one that TWS displays. What am I doing wrong?
Contract contract; contract.secType = "OPT"; contract.currency = "USD"; contract.lastTradeDateOrContractMonth = "20231117"; contract.strike = 425; contract.right = "C"; contract.exchange = "SMART"; contract.symbol = "SPY Nov17'23 425 CALL";
On Thursday, November 2, 2023 at 11:01:29 AM EDT, Gordon Eldest via groups.io <hymagik@...> wrote:
TWS search SPY, give "ARCA" for primaryExchange
When in doubt use reqMatchingSymbols (work like the search of TWS plus extra like all possible venues with trading hours and liquid hours) worth the effort
symbol "SPY" , try with "SMART" for exchange unless you want a specific exchange (or set the primary). In general primaryExchange can stay empty unless you feel there could be a synonym for the pair symbol+currency (rare)
|
Re: Downloading historical SPY options data
The symbol is simply 'SPY'
|
Re: Downloading historical SPY options data
When I request historical options data from IB using the following structure I get a? "Code: 200, Msg: No security definition has been found for the request" error.
The symbol is the one that TWS displays. What am I doing wrong?
Contract contract; contract.secType = "OPT"; contract.currency = "USD"; contract.lastTradeDateOrContractMonth = "20231117"; contract.strike = 425; contract.right = "C"; contract.exchange = "SMART"; contract.symbol = "SPY Nov17'23 425 CALL";
On Thursday, November 2, 2023 at 11:01:29 AM EDT, Gordon Eldest via groups.io <hymagik@...> wrote:
TWS search SPY, give "ARCA" for primaryExchange
When in doubt use reqMatchingSymbols (work like the search of TWS plus extra like all possible venues with trading hours and liquid hours) worth the effort
symbol "SPY" , try with "SMART" for exchange unless you want a specific exchange (or set the primary). In general primaryExchange can stay empty unless you feel there could be a synonym for the pair symbol+currency (rare)
|