This container is made up of the following two components:
- Interactive Brokers IB Gateway
- IB Controller which allows running IB Gateway in an automated fashion
The following environment variables are relevant for the IB Controller container:
- TWS_USERNAME (default: edemo)
- TWS_PASSWORD (default: demouser)
To run IB Gateway on a headless server (i.e. the Docker container) an xvfb virtual frame buffer is used.
Unfortunately only few settings of the IB Gateway can be managed via the IB Controller. All other settings have to be managed via the IB Gateway UI itself which is not visible on the Docker container.
This is especially cumbersome for the Read-Only API trading mode that the is used by the IB Gateway by default. If this mode is active placement of orders is not allowed.
To change any of the IB Gateway settings (e.g. Read-Only API trading mode) please execute the following steps:
- The IB Gateway container stores IB settings inside a Docker Volume. This volume can be mapped to a local directory as follows.
On Linux and Mac:
volumes: - /var/lib/tws:/var/lib/tws
This will make IB Gateway settings available in the local directory /var/lib/tws
volumes: - /c/Users/Administrator/Documents/tws:/var/lib/tws
This will make IB Gateway settings available in the local directory c:\Users\Administrator\Documents\tws
Install and start IB Gateway on a regular workstation (Windows, Mac or Linux)
Go to Configure / Settings / API / Settings
Make necessary changes (e.g. deselect the Read-Only API check box) and click OK
Close the IB Gateway
Inside the IB Gateway installation folder there will be one or multiple sub-directories starting with have a name made up of 8-9 characters starting with a the letter d. Please select the directory with the latest time-stamp and makes sure it contains a file named ibg.xml
Copy this directory (e.g darykqwzr) into the IB Gateway settings directory linked above:
Copy the jts.ini file into the IB Gateway settings directory linked above:
Start the IB Gateway Docker Container:
The above steps will not work for the public edemo account which gets reset upon each startup.