Skip to content

Commit

Permalink
Merge pull request #76 from manhinhang/develop
Browse files Browse the repository at this point in the history
Merge to master
  • Loading branch information
manhinhang authored Apr 13, 2024
2 parents 7e08448 + 7c6db13 commit f56bc18
Show file tree
Hide file tree
Showing 9 changed files with 258 additions and 172 deletions.
31 changes: 3 additions & 28 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
env:
IMAGE_NAME: ib-gateway-docker
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@master
- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -48,29 +48,4 @@ jobs:
TRADE_MODE: paper
IB_ACCOUNT: ${{ secrets.IB_ACCOUNT }}
IB_PASSWORD: ${{ secrets.IB_PASSWORD }}

- uses: 'google-github-actions/setup-gcloud@v0'
with:
version: '290.0.1'
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Run google clound example
run: |
docker run \
--env GCP_SECRET=True \
--env GCP_SECRET_IB_ACCOUNT=$GCP_SECRET_IB_ACCOUNT \
--env GCP_SECRET_IB_PASSWORD=$GCP_SECRET_IB_PASSWORD \
--env GCP_SECRET_IB_TRADE_MODE=$GCP_SECRET_IB_TRADE_MODE \
--env GCP_PROJECT_ID=$GCP_PROJECT_ID \
-e GOOGLE_APPLICATION_CREDENTIALS=/tmp/keys/credentials.json \
-v $GOOGLE_APPLICATION_CREDENTIALS:/tmp/keys/credentials.json:ro \
-d \
$IMAGE_NAME;
sleep 30;
if [ -z "$(docker ps -a -q)" ]; then exit 1; fi
env:
GCP_SECRET_IB_ACCOUNT: ${{ secrets.GCP_SECRET_IB_ACCOUNT }}
GCP_SECRET_IB_PASSWORD: ${{ secrets.GCP_SECRET_IB_PASSWORD }}
GCP_SECRET_IB_TRADE_MODE: ${{ secrets.GCP_SECRET_IB_TRADE_MODE }}
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}

12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
FROM python:3.7-slim
FROM python:3.11-slim
# IBC Version : https://github.com/IbcAlpha/IBC/releases
ARG IBC_VER="3.18.0"
# ib_insync : https://pypi.org/project/ib-insync/#history
ARG IB_INSYNC_VER="0.9.86"

# install dependencies
RUN apt-get update \
Expand All @@ -16,7 +20,7 @@ RUN apt-get update \
procps \
xterm
RUN apt install -y openjdk-17-jre
RUN pip install ib_insync==0.9.71 google-cloud-secret-manager==2.11.1
RUN pip install ib_insync==$IB_INSYNC_VER

# set environment variables
ENV TWS_INSTALL_LOG=/root/Jts/tws_install.log \
Expand All @@ -36,11 +40,12 @@ RUN wget -q -O /tmp/ibgw.sh https://download2.interactivebrokers.com/installers/
RUN chmod +x /tmp/ibgw.sh

# download IBC
RUN wget -q -O /tmp/IBC.zip https://github.com/IbcAlpha/IBC/releases/download/3.14.0/IBCLinux-3.14.0.zip
RUN wget -q -O /tmp/IBC.zip https://github.com/IbcAlpha/IBC/releases/download/$IBC_VER-Update.1/IBCLinux-$IBC_VER.zip
RUN unzip /tmp/IBC.zip -d ${ibcPath}
RUN chmod +x ${ibcPath}/*.sh ${ibcPath}/*/*.sh

# install TWS, write output to file so that we can parse the TWS version number later
RUN touch $TWS_INSTALL_LOG
COPY install_ibgw.exp /tmp/install_ibgw.exp
RUN chmod +x /tmp/install_ibgw.exp
RUN /tmp/install_ibgw.exp
Expand All @@ -50,7 +55,6 @@ RUN rm /tmp/ibgw.sh /tmp/IBC.zip

# copy IBC/Jts configs
COPY ibc/config.ini ${ibcIni}
COPY ibc/jts.ini ${twsPath}/jts.ini

# copy cmd script
WORKDIR /root
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ It's just pure `IB Gateway` and don't include any VNC service (for security reas

This docker image just installed:

- [IB Gateway](https://www.interactivebrokers.com/en/index.php?f=16457) (10.12.2)
- [IB Gateway](https://www.interactivebrokers.com/en/index.php?f=16457) (10.19.2)

- [IBC](https://github.com/IbcAlpha/IBC) (3.14.0)
- [IBC](https://github.com/IbcAlpha/IBC) (3.18.0)

- [ib_insync](https://github.com/erdewit/ib_insync) (0.9.71)
- [ib_insync](https://github.com/erdewit/ib_insync) (0.9.86)

- [google-cloud-secret-manager](https://github.com/googleapis/python-secret-manager) (2.11.1)

Expand Down
17 changes: 17 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
services:
ib-gateway:
image: manhinhang/ib-gateway-docker
command: tail -f /dev/null
ports:
- 4002:4002
environment:
- IB_ACCOUNT=$IB_ACCOUNT
- IB_PASSWORD=$IB_PASSWORD
- TRADE_MODE=$TRADE_MODE
secrets:
IB_ACCOUNT:
environment: "IB_ACCOUNT"
IB_PASSWORD:
environment: "IB_PWD"
TRADE_MODE:
environment: "TRADE_MODE"
Loading

0 comments on commit f56bc18

Please sign in to comment.