Note that sample123 will have to be replaced with the exact same user name entered when logging into the TWS. As a first example, we will request FX market data (EUR.USD). The formula to start the request will need to provide the TWS with enough information so that the TWS can unambiguously identify which instrument we are interested in. Please make sure you have already acquired What You Will Need before going forward in this tutorial.
#Excel api vba code
All the VBA code is kept to a minimum and its purpose is merely illustrative. This document is a brief tutorial explaining the process behind market data retrieval through MS Excel via the TWS DDE API. Market Data retrieval requires at least two different DDE links: one to start the market data subscription and another one which will be receiving the specific tick type. Requests via the TWS DDE API are nothing but Excel formulas (DDE data links) each of them serving a very specific purpose. It is possible to view live quotes for multiple products updating real time within Excel. All our sample applications are merely a demonstration of the API capabilities aimed at experienced programmers who will in turn use them as a reference to develop more complex and robust systems. Customers, however, need to be aware of the fact that the distributed sheets are not tools to be used on a daily basis. Since the TWS does not have functionality to export intra-day, customers are often directed at the TWS API and its Excel sheets in particular. One of the most common inquiries we receive at Interactive Brokers is about export data from the TWS into Excel.