ib_insync icon indicating copy to clipboard operation
ib_insync copied to clipboard

FYI Only - ib_insync + IBC in Containers in Cloud

Open ryanh-ai opened this issue 5 years ago • 8 comments

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.

ryanh-ai avatar Jun 05 '19 01:06 ryanh-ai

@canada4663 like the idea. But how do you manage the automatic disconnect?

felixbaron avatar May 06 '20 22:05 felixbaron

This probably relates to #261.

goodboy avatar Jun 29 '20 16:06 goodboy

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!

ryanh-ai avatar Jul 02 '20 02:07 ryanh-ai

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

drusakov778 avatar Jul 02 '20 05:07 drusakov778

@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.

goodboy avatar Jul 02 '20 19:07 goodboy

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.

marvin-hansen avatar Oct 23 '20 06:10 marvin-hansen

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?

kasper747 avatar Feb 20 '21 12:02 kasper747

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

kasper747 avatar Feb 20 '21 12:02 kasper747

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

erdewit avatar Dec 10 '22 15:12 erdewit