Coder Social home page Coder Social logo

docker-ib-tws's Introduction

Dockerized IB Trader Workstation (TWS)

Abstract

This is a docker container for IB TWS that includes the requisite dependencies.

Trader Workstation (TWS) is Interactive Brokers trading platform. The platform is a Java application which IB packages in the form of an install4j-based installer made available for download from its website. The installer also deploys a suitable version of the Oracle Java JRE.

The container is based on Debian (stretch) and includes the library dependencies, as well as the Firefox web browser and the Droid Sans Mono (w/slashed zero) and Droid Sans Mono (w/dotted zero) fonts. Several configuration tweaks are also applied to ensure optimal font rendering and performance.

Due to licensing restrictions, this container is only made available as a Dockerfile to be built by the end user, and not as a ready-to-run pre-built container.

Basic usage

Begin by checking out the Dockerfile and building the container:

git clone https://github.com/wk/docker-ib-tws.git
sudo docker build -t ib-tws docker-ib-tws

Three release trains (stable, latest, beta) of IB TWS are available for two architectures (x86, x64). By default, the container will include a build of the latest train for x64 architecture. This can be modified by setting the version and arch arguments at build time. For example, you can build a container that includes the current beta release instead:

sudo docker build --build-arg version=beta -t ib-tws docker-ib-tws

You will typically want to launch the container locally on a host with a X server. Certain arguments must be passed to the container for X authentication and display to succeed. This has been tested on Ubuntu and Debian hosts:

First, authorize X socker connectivity:

xhost +local:root

Then, launch the container:

sudo docker run --name=ib-tws --detach=true -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --device /dev/snd ib-tws

After the initial invocation, you can re-start the container as following:

sudo docker start ib-tws

The container will stop when the application terminates.

Configuration

By default, an empty jts.ini file is injected into the container. This file can be replaced with user-supplied configuration prior to building the container in order to override some defaults prior to first run.

API connectivity

IB TWS can expose a TCP port on which an API is presented. Since IB TWS 954, two ports are used by default. In live trading mode, the API is presented on port 7496, in paper trading mode, the API is presented on port 7497.

You can expose these ports by initially launching the container as so:

sudo docker run --name=ib-tws --detach=true --publish=7496:7496 --publish=7497:7497 -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --device /dev/snd ib-tws

Caveats

  • Due to docker's one process per container model, the install4j upgrade functionality will not succeed. Instead, the container should be rebuilt when a new release is available upstream.
  • No effort is made to expose accelerated video devices of the host into the container, as a result Bloomberg TV may not function correctly.

Disclaimer

This method of deploying IB TWS is not endorsed nor supported by IB.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.