• C#
  • Java
  • VB
  • C++
  • Python
Contact us
RTD Server for Excel


TWS RTD Server API is a dynamic link library which allows user to request real-time market data from TWS via API using Microsoft Excel®. The TWS RTD Server API directly uses the C# API Client source, which connects to TWS via the socket. It allows displaying streaming live (or 15-minute delayed) market data in Excel by entering formulas into an Excel cell following a specific syntax.

Note: At the current stage, only top-level market data is supported via TWS RTD Server API. No trading capability or other data types are supported. Both Delayed and Real-Time data are supported via TWS RTD Server API. Market Data Subscription is required for requesting live streaming market data.

What You Will Need

- Windows Operating System

Since the TWS RTD Server API technology directly refers to the C# API client source functions, it is supported on Windows Environment only.

- API version 9.73.03+

You need to download IB API Windows version 9.73.03 or higher and install on your computer. Once you have installed the API, you can verify the API Version by checking C:\TWS API\API_VersionNum.txt by default.

- TWS (or IB Gateway) Build 963+

By default, market data requests sent via TWS RTD Server will automatically request for all possible Generic Tick Types. There are several generic tick types being requested that are only supported in TWS 963 or higher. Sending any RTD market data request with default generic tick list to an old build of TWS will trigger a "TwsRtdServer error" indicating incorrect generic tick list is sent. Make sure a TWS builds 963+ is downloaded from IB website and kept running at the background for TWS RTD Server API to function properly.

- Enable Socket Client in TWS (or IB Gateway)

Since the TWS RTD Server API directly refers to the C# API source, RTD market data requests will be sent via the socket layer. Please make sure to Enable ActiveX and Socket Client settings in your TWS.

Please also be mindful of the socket port that you configure in your TWS API settings. The default socket port TWS will listen on is 7496 for a live session, and 7497 for a paper session. It is further discussed in section Connection Parameters that TWS RTD Server connects to port 7496 by default, and you are able to customize the port number to connect by specifying pre-defined Connection Parameters or using rtd_complex_syntax string "port=<port>". You can use any valid port for connection as you wish, and you just need to make sure that the port you are trying to connect to via the API is the same port your TWS is listening on.

- Microsoft Excel®

After installing the API, the pre-compiled RTD library file (located at C:\TWS API\source\csharpclient\TwsRtdServer\bin\Release\TwsRtdServer.dll by default) registered on your computer will be in 32-bit by default. If you are using 64-bit Microsoft Excel, you would need to re-compile RTD server dll file into 64-bit and register the library by re-building the RTD source solution using Visual Studio. Please refer to the TWS Excel APIs, featuring the RealTimeData Server recorded webinar for detailed instructions.

TWS RTD Server Formula Syntax

Customer can request market data by entering the following formula with corresponding parameters into an Excel spreadsheet cell:

=RTD(ProgID, Server, String1, String2, ...)


  • ProgID = "Tws.TwsRtdServerCtrl"
  • Server = "" (empty string)
  • String1, String2, ... is a list of strings representing Ticker, Topic, Connection Parameters or other Complex Syntax strings.

Note: TWS RTD Server API formula is not case-sensitive.

There are three ways to compose an RTD Formula:

Syntax Samples

A resourceful Syntax Samples page is provided for demonstration of RTD formulas categorized by security type using different syntaxs.

Besides reading through the written documentation, you can also watch the TWS Excel APIs, featuring the RealTimeData Server recorded webinar for a more interactive tutorial video.

Change Data Refresh Rate

Troubleshooting Common Errors