forked from QuantConnect/Lean
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DockerfileLeanFoundation
305 lines (279 loc) · 12.3 KB
/
DockerfileLeanFoundation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
#
# 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 <[email protected]>
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
# Install OS Packages:
# Misc tools for running Python.NET and IB inside a headless container.
RUN apt-get update && apt-get -y install wget curl unzip \
&& apt-get install -y git bzip2 zlib1g-dev \
xvfb libxrender1 libxtst6 libxi6 libglib2.0-dev libopenmpi-dev libstdc++6 openmpi-bin \
pandoc libcurl4-openssl-dev libgtk2.0.0 build-essential \
&& 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 -q https://cdn.quantconnect.com/interactive/ibgateway-latest-standalone-linux-x64.v10.20.1f.sh && \
chmod 777 ibgateway-latest-standalone-linux-x64.v10.20.1f.sh && \
./ibgateway-latest-standalone-linux-x64.v10.20.1f.sh -q -dir /root/ibgateway && \
rm ibgateway-latest-standalone-linux-x64.v10.20.1f.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-py38_23.1.0-1-Linux-x86_64.sh"
ENV PATH="/opt/miniconda3/bin:${PATH}"
RUN wget -q https://cdn.quantconnect.com/miniconda/${CONDA} && \
bash ${CONDA} -b -p /opt/miniconda3 && rm -rf ${CONDA}
# Avoid pip install read timeouts
ENV PIP_DEFAULT_TIMEOUT=120
# Install all packages
RUN pip install --no-cache-dir \
cython==0.29.33 \
pandas==1.5.3 \
scipy==1.10.1 \
numpy==1.23.5 \
wrapt==1.14.1 \
astropy==5.2.1 \
beautifulsoup4==4.11.2 \
dill==0.3.6 \
jsonschema==4.17.3 \
lxml==4.9.2 \
msgpack==1.0.4 \
numba==0.56.4 \
xarray==2023.1.0 \
plotly==5.13.1 \
jupyterlab==3.4.4 \
tensorflow==2.11.0 \
docutils==0.19 \
cvxopt==1.3.0 \
gensim==4.3.0 \
keras==2.11.0 \
lightgbm==3.3.5 \
mpi4py==3.1.4 \
nltk==3.8.1 \
graphviz==0.20.1 \
cmdstanpy==1.1.0 \
copulae==0.7.7 \
featuretools==0.23.1 \
PuLP==2.7.0 \
pymc==5.0.2 \
rauth==0.7.3 \
scikit-learn==1.2.1 \
scikit-multiflow==0.5.3 \
scikit-optimize==0.9.0 \
aesara==2.8.12 \
tsfresh==0.20.0 \
tslearn==0.5.3.2 \
tweepy==4.10.0 \
PyWavelets==1.4.1 \
umap-learn==0.5.3 \
fastai==2.7.11 \
arch==5.3.1 \
copulas==0.8.0 \
creme==0.6.1 \
cufflinks==0.17.3 \
gym==0.21 \
ipywidgets==8.0.4 \
deap==1.3.3 \
cvxpy==1.3.0 \
pykalman==0.9.5 \
pyportfolioopt==1.5.4 \
pmdarima==2.0.2 \
pyro-ppl==1.8.4 \
riskparityportfolio==0.4 \
sklearn-json==0.1.0 \
statsmodels==0.13.5 \
QuantLib==1.29 \
xgboost==1.7.4 \
dtw-python==1.3.0 \
gluonts==0.12.3 \
gplearn==0.4.2 \
jax==0.4.4 \
jaxlib==0.4.4 \
keras-rl==0.4.2 \
pennylane==0.29.0 \
PennyLane-Lightning==0.29.0 \
pennylane-qiskit==0.29.0 \
qiskit==0.41.1 \
neural-tangents==0.6.2 \
mplfinance==0.12.9b7 \
hmmlearn==0.2.8 \
catboost==1.1.1 \
fastai2==0.0.30 \
scikit-tda==1.0.0 \
ta==0.10.2 \
seaborn==0.12.2 \
optuna==3.1.0 \
findiff==0.9.2 \
sktime==0.16.1 \
hyperopt==0.2.7 \
bayesian-optimization==1.4.2 \
pingouin==0.5.3 \
quantecon==0.6.0 \
matplotlib==3.7.0 \
sdeint==0.3.0 \
pandas_market_calendars==4.1.4 \
dgl==1.0.1 \
ruptures==1.1.7 \
simpy==4.0.1 \
scikit-learn-extra==0.2.0 \
ray==2.3.0 \
"ray[tune]"==2.3.0 \
"ray[rllib]"==2.3.0 \
fastText==0.9.2 \
h2o==3.40.0.1 \
prophet==1.1.2 \
nbeats-keras==1.8.0 \
nbeats-pytorch==1.8.0 \
torch==1.13.1 \
torchvision==0.14.1 \
ax-platform==0.3.0 \
alphalens-reloaded==0.4.3 \
pyfolio-reloaded==0.9.5 \
altair==4.2.2 \
stellargraph==1.2.1 \
modin==0.18.1 \
persim==0.3.1 \
ripser==0.6.4 \
pydmd==0.4.0.post2301 \
EMD-signal==1.4.0 \
spacy==3.5.0 \
pandas-ta==0.3.14b \
pytorch-ignite==0.4.11 \
finrl==0.3.1 \
tensorly==0.8.0 \
mlxtend==0.21.0 \
shap==0.41.0 \
lime==0.2.0.1 \
tensorflow-probability==0.19.0 \
mpmath==1.2.1 \
tensortrade==1.0.3 \
polars==0.16.9 \
stockstats==0.5.2 \
autokeras==1.1.0 \
QuantStats==0.0.59 \
hurst==0.0.5 \
numerapi==2.13.2 \
pymdptoolbox==4.0-b3 \
fuzzy-c-means==1.6.3 \
panel==0.14.3 \
hvplot==0.8.2 \
line-profiler==4.0.2 \
py-heat==0.0.6 \
py-heat-magic==0.0.2 \
bokeh==2.4.3 \
tensorflow-decision-forests==1.2.0 \
river==0.14.0 \
stumpy==1.11.1 \
pyvinecopulib==0.6.2 \
ijson==3.2.0.post0 \
jupyter-resource-usage==0.7.2 \
injector==0.20.1 \
openpyxl==3.1.1 \
xlrd==2.0.1 \
mljar-supervised==0.11.5 \
dm-tree==0.1.8 \
lz4==4.3.2 \
ortools==9.4.1874 \
py_vollib==1.0.1 \
neuralprophet[live]==0.5.0 \
tensorflow-addons==0.19.0 \
thundergbm==0.3.17 \
yellowbrick==1.5 \
livelossplot==0.5.5 \
gymnasium==0.26.3 \
interpret==0.3.0 \
DoubleML==0.5.2 \
jupyter-bokeh==3.0.5 \
imbalanced-learn==0.10.1 \
scikeras==0.10.0 \
openai==0.26.5 \
lazypredict==0.2.12 \
fracdiff==0.9.0 \
darts==0.23.1 \
fastparquet==2023.2.0 \
tables==3.8.0 \
dimod==0.12.3 \
dwave-samplers==1.0.0 \
python-statemachine==1.0.3 \
pymannkendall==1.4.3 \
Pyomo==6.5.0 \
gpflow==2.7.0 \
pyarrow==11.0.0 \
dwave-ocean-sdk==6.1.1 \
chardet==5.1.0 \
stable-baselines3==1.7.0
# Install dwave tool
RUN dwave install --all -y
# Install 'ipopt' solver for 'Pyomo'
RUN conda install -c conda-forge ipopt==3.14.11 \
&& conda clean -y --all
# We install need to install separately else fails to find numpy
RUN pip install --no-cache-dir Riskfolio-Lib==4.0.3
# Install spacy models
RUN python -m spacy download en_core_web_md && python -m spacy download en_core_web_sm
RUN conda install -y -c conda-forge \
openmpi=4.1.5 \
&& 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.1.0 torch-sparse==0.6.16 torch-cluster==1.6.0 torch-spline-conv==1.2.1 torch-geometric==2.2.0
# Install nltk data
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 && \
python -m nltk.downloader -d /usr/share/nltk_data wordnet
# Install ppscore
RUN wget -q 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 -q 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 -q 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 -q 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 -q 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 -q 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 \
mxnet==1.9.1 \
tigramite==5.1.0.3 \
&& python -m ipykernel install --name=Foundation-Pomegranate \
&& 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
# Install wkhtmltopdf and xvfb to support HTML to PDF conversion of reports
RUN apt-get update && apt install -y xvfb wkhtmltopdf && \
apt-get clean && apt-get autoclean && apt-get autoremove --purge -y && rm -rf /var/lib/apt/lists/*
# Install fonts for matplotlib
RUN wget -q https://cdn.quantconnect.com/fonts/foundation.zip && unzip -q foundation.zip && rm foundation.zip \
&& mv "lean fonts/"* /usr/share/fonts/truetype/ && rm -rf "lean fonts/" "__MACOSX/"