-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a4e11b
commit 55e282d
Showing
4 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Detect new IB gateway version | ||
on: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
env: | ||
IMAGE_NAME: ib-gateway-docker | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Setup python | ||
uses: actions/setup-python@v5 | ||
- name: detect new ib gateway version | ||
id: detect-new-ibg-ver | ||
run: | | ||
ib-gateway-ver=$(python scripts/detect_ib_gateway_ver.py) >> "$GITHUB_OUTPUT" | ||
cur-ib-gateway-ver=$(cat ib-gateway-ver) | ||
if [ "$ib-gateway-ver" = "$cur-ib-gateway-ver" ]; then | ||
echo "No dated IB gateway version" | ||
else | ||
echo "New IB gateway version($ib-gateway-ver)" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# IB Gateway docker | ||
|
||
![Build test](https://github.com/manhinhang/ib-gateway-docker/workflows/Build%20test/badge.svg?branch=master) | ||
[![Docker Pulls](https://img.shields.io/docker/pulls/manhinhang/ib-gateway-docker)](https://hub.docker.com/r/manhinhang/ib-gateway-docker) | ||
[![GitHub](https://img.shields.io/github/license/manhinhang/ib-gateway-docker)](https://github.com/manhinhang/ib-gateway-docker/blob/develop/LICENSE) | ||
|
||
lightweight interactive brokers gateway docker | ||
|
||
It's just pure `IB Gateway` and don't include any VNC service (for security reason, I don't like expose extra port) | ||
|
||
This docker image just installed: | ||
|
||
- [IB Gateway](https://www.interactivebrokers.com/en/index.php?f=16457) (###IB_GATEWAY_VER###) | ||
|
||
- [IBC](https://github.com/IbcAlpha/IBC) (###IBC_VER###) | ||
|
||
## Pull the Docker image from Docker Hub | ||
|
||
```bash | ||
docker pull manhinhang/ib-gateway-docker | ||
``` | ||
|
||
### Create a container from the image and run it | ||
```bash | ||
docker run -d \ | ||
--env IB_ACCOUNT= \ #YOUR_USER_ID | ||
--env IB_PASSWORD= \ #YOUR_PASSWORD | ||
--env TRADING_MODE= \ #paper or live | ||
--p 4002:4002 \ #brige IB gateway port to your local port 4002 | ||
manhinhang/ib-gateway-docker | ||
``` | ||
|
||
--- | ||
|
||
## Build & Run locally | ||
|
||
```bash | ||
git clone [email protected]:manhinhang/ib-gateway-docker.git | ||
cd ib-gateway-docker | ||
docker build --no-cache -t ib-gateway-docker . | ||
docker run -d \ | ||
--env IB_ACCOUNT= \ #YOUR_USER_ID | ||
--env IB_PASSWORD= \ #YOUR_PASSWORD | ||
--env TRADING_MODE= \ #paper or live | ||
-p 4002:4002 \ #brige IB gateway port to your local port 4002 | ||
ib-gateway-docker | ||
``` | ||
|
||
|
||
## Container usage example | ||
|
||
| Example | Link | Description | | ||
| - | - | - | | ||
| ib_insync | [examples/ib_insync](./examples/ib_insync) | This example demonstrated how to connect `IB Gateway` | ||
|
||
# Tests | ||
|
||
The [test cases](test/test_ib_gateway.py) 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 | | ||
|
||
# Disclaimer | ||
|
||
This project is not affiliated with [Interactive Brokers Group, Inc.'s](https://www.interactivebrokers.com). | ||
|
||
Good luck and enjoy. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
10.19.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import requests | ||
import json | ||
import re | ||
|
||
if __name__ == "__main__": | ||
url = "https://download2.interactivebrokers.com/installers/ibgateway/stable-standalone/version.json" | ||
regex = r"([^(]+)\)" | ||
response = requests.get(url) | ||
response_text = response.text | ||
matches = re.finditer(regex, response_text) | ||
# print(matches) | ||
json_str = next(matches).group(1) | ||
data = json.loads(json_str) | ||
print(data["buildVersion"]) |