/docker-tws

Primary LanguagePythonOtherNOASSERTION

docker-tws

Docker image for Interactive Brokers TWS hosted by IBC running under TightVNC.

  • User configuration is cleanly separated, allowing one computer to serve many accounts, store configuration in Kubernetes secrets, and for one-size-fits-all images to exist on Docker Hub.

  • In line with Kubernetes best practice, IBC and TWS logs are redirected to container stdout.

  • Docker Hub images are completely transparent, except for upload credentials. CI configuration is checked in, and the build log for each cryptographic image digest can be audited via GitHub Actions.

Usage

docker run \
    --rm -it \
    -e VNC_PASSWORD=123 \
    -p 127.0.0.1:5900:5900 \
    -p 127.0.0.1:7496:7496 \
    dockertws/dockertws:ci

Optionally supply credentials using:

    -e IBC_USERNAME=myuser123
    -e IBC_PASSWORD=OpenSesame

Optionally supply jts.ini and tws.xml from an existing TWS installation using:

    -v /path/to/jts.ini:/conf/jts.ini:ro
    -v /path/to/tws.xml:/conf/tws.xml:ro

Exposed Ports

Port Description
5900 VNC display
7462 IBC telnet server
7496 TWS API live trading account
7497 TWS API paper trading account

Volumes

All paths are optional.

Path Description
/conf Read-only directory of configuration files to install. Usable as a Docker or Kubernetes volume
/conf/jts.ini File to install as ~tws/Jts/jts.ini
/conf/tws.xml File to install as ~tws/Jts/[profile]/tws.xml. If provided, jts.ini must also be provided, as it is needed to detect the profile name

Environment Variables

See the IBC documentation for a description of IBC settings.

Key Default Description
JVM_HEAP_SIZE 4096m Value of `-Xmx` JVM flag in `tws.vmoptions`
IBC_USERNAME
IBC_PASSWORD
IBC_FIX no
IBC_FIX_USERNAME
IBC_FIX_PASSWORD
IBC_TRADING_MODE live
IBC_SEND_TWS_LOGS_TO_CONSOLE yes If `true`, TWS diagnostic logs will also be sent to the container's stdout
IBC_STORE_SETTINGS_ON_SERVER no
IBC_MINIMIZE_MAIN_WINDOW no
IBC_MAXIMIZE_MAIN_WINDOW yes
IBC_EXISTING_SESSION_DETECTED manual
IBC_ACCEPT_INCOMING_CONNECTION accept
IBC_SHOW_ALL_TRADES no
IBC_READONLY_LOGIN no
IBC_READONLY_API
IBC_ACCEPT_NON_BROKERAGE_WARNING yes
IBC_AUTO_CLOSEDOWN yes
IBC_CLOSEDOWN_AT
IBC_ALLOW_BLIND_TRADING no
IBC_DISMISS_PASSWORD_EXPIRY no
IBC_DISMISS_NSE_COMPLIANCE yes
IBC_SAVE_TWS_SETTINGS_AT
IBC_CONTROL_FROM 172.17.0.1
IBC_COMMAND_PROMPT IBC>
IBC_SUPPRESS_INFO_MESSAGES yes
IBC_LOG_COMPONENTS never
TZ America/New_York Container timezone, used by TWS to render timestamps
VNC_PASSWORD (random) VNC server password. If unspecified, a random password is logged to stdout
VNC_NAME tws-tradingmode-username VNC desktop name
VNC_DEPTH 24 VNC desktop color depth
VNC_GEOMETRY 1920x1080 VNC desktop resolution
X11_ROOT_COLOR #36648B xsetroot background color

Base System

Ubuntu 20.04

Package Description
wget Used to fetch TWS installer
ca-certificates Inherited from original docker-tws reop
tightvncserver The VNC server
openbox The window manager
xterm Terminal emulator
google-chrome-stable Allows account management, audit trail, 3D volatility surface to be opened
unzip Used to extract IBC
openjfx Needed at least for online help, "No toolkit found" exception in logs otherwise
openjdk-8-jre Possibly optional, or required otherwise data feeds fail to connect
fonts-liberation Required for Google Chrome
libavcodec58 Required for sound playback
libavformat58 Required for sound playback
libappindicator3-1 Required for Google Chrome
libgbm1 Required for Google Chrome
libxslt1.1 Required for JavaFX WebKit (iBot, various other TWS embedded web views)
libxss1 Required for Google Chrome
xdg-utils Required for Google Chrome