{"id":13682019,"url":"https://github.com/UnusualAlpha/ib-gateway-docker","last_synced_at":"2025-04-30T06:33:22.655Z","repository":{"id":37205737,"uuid":"503930137","full_name":"UnusualAlpha/ib-gateway-docker","owner":"UnusualAlpha","description":"Docker image with IB Gateway and IBC","archived":false,"fork":false,"pushed_at":"2024-10-24T08:23:03.000Z","size":208,"stargazers_count":228,"open_issues_count":118,"forks_count":91,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-25T06:39:23.748Z","etag":null,"topics":["docker","ib-api","ib-gateway","ibgateway","ibkr","ibkr-api","interactive-brokers","quant","quantitative-finance","trading","trading-bot","tws"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"waytrade/ib-gateway-docker","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UnusualAlpha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-15T21:40:48.000Z","updated_at":"2024-10-18T04:41:39.000Z","dependencies_parsed_at":"2023-02-11T21:05:39.053Z","dependency_job_id":"742fbbfd-e236-4b68-af27-014616beda0e","html_url":"https://github.com/UnusualAlpha/ib-gateway-docker","commit_stats":null,"previous_names":[],"tags_count":154,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UnusualAlpha%2Fib-gateway-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UnusualAlpha%2Fib-gateway-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UnusualAlpha%2Fib-gateway-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UnusualAlpha%2Fib-gateway-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UnusualAlpha","download_url":"https://codeload.github.com/UnusualAlpha/ib-gateway-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224201807,"owners_count":17272646,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","ib-api","ib-gateway","ibgateway","ibkr","ibkr-api","interactive-brokers","quant","quantitative-finance","trading","trading-bot","tws"],"created_at":"2024-08-02T13:01:39.290Z","updated_at":"2024-11-12T01:30:50.730Z","avatar_url":"https://github.com/UnusualAlpha.png","language":"Dockerfile","funding_links":[],"categories":["Dockerfile"],"sub_categories":[],"readme":"# Interactive Brokers Gateway Docker\n\n\u003cimg src=\"https://github.com/UnusualAlpha/ib-gateway-docker/blob/master/logo.png\" height=\"300\" /\u003e\n\n## What is it?\n\nA docker image to run the Interactive Brokers Gateway Application without any human interaction on a docker container.\n\nIt includes:\n\n- [IB Gateway Application](https://www.interactivebrokers.com/en/index.php?f=16457) ([stable](https://www.interactivebrokers.com/en/trading/ibgateway-stable.php), [latest](https://www.interactivebrokers.com/en/trading/ibgateway-latest.php))\n- [IBC Application](https://github.com/IbcAlpha/IBC) -\nto control the IB Gateway Application (simulates user input).\n- [Xvfb](https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml) -\na X11 virtual framebuffer to run IB Gateway Application without graphics hardware.\n- [x11vnc](https://wiki.archlinux.org/title/x11vnc) -\na VNC server that allows to interact with the IB Gateway user interface (optional, for development / maintenance purpose).\n- [socat](https://linux.die.net/man/1/socat) a tool to accept TCP connection from non-localhost and relay it to IB Gateway from localhost (IB Gateway restricts connections to 127.0.0.1 by default).\n\n## Supported Tags\n\n| Channel  | IB Gateway Version | IBC Version | Docker Tags                 |\n| -------- | ------------------ | ----------- | --------------------------- |\n| `latest` | `10.22.1m`         | `3.16.0`    | `latest` `10.22` `10.22.1m` |\n| `stable` | `10.19.1j`         | `3.15.2`    | `stable` `10.19` `10.19.1j` |\n\n\nSee all available tags [here](https://github.com/UnusualAlpha/ib-gateway-docker/pkgs/container/ib-gateway/).\n\n## How to use?\n\nCreate a `docker-compose.yml` (or include ib-gateway services on your existing one)\n\n```yaml\nversion: \"3.4\"\n\nservices:\n  ib-gateway:\n    image: ghcr.io/unusualalpha/ib-gateway:latest\n    restart: always\n    environment:\n      TWS_USERID: ${TWS_USERID}\n      TWS_PASSWORD: ${TWS_PASSWORD}\n      TRADING_MODE: ${TRADING_MODE:-live}\n      VNC_SERVER_PASSWORD: ${VNC_SERVER_PASSWORD:-}\n    ports:\n      - \"127.0.0.1:4001:4001\"\n      - \"127.0.0.1:4002:4002\"\n      - \"127.0.0.1:5900:5900\"\n```\n\nCreate an .env on root directory or set the following environment variables:\n\n| Variable              | Description                                                         | Default                    |\n| --------------------- | ------------------------------------------------------------------- | -------------------------- |\n| `TWS_USERID`          | The TWS **username**.                                               |                            |\n| `TWS_PASSWORD`        | The TWS **password**.                                               |                            |\n| `TRADING_MODE`        | **live** or **paper**                                               | **paper**                  |\n| `READ_ONLY_API`       | **yes** or **no** ([see](resources/config.ini#L316))                | **not defined**            |\n| `VNC_SERVER_PASSWORD` | VNC server password. If not defined, no VNC server will be started. | **not defined** (VNC disabled)|\n\nExample .env file:\n\n```text\nTWS_USERID=myTwsAccountName\nTWS_PASSWORD=myTwsPassword\nTRADING_MODE=paper\nREAD_ONLY_API=no\nVNC_SERVER_PASSWORD=myVncPassword\n```\n\nRun:\n\n  $ docker-compose up\n\nAfter image is downloaded, container is started + 30s, the following ports will be ready for usage on the \ncontainer and docker host:\n\n| Port | Description                                                  |\n| ---- | ------------------------------------------------------------ |\n| 4001 | TWS API port for live accounts.                              |\n| 4002 | TWS API port for paper accounts.                             |\n| 5900 | When `VNC_SERVER_PASSWORD` was defined, the VNC server port. |\n\n_Note that with the above `docker-compose.yml`, ports are only exposed to the\ndocker host (127.0.0.1), but not to the network of the host. To expose it to\nthe whole network change the port mappings on accordingly (remove the\n'127.0.0.1:'). **Attention**: See [Leaving localhost](#leaving-localhost)\n\n## How build locally\n\n1. Clone this repo\n\n   ```bash\n      git clone https://github.com/UnusualAlpha/ib-gateway-docker\n   ```\n\n2. Change docker file to use your local IB Gateway installer file, instead of loading it from this project releases:\nOpen `Dockerfile` on editor and replace this lines:\n\n   ```docker\n   RUN curl -sSL https://github.com/UnusualAlpha/ib-gateway-docker/raw/gh-pages/ibgateway-releases/ibgateway-${IB_GATEWAY_VERSION}-standalone-linux-x64.sh \\\n       --output ibgateway-${IB_GATEWAY_VERSION}-standalone-linux-x64.sh\n   RUN curl -sSL https://github.com/UnusualAlpha/ib-gateway-docker/raw/gh-pages/ibgateway-releases/ibgateway-${IB_GATEWAY_VERSION}-standalone-linux-x64.sh.sha256 \\\n       --output ibgateway-${IB_GATEWAY_VERSION}-standalone-linux-x64.sh.sha256\n   ```\n\n   with\n\n   ```docker\n   COPY ibgateway-${IB_GATEWAY_VERSION}-standalone-linux-x64.sh\n   ```\n\n3. Remove `RUN sha256sum --check ./ibgateway-${IB_GATEWAY_VERSION}-standalone-linux-x64.sh.sha256` from Dockerfile (unless you want to keep checksum-check)\n4. Download IB Gateway and name the file `ibgateway-{IB_GATEWAY_VERSION}-standalone-linux-x64.sh`, where `{IB_GATEWAY_VERSION}` must match the version as configured on Dockerfile (first line)\n5. Download IBC and name the file `IBCLinux-{IBC_VERSION}.zip`, where `{IBC_VERSION}` must match the version as configured on Dockerfile (second line)\n6. Build and run: `docker-compose up --build`\n\n## Versions and Tags\n\nThe docker image version is similar to the IB Gateway version on the image.\n\nSee [Supported tags](#supported-tags)\n\n### IB Gateway installation files\n\nNote that the [Dockerfile](https://github.com/UnusualAlpha/ib-gateway-docker/blob/master/Dockerfile)\n**does not download IB Gateway installer files from IB homepage but from the\n[github-pages](https://github.com/UnusualAlpha/ib-gateway-docker/tree/gh-pages/ibgateway-releases) of this project**.\n\nThis is because it shall be possible to (re-)build the image, targeting a specific Gateway version,\nbut IB does only provide download links for the `latest` or `stable` version (there is no 'old version' download archive).\n\nThe installer files stored on [github-pages](https://github.com/UnusualAlpha/ib-gateway-docker/tree/gh-pages/ibgateway-releases) have been downloaded from\nIB homepage and renamed to reflect the version.\n\nIf you want to download Gateway installer from IB homepage directly, or use your local installation file, change this line\non [Dockerfile](https://github.com/UnusualAlpha/ib-gateway-docker/blob/master/Dockerfile)\n`RUN curl -sSL https://github.com/UnusualAlpha/ib-gateway-docker/raw/gh-pages/ibgateway-releases/ibgateway-${IB_GATEWAY_VERSION}-standalone-linux-x64.sh\n--output ibgateway-${IB_GATEWAY_VERSION}-standalone-linux-x64.sh` to download (or copy) the file from the source you prefer.\n\n**Example:** change to `RUN curl -sSL https://download2.interactivebrokers.com/installers/ibgateway/stable-standalone/ibgateway-stable-standalone-linux-x64.sh --output ibgateway-${IB_GATEWAY_VERSION}-standalone-linux-x64.sh` for using current stable version from IB homepage.\n\n## Customizing the image\n\nThe image can be customized by overwriting the default configuration files\nwith custom ones.\n\nApps and config file locations:\n\n| App        |  Folder   | Config file               | Default                                                                                           |\n| ---------- | --------- | ------------------------- | ------------------------------------------------------------------------------------------------- |\n| IB Gateway | /root/Jts | /root/Jts/jts.ini         | [jts.ini](https://github.com/UnusualAlpha/ib-gateway-docker/blob/master/config/ibgateway/jts.ini) |\n| IBC        | /root/ibc | /root/ibc/config.ini      | [config.ini](https://github.com/UnusualAlpha/ib-gateway-docker/blob/master/config/ibc/config.ini.tmpl) |\n\nTo start the IB Gateway run `/root/scripts/run.sh` from your Dockerfile or\nrun-script.\n\n## Security Considerations\n\n### Leaving localhost\n\nThe IB API protocol is based on an unencrypted, unauthenticated, raw TCP socket\nconnection between a client and the IB Gateway. If the port to IB API is open\nto the network, every device on it (including potential rogue devices) can access\nyour IB account via the IB Gateway.\n\nBecause of this, the default `docker-compose.yml` only exposes the IB API port\nto the **localhost** on the docker host, but not to the whole network.\n\nIf you want to connect to IB Gateway from a remote device, consider adding an\nadditional layer of security (e.g. TLS/SSL or SSH tunnel) to protect the\n'plain text' TCP sockets against unauthorized access or manipulation.\n\n### Credentials\n\nThis image does not contain nor store any user credentials.\n\nThey are provided as environment variable during the container startup and\nthe host is responsible to properly protect it (e.g. use\n[Kubernetes Secrets](https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-environment-variables) \nor similar).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FUnusualAlpha%2Fib-gateway-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FUnusualAlpha%2Fib-gateway-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FUnusualAlpha%2Fib-gateway-docker/lists"}