• C#
  • Java
  • VB
  • C++
  • Python
Contact us
Requesting Market Data

In order to receive live quotes, you must first make the request call via IBApi.EClient.reqMktData within your API program. Every request needs a unique identifier which will serve to identify the returned data:

  • client.reqMktData(16001, ContractSamples.USStockCFD(), string.Empty, false, false, null);
    Thread.Sleep(1000);
    client.reqMktData(16002, ContractSamples.EuropeanStockCFD(), string.Empty, false, false, null);
    Thread.Sleep(1000);
    client.reqMktData(16003, ContractSamples.CashCFD(), string.Empty, false, false, null);
    Thread.Sleep(1000);
  • client.reqMktData(1001, ContractSamples.StockComboContract(), "", false, false, null);
  • client.reqMktData(1001, ContractSamples.StockComboContract(), String.Empty, False, False, Nothing)
    client.reqMktData(1002, ContractSamples.FuturesOnOptions(), String.Empty, False, False, Nothing)
  • m_pClient->reqMktData(1001, ContractSamples::StockComboContract(), "", false, false, TagValueListSPtr());
    m_pClient->reqMktData(1002, ContractSamples::OptionWithLocalSymbol(), "", false, false, TagValueListSPtr());
  • 1  self.reqMktData(1101, ContractSamples.USStockAtSmart(), "", False, False, [])
    2  self.reqMktData(1001, ContractSamples.StockComboContract(), "", True, False, [])

Generic Tick Types

The most common tick types are delivered automatically after a successful market data request. There are however other tick types available by explicit request: the generic tick types. When invoking IBApi.EClient.reqMktData, specific generic ticks can be requested via the genericTickList parameter of the function:

  • //Requesting RTVolume (Time & Sales), shortable and Fundamental Ratios generic ticks
    client.reqMktData(1004, ContractSamples.USStock(), "233,236,258", false, false, null);
  • //Requesting RTVolume (Time & Sales), shortable and Fundamental Ratios generic ticks
    client.reqMktData(1004, ContractSamples.USStock(), "233,236,258", false, false, null);
  • 'Requesting RTVolume (Time & Sales), shortable And Fundamental Ratios generic ticks
    client.reqMktData(1004, ContractSamples.USStock(), "233,236,258", False, False, Nothing)
  • //Requesting RTVolume (Time & Sales), shortable and Fundamental Ratios generic ticks
    m_pClient->reqMktData(1004, ContractSamples::USStock(), "233,236,258", false, false, TagValueListSPtr());
  • 1  # Requesting RTVolume (Time & Sales), shortable and Fundamental Ratios generic ticks
    2  self.reqMktData(1004, ContractSamples.USStock(), "233,236,258", False, False, [])

For a list of available tick types please refer to Available Tick Types

Streaming Data Snapshots

With an exchange market data subscription, such as Network A (NYSE), Network B(ARCA), or Network C(NASDAQ) for US stocks, it is possible to request a snapshot of the current state of the market once instead of requesting a stream of updates continuously as market values change. By invoking the IBApi::EClient::reqMktData function passing in true for the snapshot parameter, the client application will receive the currently available market data once before a IBApi.EWrapper.tickSnapshotEnd event is sent 11 seconds later. Snapshot requests can only be made for the default tick types; no generic ticks can be specified. It is important to note that a snapshot request will only return available data over the 11 second span; in many cases values for all default ticks will not be returned. However snapshots are allowed a higher rate limit than the normal 50 messages per second limitation of other EClientSocket functions.

Snapshot request:

  • client.reqMktData(1003, ContractSamples.FutureComboContract(), string.Empty, true, false, null);
  • client.reqMktData(1003, ContractSamples.FutureComboContract(), "", true, false, null);
  • client.reqMktData(1003, ContractSamples.FutureComboContract(), String.Empty, True, False, Nothing)
  • m_pClient->reqMktData(1003, ContractSamples::FutureComboContract(), "", true, false, TagValueListSPtr());
  • 1  self.reqMktData(1003, ContractSamples.FutureComboContract(), "", False, False, [])

