I have updated Ryan Kennedy's IBConnect Docker image by getting the latest versions from Quantconnect, here is the Docker image I ended up with.
Basically the dockerfile contains:
FROM ubuntu:18.04
MAINTAINER Ryan Kennedy <[email protected]>
RUN apt-get update \
&& apt-get install -y wget \
&& apt-get install -y unzip \
&& apt-get install -y xvfb \
&& apt-get install -y libxtst6 \
&& apt-get install -y libxrender1 \
&& apt-get install -y libxi6 \
&& apt-get install -y socat \
&& apt-get install -y software-properties-common
# Setup IB TWS
RUN mkdir -p /opt/TWS
WORKDIR /opt/TWS
ENV ibgateway_version x64-v974.4g
ENV ibgateway_script ibgateway-latest-standalone-linux-${ibgateway_version}.sh
ENV ibcontroller_file IBController-QuantConnect-3.2.0.5.zip
# from https://github.com/QuantConnect/Lean/blob/master/DockerfileLeanFoundation
RUN wget http://cdn.quantconnect.com/interactive/${ibgateway_script} && \
chmod 777 ${ibgateway_script} && \
./${ibgateway_script} -q && \
wget -O ~/Jts/jts.ini http://cdn.quantconnect.com/interactive/ibgateway-latest-standalone-linux-${ibgateway_version}.jts.ini && \
rm ${ibgateway_script}
# Install IB Controller: Installs to /opt/IBController
RUN wget http://cdn.quantconnect.com/interactive/${ibcontroller_file} && \
unzip ${ibcontroller_file} -d /opt/IBController && \
chmod -R 777 /opt/IBController && \
rm ${ibcontroller_file}
# Install Java 8
RUN \
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
add-apt-repository -y ppa:webupd8team/java && \
apt-get update && \
apt-get install -y oracle-java8-installer && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /var/cache/oracle-jdk8-installer
WORKDIR /
#CMD yes
# Launch a virtual screen
RUN Xvfb :1 -screen 0 1024x768x24 2>&1 >/dev/null &
RUN export DISPLAY=:1
ADD runscript.sh runscript.sh
CMD bash runscript.sh
It all works well, except every few hours starts logging:
05:48:36:462 IBController: detected frame entitled: Connecting to server...; event=Activated
05:51:19:741 IBController: detected dialog entitled: Re-login is required; event=Opened
05:51:19:743 IBController: Let user choose whether to re-login
05:51:19:751 IBController: detected dialog entitled: Re-login is required; event=Activated
05:54:20:608 IBController: detected dialog entitled: Re-login is required; event=Closed
05:54:21:191 IBController: detected dialog entitled: Re-login is required; event=Opened
05:54:21:191 IBController: Let user choose whether to re-login
I guess it loses connection due to any reason, and then there's an unhandled dialog for reconnecting, I'm not sure how to fix this.
IBGateway, IB API C#, and the IBController project versions are all fairly tightly coupled. They should probably not be used in isolation or you'll have version compatibility issues like this one.
LEAN (the open source algorithmic trading project you're extending from) ships with versions of these programs which we've constructed work perfectly together. In total LEAN's deployed and managed more than 50,000 live algorithms so its pretty well battle tested! We've also forked the IBController and maintain a production-ready bug, free version.
I'd recommend using the original LEAN Foundation if you can. It will save you months of headache. We have full-time engineers maintain and contributing to the code base ensuring these components remain reliable for the 70,000 quants in the QuantConnect community.
-- I'm founder @ QC.