Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
Search
Conid changing?
Hi, I'm trading a system through the TWS-API and have noticed that some times the contracts ids/symbols for a stock changes. A little background: I only trade stocks, currently on the OMXS Stockholm exchange. I have a local DB of all the assets I want to trade, where I keep the Symbol and the Conid etc, for each asset. But sometimes I have noticed that I can't get data for my asset, and when I look into it, it looks like the Conid has changed. This happened today (or possibly yesterday) for the symbol "TETY". It used to be symbol "TETY" and Conid "366359662". But now Conid "366359662" has the symbol "TETY.OLD". The Symbol "TETY" now has Conid "422484376". The ISIN changed for the asset as well. I assume something happened to this stock, perhaps it changed list at the exchange, or something similar. But my question is if there is a way to receive information about these updates, and also how I should deal with them? I assumed the Conid would be the ID IB gives me to keep track of the stock, but it seems like that can change, so would it be the Symbol that I should keep track of instead, and just update the Conid dynamically for the Symbol? Thanks! Micke |
My approach to this problem is to send the order with the conid that you think is right. If the conid is no longer valid, you will receive an error message. Catch this error message by making a contract details query to IB (using symbol, exchange) and then use the result as the new conid. You can do this automatically in the code and it is fairly fast.
Good luck. |
Does that mean that they never re-use conid's? So you don't inadvertently?end up buying orange juice futures for instance or it will always return an error?? On Thu, May 28, 2020 at 8:06 PM CarlErikson <carl.erikson@...> wrote: My approach to this problem is to send the order with the conid that you think is right. If the conid is no longer valid, you will receive an error message. Catch this error message by making a contract details query to IB (using symbol, exchange) and then use the result as the new conid. You can do this automatically in the code and it is fairly fast. |
I generally prefer to make as few assumptions about the persistence, validity and relevance of conids as possible. Due to scarcity of information I prefer to treat them as merely a "black box" interface sporadically exposed in the API for some peculiar tasks when there is no alternatives based on more universal tools, and not quite reliably useful beyond that.?
So yes, I'd suggest if/when you need conids just get them from contract data received in portfolio updates and by fetching stock lookup. I usually assume that a received Conid would likely be useful for a single trading day at most. Updating conids is really cheap and easy anyway. |
I also have had cases where conid's changed. In my case it related to ETFs which moved from one exchange to another (e.g. NYSE to NASDAQ or vice versa). My experience is that IB then considered the previous listing as the "old listing" (hence the ".OLD" appended to the name) and starts pointing to a new conid. This persists for a few days after which all references to the old listing are removed.
I solved this by running a program once per day which checks the conid's for all symbols that I'm following and compare the returned conid with the conid which I have registered. If there is a difference I receive a warning and do a manual check to see whether I need to update the stored conid. |
¿ªÔÆÌåÓýAs long as you are confident in the symbol, how about requesting conid for validation ahead of order ? |
to navigate to use esc to dismiss