End marker reception:

  • public class EWrapperImpl : EWrapper
    {
    ...
    public virtual void tickSnapshotEnd(int tickerId)
    {
    Console.WriteLine("TickSnapshotEnd: "+tickerId);
    }
  • public class EWrapperImpl implements EWrapper {
    ...
    @Override
    public void tickSnapshotEnd(int reqId) {
    System.out.println("TickSnapshotEnd: "+reqId);
    }
  • Public Class EWrapperImpl
    Implements EWrapper
    ...
    Public Sub tickSnapshotEnd(tickerId As Integer) Implements IBApi.EWrapper.tickSnapshotEnd
    Console.WriteLine("TickSnapshotEnd: " & CStr(tickerId))
    End Sub
  • class TestCppClient : public EWrapper
    {
    ...
    void TestCppClient::tickSnapshotEnd(int reqId) {
    printf( "TickSnapshotEnd: %d\n", reqId);
    }
  • 1 class TestWrapper(wrapper.EWrapper):
    ...
    1  def tickSnapshotEnd(self, reqId: int):
    2  super().tickSnapshotEnd(reqId)
    3  print("TickSnapshotEnd:", reqId)
    4 

Regulatory Snapshots

The fifth argument to reqMktData specifies a regulatory snapshot request to US stocks and options. Regulatory snapshots require TWS/IBG v963 and API 973.02 or higher and specific market data subscriptions.

For stocks, there are individual exchange-specific market data subscriptions necessary to receive streaming quotes. For instance, for NYSE stocks this subscription is known as "Network A", for ARCA/AMEX stocks it is called "Network B" and for NASDAQ stocks it is "Network C". Each subscription is added a la carte and has a separate market data fee.

Alternatively, there is also a "US Securities Snapshot Bundle" subscription which does not provide streaming data but which allows for real time calculated snapshots of US market NBBO prices. By setting the 5th parameter in the function IBApi::EClient::reqMktData to True, a regulatory snapshot request can be made from the API. The returned value is a calculation of the current market state based on data from all available exchanges.

Important: Each regulatory snapshot made will incur a fee of 0.01 USD to the account. This applies to both live and paper accounts.. If the monthly fee for regulatory snapshots reaches the price of a particular 'Network' subscription, the user will automatically be subscribed to that Network subscription for continuous streaming quotes and charged the associated fee for that month. At the end of the month the subscription will be terminated. Each listing exchange will be capped independently and will not be combined across listing exchanges.

  • // Each regulatory snapshot incurs a 0.01 USD fee
    client.reqMktData(1005, ContractSamples.USStock(), "", false, true, null);
  • // Each regulatory snapshot request incurs a 0.01 USD fee
    client.reqMktData(1014, ContractSamples.USStock(), "", false, true, null);
  • ' Each regulatory snapshot request will incur a fee of 0.01 USD
    ' client.reqMktData(1004, ContractSamples.USStock(), "", False, True, Nothing)
  • // Each regulatory snapshot incurs a fee of 0.01 USD
    m_pClient->reqMktData(1013, ContractSamples::USStock(), "", false, true, TagValueListSPtr());
  • 1  # Each regulatory snapshot request incurs a 0.01 USD fee
    2  # self.reqMktData(1014, ContractSamples.USStock(), "", False, True, [])

The following table lists the cost and maximum allocation for regulatory snapshot quotes:

Listed Network FeedPrice per reqSnapshot requestPro or non-ProMax reqSnapshot request
NYSE (Network A/CTA)
0.01 USD
Pro
4500
NYSE (Network A/CTA)
0.01 USD
Non-Pro
150
AMEX (Network B/CTA)
0.01 USD
Pro
2300
AMEX (Network B/CTA)
0.01 USD
Non-Pro
150
NASDAQ (Network C/UTP)
0.01 USD
Pro
2300
NASDAQ (Network C/UTP)
0.01 USD
Non-Pro
150

Requesting regulatory snapshots is subject to pacing limitations:

  • If markets are closed, no more than two requests can be made in a 5 second period.
  • If markets are open, there can be no more than 5 requests pending for the same contract.