¿ªÔÆÌåÓý

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

Re: limit orders can have status "Submitted" but not show up in Level2 or NBBO ?

 

maybe it is submitted to IB's "marketplace" and the counterparty could be IB?
Check this:


El mar, 7 nov 2023 a las 17:36, <youngneal@...> escribi¨®:
Hi,

I occasionally have a limit order (for a stock) that IB says has status "Submitted", but that doesn't show up right away in Level 2 data (or NBBO), even though the limit price is strictly between the best bid and ask.? It can take several seconds, or even longer, for the limit order to show up in Level 2. ? Has anybody else seen this behavior, and if so does anybody know why it might be occurring?

I don't think it's that IB Level 2 data and NBBO are delayed at these times, because (a) I'm also monitoring Level 2 data and NBBO on other platforms (and not seeing the order their either), and (b) I think I've never had the order fill when this is happening.? I've seen it with orders submitted to various exchanges, so it doesn't seem to be exchange-specific.

Thanks, ?-Neal

[this post is crossposted here from /g/insync/message/9459,?after nobody replied there]

?

?


Re: conflicting orderStatus messages

 

Let's clarify a point: I will be really astonished that IB send ::execDetails before ::openOrder
However callbacks are asynchronous. So what I wrote above is "generally" the sequence to expect.

I guess that IB does try to respect a certain sequence and their messaging system are a queue, so they can control this.
However their doc doesn't explicitly says that they are committed to respect a specific sequence.

Always be ready for an execution out of sequence and you can only safely rely on receiving one openOrder call back, but not more. (read para on orderStatus) and in due time ::execDetails.


Re: conflicting orderStatus messages

 

From my perspective what you describe look strange.
It is unclear to me if you experience this while using TWS manually or trough a section of code. I assume trough coding then I would look at your code logic first.

1- you can expect to receive a ::openOrder call back as the first call back once you have submitted your order.

"Immediately after the order was submitted correctly, the TWS will start sending events concerning the order's activity via and "

With status "PreSubmitted" maybe but it should be called.
This look like an acknowledgment of an (but nowhere does IB doc write this explicitly, look like an implicit)
Practically I also always get at least one? ::orderstatus call back just after the::openOrder call back and before any execDetails

2- The execDetails call back happens later(at least for me).
As the name imply it, it is sent only once the order had been fulfilled at least in part.

3- The error message you report give the impression that you re-submit an order using the already used orderid 97536 and expired (bcs executed)
Luckily for you as the order had been filled, you cannot re-use same orderid, as re-using it ought to be interpreted as request to change something in the order, but as it was already filled up, nothing now can be changed, then the extra order is rejected.

Assuming the datetime reported does reveal the sequence of events, the 'Cancelled' status did apply to the re-submitted order.
try to log on your own any call to placeOrder, including the orderid you used


Re: conflicting orderStatus messages

 

Here is what I got in terms of corresponding errors:
97536,201,Order rejected - reason:Order is already filled,,1699367542.897107,2023-11-07 09:32:22.897107
97536,104,Cannot modify a filled order.,,1699367542.930087,2023-11-07 09:32:22.930087

The order was a simple order, no groups, nothing else.

Yes, in my experience execDetails always comes first, and contains the most fields I need, openOrder and orderStatus usually come some 200ms or so later, often in doubles, and sometimes contradictory, like this one.


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?

 

Bart, yes I know but this algo is for a smaller account.
I could trade XSP options but I find these to be spready and thinly traded.


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?

 

Yes Jurgen, my guess is that it won't wait for a full fill.
I will need to do a test on less liquid contracts to confirm this


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?

 

¿ªÔÆÌåÓý

Ace, I totally get it. Early exercise is a problem with SPY. Switch to SPX and you won't have that risk.

rgds, Bart
On Nov 6, 2023 at 7:25?PM -0800, Ace via groups.io <fbaribeau1967@...>, wrote:

Bart,

There is no problem buying any multileg combo since there is always an ask even for OTM strikes.
Getting out of a spread/combo when there is no bid on any one leg is impossible even with a market order.

