ib_insync
ib_insync copied to clipboard
FYI Only - ib_insync + IBC in Containers in Cloud
Hi! Great project.
I have a desire to run ib_insync + IBC in Containers - and optionally in the cloud.
The repo below is a work-in-progress for doing both, leveraging ib_insync to manage a long-running container locally or in the cloud, but inside a container image:
https://github.com/canada4663/ib_insyncDocker
Definitely some refactoring of the container to create a supervised service for xvfb, socat to support ib_insync (or possibly a pull request to pull these into the supervised python process) - but directionally, this is working.
Thought I'd share. Will keep working onthis over the coming weeks.
@canada4663 like the idea. But how do you manage the automatic disconnect?
This probably relates to #261.
Sorry gents, haven’t spent as much time on this as I would have liked!
Did you solve the connection / timeout issue from the other post? or shall I take a look. I need to dust this back off again!
Watchdog reliably manages disconnects and restarts, https://github.com/erdewit/ib_insync/blob/master/ib_insync/ibcontroller.py#L303
I am running such instance for couple of weeks now, last run uninterrupted from 22nd of June (10 days, just checked) reconnecting without a problem. Although I am simply running it as a background process on AWS, did not bother to package it to a docker, seems quite straightforward
@canada4663 maybe this is a silly question but have you considered trying this on a more stripped down distribution?
I realize there's a ton of java "muck" to deal with but I'm looking for something that is just a nice clean ib-gw
with minimal deps.
FYI, I'm running IB Gateway + IBC stable on Kubernetes on GCP:
https://github.com/marvin-hansen/IB-gateway
Docker works fine with VNC. Kubernetes works stable, but not VNC connect, obviously.
I was able to get the container size down to some ~700 MB by using a smaller image, leaving all recommended packages out, and deleting all post-install junk. Afaik there isn't much headroom left as the IB gateway comes bundled with a JRE but the IB Controller actually needs a Python runtime plus some OS dependencies.
Guy, just a beginner in this programming. But I was acutally thinking about doing this. I already have a completly isolated system set up for crypto trading with Binance. However here I have a straggle to understand how to deal with the fact, that I need to have TWS all the time open. How are you packing it into a container?
Ok, found the information after reading the project from Marvin! Thank
Here is some more detail in case any is looking for it https://interactivebrokers.github.io/tws-api/initial_setup.html
The docker image from the first post has become a bit stale and doesn't run as-is anymore. I'm therefore closing this issue. For those looking for a newer alternative can look into this project:
https://github.com/UnusualAlpha/ib-gateway-docker