开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: Is there generic method to format contract for reqContractDetails


 

Glad that this works for you.

There is one caveat about requesting contracts by ConId. It may not apply to your use case but you should be aware (and you may already be).

The ConId uniquely identifies a specific instrument, possibly even for a long time. But if the issuer makes any change to the instrument that requires a change to the secId (ISIN/CUSIP, ...) IBKR changes the ConId as well. Even if the Symbol or LocalSymbol of the instrument does not change. Examples are stock splits, change of primary listing exchange, and corporate mergers, but there may be others. SH just went through this in early November.

Generally in these cases, the old ConIds become invalid and result in request errors the moment the instrument change takes place. The Contract option "includeExpired" only works for certain instruments (such as Futures) and does not work for Stocks/ETFs/ETNs etc.

For many use cases, your "four field" contract lookup such as "SH:STK:SMART:USD" might still be the best bet.

闯ü谤驳别苍

?
On Mon, Dec 2, 2024 at 07:51 AM, Andy Sanders wrote:

Actually, I was wrong, yes, ConId is enough.?
It didn't work for SPY because that was the only security I defined manually, so it didn't have ConId.

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