In https://www.interactivebrokers.com/en/index.php?f=5041&ns=T it is written that in order to use the IB api you have to connect to it through the TWS or IB Gateway.
Our API requires connectivity via Trader Workstation (TWS) or IB Gateway.
What is the advantage of each? What solution (Gateway or TWS) provides a better performance?
IB Gateway is Interactive Brokers' software application that acts as a bridge between a FIX engine and the IB trading system. It is required for FIX CTCI connections over the Internet. The gateway client is a java program, allowing it to run on any machine that has the Java Runtime Environment installed on it.
Our market maker-designed IB Trader Workstation (TWS) lets traders, investors and institutions trade stocks, options, futures, currencies, bonds and funds on over 150 markets worldwide from a single unified platform. Research, News. and Market Data. Read More. Real-Time.
The TWS API is a simple yet powerful interface to automate your trading strategies, request market data and monitor your account balance and portfolio in real time. Build your own trading application or connect your custom application to TWS so that you can take advantage of our advanced trading tools.
Steps to Configure the Trader Workstation (TWS)Check the “Enable ActiveX and Socket Clients” box. Check the “Create API message log file” box. Check the 'Include market data in API log file' box. Finally, click on the “Apply” shown at the bottom of the API settings page and click OK.
The Gateway lacks the GUI of the TWS, but provides the same API.
IB writes about the performance:
The IB Gateway provides a low-resource alternative to TWS for connecting to the IB trading system via the API. The gateway uses approximately 40% fewer system resources than TWS. However, the gateway is GUI-less, which means that you cannot view the API activity as you can when running TWS.
It also has an advantage concerning the automatic logout of TWS:
according to "Dmitry’s TWS API FAQ":
You can also use IB Gateway which is essentially a striped down version of TWS. Unlike TWS, IB Gateway will try to maintain a connection to IB for much longer than 24 hours. There is no guarantee that IB Gateway will keep the connection up for more than a week but this does happen.
If you don't need the full GUI of the TWS while you are developing or while your application is deployed, use the gateway. It provides the same API functionlity with much less overhead.
For all kinds of TWS API related questions I suggest having a look at the IB TWS API Yahoo Group, and "Dmitry’s TWS API FAQ".
This is a reply from IB tech support:
From the API point of view both platforms are identical. The only difference between them is that the TWS has a much richer interface through which you can place orders, view charts, etc. The IB Gateway is just a proxy with a simple interface aimed at providing the most basic features in order to connect via the API.
More important though, the TWS requires to be restarted at least every 24 hours whereas the IB Gateway can run indefinitely.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With