GithubHelp home page GithubHelp logo

manhinhang / ib-gateway-docker Goto Github PK

View Code? Open in Web Editor NEW
89.0 89.0 42.0 312 KB

lightweight interactive brokers gateway docker

License: MIT License

Dockerfile 13.99% Shell 8.07% Python 27.85% Kotlin 50.09%
docker docker-image ib-gateway ibc interactive-brokers python trading-api

ib-gateway-docker's Introduction

Hi there ๐Ÿ‘‹

ib-gateway-docker's People

Contributors

asemx avatar github-actions[bot] avatar manhinhang avatar rylorin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ib-gateway-docker's Issues

Paper trading is broken

it seems like the gateway connects live trading fine, but paper trading is broken, the 2FA push notification is never delivered

API connection failed: TimeoutError()

Hello,

I followed the instructions exactly: built the docker image and ran the container successfully, but then I am getting the following error in Python when I'm trying to connect ib_insync's IB object:

>>> from ib_insync import IB
>>> ib = IB()
>>> ib.connect(host="localhost", port=4002, clientId=1)
API connection failed: TimeoutError()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/amp/code/ibg/.venv/lib/python3.8/site-packages/ib_insync/ib.py", line 269, in connect
    return self._run(self.connectAsync(
  File "/home/amp/code/ibg/.venv/lib/python3.8/site-packages/ib_insync/ib.py", line 308, in _run
    return util.run(*awaitables, timeout=self.RequestTimeout)
  File "/home/amp/code/ibg/.venv/lib/python3.8/site-packages/ib_insync/util.py", line 332, in run
    result = loop.run_until_complete(task)
  File "/home/amp/.pyenv/versions/3.8.5/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/home/amp/code/ibg/.venv/lib/python3.8/site-packages/ib_insync/ib.py", line 1658, in connectAsync
    await self.client.connectAsync(host, port, clientId, timeout)
  File "/home/amp/code/ibg/.venv/lib/python3.8/site-packages/ib_insync/client.py", line 216, in connectAsync
    await asyncio.wait_for(self.apiStart, timeout)
  File "/home/amp/.pyenv/versions/3.8.5/lib/python3.8/asyncio/tasks.py", line 490, in wait_for
    raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError

I tried both the master and develop branches, on both my local computer and a remote server. Same result each time. Any idea what's going wrong here? Many thanks for the repo and your help.

Timeout if enter wrong user name / password

Currently, the program cloud be stop if user passed wrong user name / password.
Better to add retry count to handle user name / password, if retry count exceeds the limit, the container should stopped.

Modifying gateway API settings?

Hi, seems to be working great so far. How can I make a change to the gateway API settings in the GUI interface? There's a setting called "Send market data in lots for US stocks for dual-mode API clients" - I need this to be CHECKED. By default it is unchecked.

Forgive me if this is a silly question, I'm a novice at these things.

Thanks

Constant disconnect loop

I am getting a constant loop of disconnects.

While connected it will correctly return data both symbol search and streaming data.

No matter what I set as probe timeout, ping client etc. I can't see any difference.
[2022-12-14 11:09:59,480]INFO:Warning 2104, reqId -1: Market data farm connection is OK:eufarm
[2022-12-14 11:09:59,480]INFO:Warning 2106, reqId -1: HMDS data farm connection is OK:euhmds
[2022-12-14 11:09:59,480]INFO:Warning 2158, reqId -1: Sec-def data farm connection is OK:secdefeu
[2022-12-14 11:09:59,480]INFO:API connection ready
[2022-12-14 11:09:59,527]INFO:Synchronization complete
[2022-12-14 11:09:59,527]INFO:IB gateway connected
.......
[2022-12-14 11:08:31,536]INFO:WatchDog Started!
[2022-12-14 11:08:34,851]ERROR:Error 1100, reqId -1: Connectivity between IB and Trader Workstation has been lost.
[2022-12-14 11:08:34,852]WARNING:Error 1100
[2022-12-14 11:08:34,852]INFO:Terminating
[2022-12-14 11:08:35,222]ERROR:Peer closed connection.
[2022-12-14 11:08:35,222]INFO:IB gateway disconnected
[2022-12-14 11:08:35,222]INFO:WatchDog Stopped!
[2022-12-14 11:08:37,224]INFO:Starting

`version: '3.4'

services:
ib-gateway:
container_name: ib-gateway
image: manhinhang/ib-gateway-docker
restart: unless-stopped
environment:
IB_ACCOUNT: xxxx
IB_PASSWORD: xxxxx
TRADE_MODE: live
IB_GATEWAY_PING_CLIENT_ID: 3
IBGW_WATCHDOG_PROBE_TIMEOUT: 10
ports:
- "4002:4002"`

Add support of Healthcheck

Hello,

I'd like to use this in my kubernetes deployment and for this I need a healthcheck. And generally speaking it would be great even for docker-compose deployments.

One way I could think of is to use your bootstrap.py to exit if watchdog dies and then check if python process is still running, e.g.:

  healthcheck:
    test: pidof python || exit 1
    interval: 10s
    retries: 2
    start_period: 30s
    timeout: 5s

Unable restart container

Repeat xdpyinfo: unable to open display ":0". error log forever when restart container.

  • implement fix

  • test case

API connection failed

Hey,

I'm running the latest image from Docker Hub but I get this error. Isn't this supposed to run IBG inside the container?

dev-ib-gateway | [2022-10-27 11:01:00,943]ERROR:API connection failed: ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 4001)")
dev-ib-gateway | [2022-10-27 11:01:00,944]ERROR:Make sure API port on TWS/IBG is open

out of memory core dumped

Describe the bug
[15/25] RUN /tmp/install_ibgw.exp:
generates core dumped due to out of memory

To Reproduce
just clone repo and launch:
docker build --no-cache -t ib-gateway-docker .

Expected behavior
Creation of ibgateway docker service

Container logs

[15/25] RUN /tmp/install_ibgw.exp:
0.241 spawn /tmp/ibgw.sh
0.601 Unpacking JRE ...
3.192 Starting Installer ...
3.279 library initialization failed - unable to allocate file descriptor table - out of memoryAborted (core dumped)
3.598 send: spawn id exp4 not open
3.598 while executing
3.598 "send -- "\r""
3.598 (file "/tmp/install_ibgw.exp" line 11)


Dockerfile:50

48 | RUN chmod +x /tmp/install_ibgw.exp
49 | RUN cat /tmp/ibgw.sh
50 | >>> RUN /tmp/install_ibgw.exp
51 |
52 | # remove downloaded files

ERROR: failed to solve: process "/bin/sh -c /tmp/install_ibgw.exp" did not complete successfully: exit code: 1

Versions (please complete the following information):

OS: Fedora 38, Linux 6.5.5-200.fc38.x86_64
Docker version: Docker Engine - Community
Image Tag (docker --version): Docker version 24.0.6, build ed223bc
Image Digest (docker images --digests): image not created
Additional context
Tried to change ulimits without success.
16Go memory, 3Go free, 3Go used, 9Go buff/cache according to top.

Error while running the docker image

This docker image is great to seamlessly the algorithm trading process. Thanks for making it so easy!

I just encounter the following error when pull the image and run with the paper mode:

[2023-07-20 19:17:50,432]ERROR:API connection failed: ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 4001)")
[2023-07-20 19:17:50,432]ERROR:Make sure API port on TWS/IBG is open

I didn't see anywhere in the code we start the IBG explicitly, wondering any configure I'm missing?

Configure as headless deployment

Hello,

Is there a way to run the container on a server and configure the gateway to allow connections from remote IP addresses?

Thanks,
Amit

Auto login

Pass account & password as environment variable

  • pass environment variable though docker run command

  • Example code

  • Document update

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.