Files
quantconnect--lean/DockerfileLeanFoundation
T
Martin-Molinero 7095dc1559 Update gateway to 1019 (#6706)
- Update gateway to latest 1019
- Fix bug in IB data subscription limit, not applying when using
  multiple data queue handlers
2022-10-24 12:01:13 -03:00

271 lines
11 KiB
Plaintext

#
# LEAN Foundation Docker Container 20201214
# Cross platform deployment for multiple brokerages
# Intended to be used in conjunction with Dockerfile. This is just the foundation common OS+Dependencies required.
#
# Use base system for cleaning up wayward processes
FROM phusion/baseimage:focal-1.0.0
MAINTAINER QuantConnect <contact@quantconnect.com>
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
# Have to add env TZ=UTC. See https://github.com/dotnet/coreclr/issues/602
RUN env TZ=UTC
# Install OS Packages:
# Misc tools for running Python.NET and IB inside a headless container.
RUN add-apt-repository ppa:ubuntu-toolchain-r/test \
&& echo deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ >> /etc/apt/sources.list \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 \
&& add-apt-repository ppa:apt-fast/stable && apt-get update && apt-get -y install apt-fast \
&& apt-fast install -y git bzip2 curl unzip wget python3-pip python-opengl zlib1g-dev \
xvfb libxrender1 libxtst6 libxi6 libglib2.0-dev libopenmpi-dev libstdc++6 openmpi-bin \
pandoc libcurl4-openssl-dev libgtk2.0.0 r-base \
&& apt-fast clean && apt-get remove -y apt-fast && apt-get clean && apt-get autoclean && apt-get autoremove --purge -y \
&& rm -rf /var/lib/apt/lists/*
# Install IB Gateway: Installs to /root/ibgateway
RUN mkdir -p /root/ibgateway && \
wget https://cdn.quantconnect.com/interactive/ibgateway-latest-standalone-linux-x64.v10.19.1d.sh && \
chmod 777 ibgateway-latest-standalone-linux-x64.v10.19.1d.sh && \
./ibgateway-latest-standalone-linux-x64.v10.19.1d.sh -q -dir /root/ibgateway && \
rm ibgateway-latest-standalone-linux-x64.v10.19.1d.sh
# Install dotnet 6 sdk & runtime
RUN wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && \
apt-get update; \
apt-get install -y apt-transport-https && \
apt-get update && \
apt-get install -y dotnet-sdk-6.0 && \
rm packages-microsoft-prod.deb && \
apt-get clean && apt-get autoclean && apt-get autoremove --purge -y && rm -rf /var/lib/apt/lists/*
# Set PythonDLL variable for PythonNet
ENV PYTHONNET_PYDLL="/opt/miniconda3/lib/libpython3.8.so"
# Install miniconda
ENV CONDA="Miniconda3-4.5.12-Linux-x86_64.sh"
ENV PATH="/opt/miniconda3/bin:${PATH}"
RUN wget https://cdn.quantconnect.com/miniconda/${CONDA} && \
bash ${CONDA} -b -p /opt/miniconda3 && rm -rf ${CONDA} && \
conda install -y conda=4.10.3 && \
pip install --upgrade --no-cache-dir pip==22.2.2 && \
conda install -y python=3.8.13 && conda install -y -c conda-forge pip=22.2.2 && conda clean -y --all
# Avoid pip install read timeouts
ENV PIP_DEFAULT_TIMEOUT=120
# Install all packages
RUN pip install --no-cache-dir \
cython==0.29.30 \
pandas==1.4.4 \
scipy==1.8.1 \
numpy==1.22.4 \
wrapt==1.14.1 \
astropy==5.1 \
beautifulsoup4==4.11.1 \
dill==0.3.5.1 \
jsonschema==4.9.1 \
lxml==4.9.1 \
msgpack==1.0.3 \
numba==0.56.0 \
xarray==2022.6.0 \
plotly==5.9.0 \
jupyterlab==3.4.4 \
tensorflow==2.10.0 \
docutils==0.19 \
cvxopt==1.3.0 \
gensim==4.2.0 \
keras==2.10.0 \
lightgbm==3.3.2 \
mpi4py==3.1.3 \
nltk==3.7 \
graphviz==0.8.4 \
cmdstanpy==1.0.4 \
copulae==0.7.7 \
featuretools==0.18.1 \
PuLP==2.6.0 \
pymc==4.1.4 \
rauth==0.7.3 \
scikit-learn==1.0.2 \
scikit-multiflow==0.5.3 \
scikit-optimize==0.9.0 \
aesara==2.7.9 \
tsfresh==0.15.1 \
tslearn==0.5.2 \
tweepy==4.10.0 \
PyWavelets==1.3.0 \
umap-learn==0.5.3 \
fastai==2.7.7 \
arch==5.3.1 \
copulas==0.7.0 \
creme==0.6.1 \
cufflinks==0.17.3 \
gym==0.23.1 \
ipywidgets==8.0.0rc1 \
deap==1.3.3 \
cvxpy==1.2.1 \
pykalman==0.9.5 \
pyportfolioopt==1.5.1 \
pmdarima==1.8.5 \
pyro-ppl==1.8.2 \
riskparityportfolio==0.3 \
sklearn-json==0.1.0 \
statsmodels==0.13.2 \
QuantLib==1.27 \
xgboost==1.6.1 \
dtw-python==1.2.2 \
mxnet==1.9.1 \
gluonts==0.7.7 \
gplearn==0.4.2 \
jax==0.3.16 \
jaxlib==0.3.15 \
keras-rl==0.4.2 \
pennylane==0.25.1 \
neural-tangents==0.6.0 \
mplfinance==0.12.9b1 \
hmmlearn==0.2.7 \
catboost==1.0.6 \
fastai2==0.0.30 \
scikit-tda==1.0.0 \
ta==0.10.1 \
seaborn==0.11.2 \
optuna==2.10.1 \
findiff==0.9.2 \
sktime==0.13.1 \
hyperopt==0.2.7 \
bayesian-optimization==1.2.0 \
rpy2==3.5.3 \
pingouin==0.5.2 \
quantecon==0.5.3 \
matplotlib==3.5.3 \
sdeint==0.3.0 \
pandas_market_calendars==3.5 \
dgl==0.9.0 \
ruptures==1.1.7 \
simpy==4.0.1 \
scikit-learn-extra==0.2.0 \
ray==2.0.0 \
"ray[rllib]"==2.0.0 \
fastText==0.9.2 \
tigramite==5.0.0.1 \
h2o==3.36.1.4 \
prophet==1.1.1 \
Riskfolio-Lib==3.3.0 \
nbeats-keras==1.7.0 \
nbeats-pytorch==1.6.0 \
torch==1.12.1 \
torchvision==0.13.1 \
ax-platform==0.2.7.2 \
alphalens-reloaded==0.4.2 \
pyfolio-reloaded==0.9.4 \
altair==4.2.0 \
stellargraph==1.2.1 \
modin==0.15.3 \
persim==0.3.1 \
ripser==0.6.4 \
pydmd==0.4.0.post2209 \
EMD-signal==1.2.3 \
spacy==3.4.1 \
pandas-ta==0.3.14b \
pytorch-ignite==0.4.10 \
finrl==0.3.1 \
tensorly==0.7.0 \
mlxtend==0.20.0 \
shap==0.41.0 \
lime==0.2.0.1 \
tensorflow-probability==0.18.0 \
mpmath==1.2.1 \
tensortrade==1.0.3 \
polars==0.14.11 \
stockstats==0.4.1 \
autokeras==1.0.20 \
QuantStats==0.0.59 \
hurst==0.0.5 \
numerapi==2.12.4 \
pymdptoolbox==4.0-b3 \
fuzzy-c-means==1.6.3 \
panel==0.14.0 \
hvplot==0.8.1 \
line-profiler==3.5.1 \
py-heat==0.0.6 \
py-heat-magic==0.0.2 \
bokeh==2.4.3 \
tensorflow-decision-forests==1.0.1 \
river==0.13.0 \
stumpy==1.11.1 \
pyvinecopulib==0.6.2
RUN python -m spacy download en_core_web_md
RUN conda install -y -c conda-forge \
openmpi=4.1.4 \
&& conda clean -y --all
# Install PyTorch Geometric
RUN TORCH=$(python -c "import torch; print(torch.__version__)") && \
CUDA=$(python -c "import torch; print('cu' + torch.version.cuda.replace('.', ''))") && \
pip install --no-cache-dir -f https://pytorch-geometric.com/whl/torch-${TORCH}+${CUDA}.html \
torch-scatter==2.0.9 torch-sparse==0.6.14 torch-cluster==1.6.0 torch-spline-conv==1.2.1 torch-geometric==2.0.4
RUN python -m nltk.downloader -d /usr/share/nltk_data punkt && \
python -m nltk.downloader -d /usr/share/nltk_data vader_lexicon && \
python -m nltk.downloader -d /usr/share/nltk_data stopwords
# Install ppscore
RUN wget https://cdn.quantconnect.com/ppscore/ppscore-master-ce93fa3.zip && \
unzip -q ppscore-master-ce93fa3.zip && cd ppscore-master && \
pip install . && cd .. && rm -rf ppscore-master && rm ppscore-master-ce93fa3.zip
# Install DX Analytics
RUN wget https://cdn.quantconnect.com/dx/dx-master-69922c0.zip && \
unzip -q dx-master-69922c0.zip && cd dx-master && \
pip install . && cd .. && rm -rf dx-master && rm dx-master-69922c0.zip
# Install Pyrb
RUN wget https://cdn.quantconnect.com/pyrb/pyrb-master-250054e.zip && \
unzip -q pyrb-master-250054e.zip && cd pyrb-master && \
pip install . && cd .. && rm -rf pyrb-master && rm pyrb-master-250054e.zip
# Install SSM
RUN wget https://cdn.quantconnect.com/ssm/ssm-master-646e188.zip && \
unzip -q ssm-master-646e188.zip && cd ssm-master && \
pip install . && cd .. && rm -rf ssm-master && rm ssm-master-646e188.zip
# Install TA-lib for python
RUN wget https://cdn.quantconnect.com/ta-lib/ta-lib-0.4.0-src.tar.gz && \
tar -zxvf ta-lib-0.4.0-src.tar.gz && cd ta-lib && \
./configure --prefix=/usr && make && make install && \
wget https://cdn.quantconnect.com/ta-lib/TA_Lib-0.4.18.zip && \
unzip -q TA_Lib-0.4.18.zip && cd ta-lib-TA_Lib-0.4.18 && \
python setup.py install && cd ../.. && rm -rf ta-lib && rm ta-lib-0.4.0-src.tar.gz
# Due to conflicts install 'pomegranate' virtual environment package
RUN python -m venv /Foundation-Pomegranate --system-site-packages && . /Foundation-Pomegranate/bin/activate \
&& pip install --no-cache-dir \
pomegranate==0.14.8 \
&& python -m ipykernel install --name=Foundation-Pomegranate \
&& deactivate
# Due to conflicts install 'tensorforce' virtual environment package with older tensorflow
RUN python -m venv /Foundation-Tensorforce && . /Foundation-Tensorforce/bin/activate \
&& pip install --no-cache-dir \
tensorflow==2.6.0 \
keras==2.6.0 \
tensorforce==0.6.5 \
gym==0.21 \
jupyterlab==3.4.4 \
clr-loader==0.1.6 \
stable-baselines3==1.6.0 \
alphapy==2.5.0 \
&& python -m ipykernel install --name=Foundation-Tensorforce \
&& deactivate
RUN echo "{\"argv\":[\"python\",\"-m\",\"ipykernel_launcher\",\"-f\",\"{connection_file}\"],\"display_name\":\"Foundation-Py-Default\",\"language\":\"python\",\"metadata\":{\"debugger\":true}}" > /opt/miniconda3/share/jupyter/kernels/python3/kernel.json
# List all packages
RUN conda list