Yes exiting the short leg is what I do but since I want as much stuff as possible (ideally all) on the IB side at the time of entry, I don't want to let sit an OTM no bid long leg because a sudden large late day move up/down can bring it back in the money and I don't want to be assigned the shares or rely on my algo logic to look at ITM options at end of day and close them.


Re: conflicting orderStatus messages

 

You give us very little to work with. For example, was this order in an OCA group with other orders, or did it have an Order Condition that could have caused a cancellation, ...

Gordon pointed you to the right places for some background. The first sentence of "Considerations for Automated Systems" is probably one of the most important considerations where its says "... it is important to monitor for callback notifications, specifically for

When we get a "Cancelled" order status (for example from a "self destruct" price condition on limit orders, an OCA group, or order cancellation request) we always get an error 202 callback (more an informational message than an error). errorMsg in that callback usually contains the reason for the cancellation.

Any chance you have logged that, too?

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




On Tue, Nov 7, 2023 at 08:41 AM, bespalex wrote:
Has anyone experienced this?
2023-11-07 09:32:22,778 [INFO? ? ] __main__: Order Executed: -1 QQQ STK USD 00025b49.6549ea2c.01.01 97536 100 2
2023-11-07 09:32:22,791 [INFO? ? ] __main__: orderStatus - orderid: 97536 status: Filled filled: 100 remaining: 0 lastFillPrice: 370.13 permId: 900345789 parentId: 0 clientId: 123
2023-11-07 09:32:22,923 [INFO? ? ] __main__: orderStatus - orderid: 97536 status: Cancelled filled: 0 remaining: 0 lastFillPrice: 370.13 permId: 900345789 parentId: 0 clientId: 123
The order was actually executed, so why the 'Cancelled' status confirmation?


Re: conflicting orderStatus messages

 

on the Cancelled: filled and remaining are 0 , so I won't be bothered, everything reported is consistent.

you should be ready to handle a couple of extraneous orderStatus (or none) as per doc:

There are a couple of thing IB is in charge to do while processing your order, it may happens a few did triggered but became irrelevant, read

I can speculate at 09:32 that there are a lot of action on QQQ,
so that there are more than one opportunity (venue) where to execute your order,? and once one was achieved other one are internally cancelled but some remnant of aborted action are reported (consistently)

not sure you will ever get an answer to your question.
Recommendation: keep aggregating info from orderStatus based on orderid (or if lost fall back on permid).
and If you want to know more then call the 'referee' execDetails to know precisely what was done and how.


Re: limit orders can have status "Submitted" but not show up in Level2 or NBBO ?

 

Thank you for the response, Gordon.
?
I can't identify the order, but I know it's not any of the orders visible in level 2, just because none of those orders have the right price (or even close, sometimes). ?Likewise for NBBO. ? In fact, in the cases I care most about, the price I am submitting is strictly between the best bid and ask showing in NBBO or level2 (and the best bid and ask do not change even after TWS says my order is submitted). ?
?
It is either normal size (e.g. 100, or?larger, but with a display size of 100).
?
I route it through SMART often. ?Other times NYSE or ARCA specifically. ?Often when I see the delay I'll (manually!) cancel the order and place it again with a different exchange. ?Sometimes that helps, sometimes it doesn't. ?That it often doesn't help suggests to me that something is backlogged at TWS.
?
Indeed, what it _looks like_ to me is that when TWS is saying it is submitted, it's not actually submitted (and accepted) yet at the exchange. ?But I'm not sure of that, of course.
?
-Neal


Re: limit orders can have status "Submitted" but not show up in Level2 or NBBO ?

 

How do you specifically tag your order in such a way that it can be identified within L2 data ?
How big was it ? (normal or odd lot ?)
Did you route it trough SMART ?


limit orders can have status "Submitted" but not show up in Level2 or NBBO ?

 

Hi,

I occasionally have a limit order (for a stock) that IB says has status "Submitted", but that doesn't show up right away in Level 2 data (or NBBO), even though the limit price is strictly between the best bid and ask. ?It can take several seconds, or even longer, for the limit order to show up in Level 2. ? Has anybody else seen this behavior, and if so does anybody know why it might be occurring?

