Requesting Contract Details

Complete details about a contract in IB's database can be retrieved using the function IBApi.EClient.reqContractDetails. This includes information about a contracts conID, symbol, local symbol, currency, etc. which is returned in a IBApi.ContractDetails object IBApi.EWrapper.contractDetail. reqContractDetails takes as an argument a Contract object which may uniquely match an argument, and unlike other API functions it can also take a Contract object which matches multiple contracts in IB's database. When there are multiple matches, they will each be returned individually to the function IBApi.EWrapper.contractDetails.

Note: Invoking reqContractDetails with a Contract object which has currency = USD will only return US contracts, even if there are non-US instruments which have the USD currency.

Request for Bond details will be returned to IBApi.EWrapper.bondContractDetails instead. Because of bond market data license restrictions, there are only a few available fields to be returned in a bond contract description, namely the minTick, exchange, and short name.

One particular use of the IBApi.EClient.reqContractDetails function is to request an option chain. See Option Chains for more details.

BroadTape News List

The example below shows an "incomplete" news IBApi.Contract with no symbol or currency defined. In most cases using such a contract would result in an invalid contract details error since a symbol or localSymbol is required. IBApi.EClient.reqContractDetails will instead use it to obtain the whole BroadTape news chain from the TWS.

** Python **

contract = Contract()
contract.secType = "NEWS"
contract.exchange = "BRFG" #Briefing Trader

self.reqContractDetails(10004, ContractSamples.NewsFeedForQuery())

** Java **

Contract contract = new Contract();
contract.exchange("BRF"); //Briefing Trader

client.reqContractDetails(211, ContractSamples.NewsFeedForQuery());

All returned objects will be delivered via IBApi.EWrapper.contractDetails. Once all contracts have been delivered the IBApi.EWrapper.contractDetailsEnd marker will be triggered to notify it.

** Python **

class TestWrapper(wrapper.EWrapper):

def contractDetails(self, reqId: int, contractDetails: ContractDetails):
    super().contractDetails(reqId, contractDetails)

def contractDetailsEnd(self, reqId: int):
    print("ContractDetailsEnd. ReqId:", reqId)

** Java **

public class EWrapperImpl implements EWrapper {

    public void contractDetails(int reqId, ContractDetails contractDetails) {
        System.out.println(EWrapperMsgGenerator.contractDetails(reqId, contractDetails)); 

    public void contractDetailsEnd(int reqId) {
        System.out.println("ContractDetailsEnd. "+reqId+"\n");

Important: due to the potentially high amount of data resulting from such queries this request is subject to pacing. Although a request such as the above one will be answered immediately, a similar subsequent one will be kept on hold for one minute. This amount of time will increase if more such requests are performed. To prevent this narrow down the amount of eligible contracts by providing an expiration date specifying at least the year (i.e. 2019) or the year and the month (i.e. 201903 for March 2019).