Skip to content

rylorin/ib-gateway-docker

 
 

Repository files navigation

Interactive Brokers Gateway (IBG) Docker container for Guerrilla Trading Platform (GTP)

Build test Docker Pulls GitHub

This container is based on work from manhinhang with the following changes:

  • VNC server added (can be activated upon user's choice). Because it's sometimes usefull to see what's going on the gateway.
  • Health-check based on Docker's native feature added. Because the container must be restarted if needed.

More information available on Github repository.

This docker image contains:

Pull the Docker image from Docker Hub

The Docker images are updated every Sunday.

docker pull rylorin/ib-gateway-docker

Create a container from the image and run it

docker run -d \
--env IB_ACCOUNT= \ # YOUR_USER_ID 
--env IB_PASSWORD= \ # YOUR_PASSWORD  
--env TRADE_MODE= \ # paper or live 
--publish 4002:4002 \ # brige IB gateway port to your local port 4002
--publish 5900:5900 \ # VNC server running on local port 5900
rylorin/ib-gateway-docker tail -f ./Jts/launcher.log

Build & Run locally

git clone https://github.com/rylorin/ib-gateway-docker.git
cd ib-gateway-docker
docker build -t ib-gateway-docker .
docker run -d \
--env IB_ACCOUNT= \ #YOUR_USER_ID 
--env IB_PASSWORD= \ #YOUR_PASSWORD  
--env TRADE_MODE= \ #paper or live 
-p 4002:4002 \ #brige IB gateway port to your local port 4002
ib-gateway-docker \
tail -f /dev/null

Container usage example

Example Link Description
ib_insync examples/ib_insync This example demonstrated how to connect IB Gateway
google cloud secret manager examples/google_cloud_secret_manager retreive your interactive brokers account from google cloud secret manager

Tests

The test cases written with testinfra.

Run the tests

pytest

Github Actions for continuous integration

After forking IB Gateway docker repository, you need config your interactive brokers paper account & password in github secret

Key Description
IB_ACCOUNT your paper account name
IB_PASSWORD your paper account password

Other environment variables

Variable Name Description Default value
IB_GATEWAY_PING_CLIENT_ID Docker healthcheck client id Random
IBGW_WATCHDOG_CLIENT_ID IB client id used for Watchdog Random
IBGW_WATCHDOG_CONNECT_TIMEOUT Ref to ib_insync.ibcontroller.Watchdog.connectTimeout 30
IBGW_WATCHDOG_APP_STARTUP_TIME ib_insync.ibcontroller.Watchdog.appStartupTime 30
IBGW_WATCHDOG_APP_TIMEOUT Ref to ib_insync.ibcontroller.Watchdog.appTimeout 30
IBGW_WATCHDOG_RETRY_DELAY Ref to ib_insync.ibcontroller.Watchdog.retryDelay 2
IBGW_WATCHDOG_PROBE_TIMEOUT Ref to ib_insync.ibcontroller.Watchdog.probeTimeout 4
VNC_SERVER_PASSWORD VNC server password. If no password provided then VNC server won't start None

Disclaimer

This project is not affiliated with Interactive Brokers Group, Inc.'s.

Good luck and enjoy.

Packages

No packages published

Languages

  • Python 70.8%
  • Dockerfile 20.9%
  • Shell 8.3%