I don't think it's that IB Level 2 data and NBBO are delayed at these times, because (a) I'm also monitoring Level 2 data and NBBO on other platforms (and not seeing the order their either), and (b) I think I've never had the order fill when this is happening. ?I've seen it with orders submitted to various exchanges, so it doesn't seem to be exchange-specific.

Thanks, ?-Neal

[this post is crossposted here from /g/insync/message/9459,?after nobody replied there]

?

?


Re: orderRef visibility

 

No I don't want IB to send it to the exchanges. Otherwise, others may see it, putting me at a disadvantage.


Re: orderRef visibility

 

Look at tag 6010.
But I doubt they are sent to Exchanges, (Why do you need exchange to hold it ? )
1- Since you use IBKR FIX in many situations you might be routed last second to any exchange.
2- They are part of Custom Tag,

But I guess that it will fulfill your need unless you want to FIX directly to exchange. (then it become a case by case issue)


conflicting orderStatus messages

 

Has anyone experienced this?
2023-11-07 09:32:22,778 [INFO? ? ] __main__: Order Executed: -1 QQQ STK USD 00025b49.6549ea2c.01.01 97536 100 2
2023-11-07 09:32:22,791 [INFO? ? ] __main__: orderStatus - orderid: 97536 status: Filled filled: 100 remaining: 0 lastFillPrice: 370.13 permId: 900345789 parentId: 0 clientId: 123
2023-11-07 09:32:22,923 [INFO? ? ] __main__: orderStatus - orderid: 97536 status: Cancelled filled: 0 remaining: 0 lastFillPrice: 370.13 permId: 900345789 parentId: 0 clientId: 123
The order was actually executed, so why the 'Cancelled' status confirmation?


orderRef visibility

 

Does anyone know if orderRef is sent to the exchanges? If so, which FIX tag?


Re: Question regarding reboot of trader workstation

 

That makes a lot of sense. Thank you.


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 know of any definitive documentation, but my best guess is that the Execution Condition gets triggered as soon as IBKR needs to send an object via for the monitored symbol.

Each partial fill for an order generates a separate object so that it is likely the condition triggers upon the first and possibly partial fill.

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


On Mon, Nov 6, 2023 at 06:01 PM, Ace wrote:
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.



Re: Question regarding reboot of trader workstation

 

That is correct. There is a TWS API Global Setting that can eliminate the race condition for a large class of orders. It is called "Use negative numbers to bind automatic orders". When selected, automatic orders get bound to monotonously decreasing negative numbers and, therefore, will not interfere with the client's requirement of using monotonously increasing orderIds for new orders.

The remaining cases need to be eliminated by design. When several independent clients place orders in the same account, there is probably a need for coordination amongst them anyway (account margin management, avoiding opposing orders for the same instrument, ...)? so that one shared orderId assignment strategy could be used.

And the measure of last resort is monitoring the "Duplicate OrderID" error 103. The client could assign a new (higher) orderId and retry the placeOrder request.

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




On Mon, Nov 6, 2023 at 10:38 PM, Little Trader wrote:

Thanks for the very informative posts.I was looking into orderId recently and it solved my problem.One little comment about the following cited piece in the document.

However if there are multiple client applications connected to one account, it is necessary to use an order ID with new orders which is greater than all previous order IDs returned to the client application in openOrder or orderStatus callbacks.

I think it is inherently a race condition. Think about the situation that an orderStatus callback is en route from TWS to the master client while at the same time the master client is placing an order. In this event, there may be order id collision.


Re: Question regarding reboot of trader workstation

 

Thanks for the very informative posts.I was looking into orderId recently and it solved my problem.One little comment about the following cited piece in the document.

However if there are multiple client applications connected to one account, it is necessary to use an order ID with new orders which is greater than all previous order IDs returned to the client application in openOrder or orderStatus callbacks.

I think it is inherently a race condition. Think about the situation that an orderStatus callback is en route from TWS to the master client while at the same time the master client is placing an order. In this event, there may be order id collision.