Appearance
Contracts
Get Contract ID (conid)
US Stocks
python
conid = client.get_conid("SPY") # Returns: 756733
conid = client.get_conid("AAPL") # Returns: 265598Returns: int or None
Non-US Stocks
Use exchange, currency, and country to disambiguate listings on foreign markets.
python
conid = client.get_conid("RY", exchange="TSX", currency="CAD", country="CA")
conid = client.get_conid("VOD", exchange="LSE", currency="GBP", country="GB")
conid = client.get_conid("SAP", exchange="IBIS", currency="EUR", country="DE")Futures
python
conid = client.get_conid("ES", sec_type="FUT", exchange="CME") # S&P 500 future
conid = client.get_conid("NQ", sec_type="FUT", exchange="CME") # Nasdaq future
conid = client.get_conid("CL", sec_type="FUT", exchange="NYMEX") # Crude oil futureCrypto
Crypto conid lookups require explicit hints — bare-symbol lookup is not supported.
python
conid = client.get_conid("BTC", sec_type="CRYPTO", exchange="PAXOS")
conid = client.get_conid("ETH", sec_type="CRYPTO", exchange="PAXOS")IBKR account enablement required
Crypto trading must be enabled on the IBKR account before lookups work.
Search Contracts
python
results = client.search_contracts("Apple", sec_type="STK", limit=5)Returns: List[Dict] — contracts matching the query.
Parameters: query, sec_type, exchange, country, currency, primary_exchange, limit (default 10).
Qualify Contract
python
contract = client.qualify_contract("QQQ")
index_contract = client.qualify_contract("VIX", sec_type="IND", exchange="CBOE")
canadian = client.qualify_contract("RY", exchange="TSX", currency="CAD", country="CA")Returns: ContractRef
python
ContractRef(
conid=320227571,
symbol='QQQ',
sec_type='STK',
exchange='SMART',
currency='USD',
listing_exchange='NASDAQ'
)Indices
python
conid = client.get_index_conid("SPX") # Returns: 416904
conid = client.get_index_conid("VIX") # Returns: 13455763Contract Details
python
details = client.get_contract_details(756733)Returns: Dict with nested secdef array
python
{
'secdef': [{
'conid': 756733,
'ticker': 'SPY',
'name': 'STATE STREET SPDR S&P 500 ETF',
'assetClass': 'STK',
'listingExchange': 'ARCA',
'currency': 'USD',
'countryCode': 'US',
'type': 'ETF',
'hasOptions': True,
'isUS': True,
'multiplier': 0.0,
'allExchanges': 'AMEX,NYSE,CBOE,...'
}]
}Accessing Details
Always extract from nested structure:
python
secdef = details.get("secdef", [{}])
info = secdef[0] if secdef else {}
ticker = info.get("ticker")
asset_class = info.get("assetClass")Options Contract Details
For options, get_contract_details(opt_conid) returns:
python
{
'secdef': [{
'conid': 843131455,
'ticker': 'SPX',
'assetClass': 'OPT',
'expiry': '20260122',
'strike': '6905',
'putOrCall': 'C',
'multiplier': 100.0,
'undConid': 416904,
'listingExchange': 'CBOE'
}]
}WARNING
tradingClass is NOT returned by get_contract_details(). Use get_option_contract() if you need trading class info.