You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+46-13Lines changed: 46 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,24 +14,26 @@ It includes:
14
14
-[x11vnc](https://wiki.archlinux.org/title/x11vnc) - a VNC server to interact with the IB Gateway user interface (optional, for development / maintenance purpose).
15
15
-[socat](https://manpages.ubuntu.com/manpages/jammy/en/man1/socat.1.html) a tool to accept TCP connection from non-localhost and relay it to IB Gateway from localhost (IB Gateway restricts connections to container's 127.0.0.1 by default).
16
16
- Optional remote [SSH tunnel](https://manpages.ubuntu.com/manpages/jammy/en/man1/ssh.1.html) to provide secure connections for both IB Gateway and VNC. Only available for `10.19.2g-stable` and `10.25.1o-latest` or greater.
17
+
- As of `10.26.1h` it includes a **beta** container image with TWS and a minimal desktop environment(build on top of [linuxserver/rdesktop](https://github.com/linuxserver/docker-rdesktop/)). Available on github's [container repository](https://github.com/gnzsnz/ib-gateway-docker/pkgs/container/tws-rdesktop).
17
18
- Works well together with [Jupyter Quant](https://github.com/gnzsnz/jupyter-quant) docker image.
18
19
19
20
## Supported Tags
20
21
21
22
| Channel | IB Gateway Version | IBC Version | Docker Tags |
All [tags](https://github.com/gnzsnz/ib-gateway-docker/pkgs/container/ib-gateway/) are available in the container repository.
27
+
All [tags](https://github.com/gnzsnz/ib-gateway-docker/pkgs/container/ib-gateway/) are available in the container repository. IB Gateway and TWS share the same version numers and tags, TWS tags are available on it's [container repository](https://github.com/gnzsnz/ib-gateway-docker/pkgs/container/tws-rdesktop).
27
28
28
-
## How to use?
29
+
## How to use it?
29
30
30
31
Create a `docker-compose.yml` (or include ib-gateway services on your existing one)
The image can be configured with the following environment variables:
83
+
For TWS there is a sample compose file [available](https://github.com/gnzsnz/ib-gateway-docker/blob/master/tws-docker-compose.yml).
84
+
85
+
All environment variables are common between ibgateway and TWS image, unless specifically stated. The image can be configured with the following environment variables:
78
86
79
87
| Variable | Description | Default |
80
88
| -------- | ----------- | -------- |
81
89
|`TWS_USERID`| The TWS **username**. ||
82
90
|`TWS_PASSWORD`| The TWS **password**. ||
83
91
|`TRADING_MODE`|**live** or **paper**|**paper**|
84
92
|`READ_ONLY_API`|**yes** or **no**. [See IBC documentation](https://github.com/IbcAlpha/IBC/blob/master/userguide.md)|**not defined**|
85
-
|`VNC_SERVER_PASSWORD`| VNC server password. If not defined, then VNC server will NOT start. |**not defined** (VNC disabled)|
93
+
|`VNC_SERVER_PASSWORD`| VNC server password. If not defined, then VNC server will NOT start. Specific to ibgateway, ignored by TWS. |**not defined** (VNC disabled)|
86
94
|`TWOFA_TIMEOUT_ACTION`| 'exit' or 'restart', set to 'restart if you set `AUTO_RESTART_TIME`. See IBC [documentation](https://github.com/IbcAlpha/IBC/blob/master/userguide.md#second-factor-authentication)| 'exit' |
95
+
|`BYPASS_WARNING`| Settings relate to the corresponding 'Precautions' checkboxes in the API section of the Global Configuration dialog. Accepted values `yes`, `no` if not set, the existing TWS/Gateway configuration is unchanged |**not defined**|
87
96
|`AUTO_RESTART_TIME`| time to restart IB Gateway, does not require daily 2FA validation. format hh:mm AM/PM. See IBC [documentation](https://github.com/IbcAlpha/IBC/blob/master/userguide.md#ibc-user-guide)|**not defined**|
97
+
|`AUTO_LOGOFF_TIME`| Auto-Logoff: at a specified time, TWS shuts down tidily, without restarting |**not defined**|
98
+
|`SAVE_TWS_SETTINGS`| automatically save its settings on a schedule of your choosing. You can specify one or more specific times, ex `SaveTwsSettingsAt=08:00 12:30 17:30`|**not defined**|
88
99
|`RELOGIN_AFTER_2FA_TIMEOUT`| support relogin after timeout. See IBC [documentation](https://github.com/IbcAlpha/IBC/blob/master/userguide.md#second-factor-authentication)| 'no' |
89
100
|`TIME_ZONE`| Support for timezone, see your TWS jts.ini file for [valid values](https://ibkrguides.com/tws/usersguidebook/configuretws/configgeneral.htm) on a [tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). This sets time zone for IB Gateway. If jts.ini exists it will not be set. if `TWS_SETTINGS_PATH` is set and stored in a volume, jts.ini will already exists so this will not be used. Examples `Europe/Paris`, `America/New_York`, `Asia/Tokyo`| "Etc/UTC" |
90
101
|`TWS_SETTINGS_PATH`| Settings path used by IBC's parameter `--tws_settings_path`. Use with a volume to preserve settings in the volume. ||
91
102
|`CUSTOM_CONFIG`| If set to `yes`, then `run.sh` will not generate config files using env variables. You should mount config files. Use with care and only if you know what you are doing. | NO |
92
-
|`SSH_TUNNEL`| If set to `yes` then `socat` won't start and a remote ssh tunnel is started. SSH keys should be provided to container through ~/.ssh volume. |**not defined**|
103
+
|`SSH_TUNNEL`| If set to `yes` then `socat` won't start, instead a remote ssh tunnel is started. SSH keys should be provided to container through ~/.ssh volume. |**not defined**|
93
104
|`SSH_OPTIONS`| additional options for [ssh](https://manpages.ubuntu.com/manpages/jammy/en/man1/ssh.1.html) client |**not defined**|
94
105
|`SSH_ALIVE_INTERVAL`|[ssh](https://manpages.ubuntu.com/manpages/jammy/en/man1/ssh.1.html)`ServerAliveInterval` setting. Don't set it in `SSH_OPTIONS` as this behavior is undefined. | 20 |
95
106
|`SSH_ALIVE_COUNT`|[ssh](https://manpages.ubuntu.com/manpages/jammy/en/man1/ssh.1.html)`ServerAliveCountMax` setting. Don't set it in `SSH_OPTIONS` as this behavior is undefined. | 3 |
96
107
|`SSH_PASSPHRASE`| passphrase for ssh keys. If set the container will start ssh-agent and add ssh keys |**not defined**|
97
108
|`SSH_REMOTE_PORT`| Remote port for ssh tunnel. | Same port than IB gateway 4001/4002 |
98
109
|`SSH_USER_TUNNEL`|`user@server` to connect to |**not defined**|
99
110
|`SSH_RESTART`| Number of seconds to wait before restarting tunnel in case of disconnection. | 5 |
100
-
|`SSH_VNC_PORT`| If set, then a remote ssh tunnel will be created with remote port equal to `SSH_VNC_PORT`|**not defined**|
111
+
|`SSH_VNC_PORT`| If set, then a remote ssh tunnel will be created with remote port equal to `SSH_VNC_PORT`. Specific to ibgateway, ignored by TWS. |**not defined**|
112
+
|`SSH_DRP_PORT`| If set, then a remote ssh tunnel will be created with remote port equal to `SSH_DRP_PORT`. Specific to TWS, ignored by ibgateway. |**not defined**|
113
+
|`PUID`| User `uid` for user `abc` (linuxserver default user name). Specific to TWS, ignored by ibgateway. | 1000 |
114
+
|`PGID`| User `gid` for user `abc` (linuxserver default user name). Specific to TWS, ignored by ibgateway. | 1000 |
115
+
|`PASSWD`| Password for user `abc` (linuxserver default user name). Specific to TWS, ignored by ibgateway. | abc |
101
116
102
117
Create an .env on root directory. Example .env file:
103
118
104
-
```text
119
+
```bash
105
120
TWS_USERID=myTwsAccountName
106
121
TWS_PASSWORD=myTwsPassword
122
+
#TWS_SETTINGS_PATH=/home/ibgateway/Jts
107
123
TWS_SETTINGS_PATH=
108
124
TRADING_MODE=paper
109
125
READ_ONLY_API=no
110
126
VNC_SERVER_PASSWORD=myVncPassword
111
127
TWOFA_TIMEOUT_ACTION=restart
128
+
BYPASS_WARNING=
112
129
AUTO_RESTART_TIME=11:59 PM
130
+
AUTO_LOGOFF_TIME=
131
+
SAVE_TWS_SETTINGS=
113
132
RELOGIN_AFTER_2FA_TIMEOUT=yes
114
133
TIME_ZONE=Europe/Lisbon
115
134
CUSTOM_CONFIG=
@@ -138,6 +157,14 @@ After image is downloaded, container is started + 30s, the following ports will
138
157
| 4004 | TWS API port for paper accounts. Through socat, internal TWS API port 4002. Mapped **externally** to 4002 in sample `docker-compose.yml`. |
139
158
| 5900 | When `VNC_SERVER_PASSWORD` was defined, the VNC server port. |
140
159
160
+
TWS image uses the following ports
161
+
162
+
| Port | Description |
163
+
| ---- | ---------------------------------- |
164
+
| 7498 | TWS API port for live accounts. Through socat, internal TWS API port 4001. Mapped **externally** to 7497 in sample `tws-docker-compose.yml`. |
165
+
| 7499 | TWS API port for paper accounts. Through socat, internal TWS API port 4002. Mapped **externally** to 7498 in sample `tws-docker-compose.yml`. |
166
+
| 3389 | Port for RDP server. Mapped **externally** to 3370 in sample `tws-docker-compose.yml`. |
167
+
141
168
Utility [socat](https://manpages.ubuntu.com/manpages/jammy/en/man1/socat.1.html) is used to publish TWS API port from container's `127.0.0.1:4001/4002` to container's `0.0.0.0:4003/4004`, the sample `docker-file.yml` maps ports to the host back to `4001/4002`. This way any application can use the "standard" IB Gateway ports.
142
169
143
170
Note that with the above `docker-compose.yml`, ports are only exposed to the docker host (127.0.0.1), but not to the host network. To expose it to the host network change the port mappings on accordingly (remove the '127.0.0.1:'). **Attention**: See [Leaving localhost](#leaving-localhost)
@@ -146,14 +173,15 @@ Note that with the above `docker-compose.yml`, ports are only exposed to the doc
146
173
147
174
Most if not all of the settings needed to run IB Gateway in a container are available as environment variables.
148
175
149
-
However, if you need to go beyond what's available, the image can be customized by overwriting the default configuration files with custom ones. To do this you must set environment variable `CUSTOM_CONFIG=yes`. By setting `CUSTOM_CONFIG=yes``run.sh` script will not replace environment variables on config files. You must provide config files ready to be used by IB gateway and IBC, please make sure that you are familiar with [IBC](https://github.com/IbcAlpha/IBC/blob/master/userguide.md) settings.
176
+
However, if you need to go beyond what's available, the image can be customized by overwriting the default configuration files with custom ones. To do this you must set environment variable `CUSTOM_CONFIG=yes`. By setting `CUSTOM_CONFIG=yes``run.sh` script will not replace environment variables on config files. You must provide config files ready to be used by IB gateway/TWS and IBC, please make sure that you are familiar with [IBC](https://github.com/IbcAlpha/IBC/blob/master/userguide.md) settings.
0 commit comments