Interactive Brokers
Video Tutorial
API TWS configuration
beeTrader interfaces to Interactive Brokers through the TWS platform, or the IB Gateway. For both software provided by Interactive Brokers it is recommended to always use the “Latest” version, ie the latest version. Using this broker it is possible to access the historical data of almost all financial instruments, be they securities, futures or commodities and it is also possible to obtain the Options Chain.The first step is to go to the global configurations of the TWS or Getaway platform and activate the API by going to the global settings path –> API –> Settings and set everything as shown in the images below.
Features
The connection between beeTrader and Interactive Brokers occurs through the creation and connection of the assets in Symbol Manager.
Paging Violation: Interactive Brokers has some data request limitations. For example, you cannot make more than 60 requests in 10 minutes. The limitations imposed by TWS can generate errors that are called “Pacing Violation”. When beeTrader receives this error from TWS it immediately informs the user through a message.
In order to restore Pacing Violation, TWS can be restarted or you can press Ctrl + Alt + F in the IB TWS window to force TWS to reconnect to its data servers .
For more information, see the page Historical Data Limitations di Interactive Brokers.
Example of Future connection
Once the asset has been created, as shown in the section of the manual Symbol Manager, we now proceed to the connection.
Through the registry of the asset to be used (in this case the future E-MINI SP 500 expires 09-18) available directly from the TWS platform, it is possible to obtain all the parameters necessary for the connection between beeTrader and Interactive Brokers.
- Symbol: it is the symbol of the asset as requested by the broker;
- Exchange: is the market the instrument belongs to;
- Primary Exchange: to be filled only if Exchange is SMART, in this case type the real market of the asset;
- Expiry Date: it is the expiry date of the asset to be typed in the format YYYYMMDD;
- Multiplier: is the value of the asset multiplier;
- Broker Costs: is the commission cost provided by the broker. If the desired one is not present, or you wish to make changes, the commission profiles are available in Symbol Manager under Broker Costs.
All the required parameters can be retrieved from the TWS Description window obtained by clicking with the right mouse button on the asset.
Example of stock connection
Once the asset has been created, as shown in the section of the manual Symbol Manager, we now proceed to the connection.
Through the registry of the asset to be used (in this case Volkswagen AG) available directly from the TWS platform, it is possible to obtain all the parameters necessary for the connection between beeTrader and Interactive Brokers.
- Symbol: it is the symbol of the asset as requested by the broker;
- Exchange: is the market the instrument belongs to;
- Primary Exchange: to be filled only if Exchange is SMART, in this case type the real market of the asset;
- Broker Costs: is the commission cost provided by the broker. If the desired one is not present, or you wish to make changes, the commission profiles are available in Symbol Manager under Broker Costs.
All the required parameters can be retrieved from the TWS Description window obtained by clicking with the right mouse button on the asset.
Example of Futures Chain and Options connection Chain
Once the asset has been created, as shown in the section of the manual Symbol Manager , and connected it as illustrated above, we proceed to link the Futures Chain.
Then select the desired asset and right-click to select New Futures Chain.
Through the registry of the asset you want to use (in this case the Volkswagen AG futures) available directly from the TWS platform, it is possible to obtain all the parameters necessary for the connection between beeTrader and Interactive Brokers.
- Symbol: it is the symbol of the asset as requested by the broker;
- Exchange: is the market the instrument belongs to;
- Primary Exchange: to be filled only if Exchange is SMART, in this case type the real market of the asset;
- Multiplier: is the value of the asset multiplier;
- Broker Costs: is the commission cost provided by the broker. If the desired one is not present, or you wish to make changes, the commission profiles are available in Symbol Manager under Broker Costs.
On the settings window there is the Test Settings button that checks by downloading the chain from the broker if the settings are correct. If the settings are not correct an empty window will appear, if they are correct a window will appear containing the chain.
All the required parameters can be retrieved from the TWS Description window obtained by clicking with the right mouse button on the asset.
Similarly, select the desired asset and right-click to select New Options Chain.
- Symbol: it is the symbol of the asset as requested by the broker;
- Exchange: is the market the instrument belongs to;
- Primary Exchange: to be filled only if Exchange is SMART, in this case type the real market of the asset;
- Multiplier: is the value of the asset multiplier;
- Trading Class: is the trading class that identifies a particular type of option (for example the weeklies), if this field is empty all the options are used. For more information there is a specific paragraph later on this page;
- Broker Costs: is the commission cost provided by the broker. If the desired one is not present, or you wish to make changes, the commission profiles are available in Symbol Manager under Broker Costs.
On the settings window there is the Test Settings button that checks by downloading the chain from the broker if the settings are correct. If the settings are not correct an empty window will appear, if they are correct a window will appear containing the chain.
All the required parameters can be retrieved from the TWS Description window obtained by clicking with the right mouse button on the asset.
If you encounter difficulties in connecting new assets, we recommend that you refer to those already entered to verify the correct parameters.
Expiry of a Future
As we all know, futures, both on indices and on commodities and on bonds, are subject to expiry which usually occurs every three months, but can also occur every month. In Symbol Manager an expired future is highlighted in red at this point therefore, it is necessary to replace the asset.
Thinking of this need, the Clone command is present which allows, once an asset is selected, to clone it into a new one that will keep all the parameters of the previous one except Name and Expiry. Using the Clone function, replacing an expired future becomes much faster.
The expired symbol is highlighted in red.
Since the default symbols are not editable, we select the future expired and click on the CLONE button.
At this point we are required to assign a name to the new asset, we call it CRUDE OIL 12-18.
We proceed to modify the date directly from the main screen, this change is automatically reported also in the Interactive Brokers connection setup window.
In a few steps the new CRUDE OIL 12-18 asset was created by cloning the expired CRUDE OIL 09-18
At each quarterly expiry the list of symbols is in any case updated automatically.
Trading Classes
For some underlying Interactive Brokers provides the grouping of options for “Trading Class”. As can be seen from the image below (Options on E-Mini Sp500 futures) the EW1 class trading corresponds to the weekly expiry of the first week of the month, EW2 corresponds to the weekly expiry of the second week of the month, EW3 corresponds to the weekly expiry of the third week week of the month, EW4 corresponds to the weekly deadline of the fourth week week of the month, ES corresponds instead to the quarterly expiry.
In the Options Chain link window there is a Trading Class field, if filled in it only shows the expiration dates for the selected trading class, if not filled it shows all the expirations available on the TWS. It is possible to set several Trading Classes separating them with the character; without spaces.