manhinhang / ib-gateway-docker Goto Github PK
View Code? Open in Web Editor NEWlightweight interactive brokers gateway docker
License: MIT License
lightweight interactive brokers gateway docker
License: MIT License
implement
test
document
it seems like the gateway connects live trading fine, but paper trading is broken, the 2FA push notification is never delivered
Example
docker run -d ib-gateway tail -f /dev/null
Hi can you push a new image, 10.19.1 and below is about to go off support. please
Because syncing process running forever units exceed time limit, It impact GitHub actions status.
I'll disable it for now.
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.
Use docker secret instead of raw environment variable
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.
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
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"`
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
implementation
document update
example code
CI
Repeat xdpyinfo: unable to open display ":0".
error log forever when restart container.
implement fix
test case
Allow change client id for ping by environment variable
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
I'm a doker newbie, and curious why the ib_insync is installed with this docker image? And in the ib_insync example, the ib_insync has to install on the host again.
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)
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.
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?
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
See : c920209
Pass account & password as environment variable
pass environment variable though docker run command
Example code
Document update
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.