C# API – How to Request Watchlist Data

Articles From: Interactive Brokers
Website: Interactive Brokers

Algo traders using C# programming language can retrieve market data with simple commands. Our GitHub API guide provides ready-to-use code.

First, let’s check out the function IBApi.EClient.reqMktData and parameter genericTickList. Use them to request a watchlist via IBKR API. Here is an example from our GitHub:

//Requesting RTVolume (Time & Sales), shortable and Fundamental Ratios generic ticks
client.reqMktData(1004, ContractSamples.USStockAtSmart(), “233,236,258”, false, false, null);

Another useful function is reqMktData. Here is how to request streaming data snapshots:

client.reqMktData(1003, ContractSamples.FutureComboContract(), string.Empty, true, false, null);

public class EWrapperImpl : EWrapper

… public virtual void tickSnapshotEnd(int tickerId) {
Console.WriteLine(“TickSnapshotEnd: “+tickerId);

Users interested in retrieving regulatory snapshot can easily do so by invoking this:

// Each regulatory snapshot incurs a 0.01 USD fee
client.reqMktData(1005, ContractSamples.USStock(), “”, false, true, null);

To wrap today’s coding session, review list of available tick types on our GitHub guide:

Disclosure: Interactive Brokers

The analysis in this material is provided for information only and is not and should not be construed as an offer to sell or the solicitation of an offer to buy any security. To the extent that this material discusses general market activity, industry or sector trends or other broad-based economic or political conditions, it should not be construed as research or investment advice. To the extent that it includes references to specific securities, commodities, currencies, or other instruments, those references do not constitute a recommendation by IBKR to buy, sell or hold such investments. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.

The views and opinions expressed herein are those of the author and do not necessarily reflect the views of Interactive Brokers, its affiliates, or its employees.