Skip to content

Contracts

Get Contract ID (conid)

Stocks

python
conid = client.get_conid("SPY")  # Returns: 756733
conid = client.get_conid("AAPL") # Returns: 265598

Returns: int or None

Indices

python
conid = client.get_index_conid("SPX")  # Returns: 416904
conid = client.get_index_conid("VIX")  # Returns: 13455763

Returns: int or None

Contract 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,
        'incrementRules': [{'increment': 0.01, 'lowerEdge': 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")
FieldTypeDescription
conidintContract ID
tickerstrSymbol
namestrFull name
assetClassstrSTK, OPT, FUT, IND
listingExchangestrPrimary exchange
typestrETF, CS (common stock), etc.
hasOptionsboolOptions available
multiplierfloatContract multiplier

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.