EnglishTWS

Installation IBController for automatic 24h stock trading (part 2)

tradingtech_tws_001

In the first part of this article, “Installation IBController for automatic 24h stock trading (part 1)”, we have downloaded and installed all important programs. In this second part we would like to complete the initial configuration of IBController to enable you a 24/7 continuous operation on stock trading.

Windows vs. Linux vs. Macintosh

TWS is based on the programming language Java which is a platform-independent language and can be used on any operating system. The following description is basically for all Windows users, but it can also be used for other platforms such as Linux or Macintosh.

Installation IBController

Locate your TWS installation directory. You should usually find this directory in directory JTS on your hard drive C.

C:\Jts

We see a subfolder for each version (e.g. Generic, 952, 958, 960) of the TWS in the JTS directory. We currently have only one TWS version installed on our system and therefore we do see only one subfolder with the version number 960 in our Windows Explorer.

jts

IBController does not have a sophisticated installation procedure because you are able to install it by coping the data into the target folder. Now move the content of the IBController *.zip file into a new directory on your hard drive C.

C:\IBController

Open with a text editor the two *.bat files IBControllerStart.bat and IBControllerGatewayStart.bat in the IBController directory and update the TWS version number you are using. We use 960, so we change this version number one time in both *.bat files to this version number, save the files and close the editor.

set TWS_MAJOR_VRSN=960

The *.sh files are “shell scripts” and are required for Linux and Macintosh. If you are using these operating systems you should update the *.sh files instead of the *.bat files.

Configuration IBController

The configuration of IBController is done via the INIT file with the name IBController.ini. The file is delivered in the *.zip file.

Now create another IBController Folder in your personal user directory.

C:\Users\Simon\Documents\IBController

Move the INIT file from above from the IBController installation directory to your newly created directory in your user directory.

init_file

In this INIT file in your user directory, we will now make all configurations. Open the INIT file in an editor and scroll down to the IB API Authentication Settings area. In this area you should enter your login data for your broker (Interactive Broker or Captrader). Login data is required to allow IBController the automatically log in to your broker.
Scroll down to IbAutoClosedown (area 4) and set this to IbAutoClosedown=no. This setting allows us to trade an automatic 24/7 stock trading because TWS is no longer automatically closed.
In addition, the following items should be adapted in the INIT file:
  • LogToConsole=yes (area 1)
    From our point of view, this setting is an advantage because the more logging data is generated, the easier is it to search for errors.
  • ClosedownAt=Saturday 21:00 (area 5)
    It is recommended to restart the TWS in regular intervals. This setting would shut down the TWS every Saturday night.
    If you have installed the german version of JAVA you should format this text in german language: Samstag 21:00. More information about localization and date objects please have a look in the java docs: http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html#text
After we have saved and closed the INIT file, the configuration is ready and we are able to start our IBController by double-clicking the start file IBControllerStart.bat.

Autostart TWS using Task Scheduler

Basically the TWS is able to work in 24/7 operation when we start the IBController via the * .bat file. There is an additional possibility for automation using task scheduler. In this case TWS would automatically start in 24/7 mode each time the computer was started.
Have fun with 24/7 trading of financial products using TWS!
Share