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:
-
Python (3.11)
-
IB Gateway (stable, latest)
-
IBC (3.18.0)
-
ib_insync (0.9.72)
-
google-cloud-secret-manager (2.11.1)
The Docker images are updated every Sunday.
docker pull rylorin/ib-gateway-docker
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
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
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 |
The test cases written with testinfra.
Run the tests
pytest
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 |
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 |
This project is not affiliated with Interactive Brokers Group, Inc.'s.
Good luck and enjoy.