forked from QuantConnect/Lean
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DockerfileLeanFoundation
177 lines (146 loc) · 6.22 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
#
# LEAN Foundation Docker Container 20191113
# 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:0.9.22
MAINTAINER QuantConnect <[email protected]>
# 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 apt-get update && apt-get install -y git bzip2 unzip wget python3-pip python-opengl zlib1g-dev && \
apt-get install -y clang cmake curl xvfb libxrender1 libxtst6 libxi6 libglib2.0-dev libopenmpi-dev libstdc++6 && \
# Install R
apt-get install -y r-base pandoc libcurl4-openssl-dev
# Java for running IB inside container:
RUN apt-get install -y openjdk-8-jdk openjdk-8-jre
# Install IB Gateway: Installs to ~/Jts
RUN wget http://cdn.quantconnect.com/interactive/ibgateway-latest-standalone-linux-x64-v974.4g.sh && \
chmod 777 ibgateway-latest-standalone-linux-x64-v974.4g.sh && \
./ibgateway-latest-standalone-linux-x64-v974.4g.sh -q && \
wget -O ~/Jts/jts.ini http://cdn.quantconnect.com/interactive/ibgateway-latest-standalone-linux-x64-v974.4g.jts.ini && \
rm ibgateway-latest-standalone-linux-x64-v974.4g.sh
# Mono C# for LEAN:
# From https://github.com/mono/docker/blob/master/
RUN apt-get update && rm -rf /var/lib/apt/lists/*
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
RUN echo "deb http://download.mono-project.com/repo/ubuntu stable-xenial/snapshots/5.12.0.226 main" > /etc/apt/sources.list.d/mono-xamarin.list && \
apt-get update && apt-get install -y binutils mono-complete ca-certificates-mono mono-vbnc nuget referenceassemblies-pcl && \
apt-get install -y fsharp && rm -rf /var/lib/apt/lists/* /tmp/*
# 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} && \
ln -s /opt/miniconda3/lib/libpython3.6m.so /usr/lib/libpython3.6m.so
# Install supported third party python packages
# Updates conda and pip
RUN conda update -y conda pip
# Sets python version to 3.6.8
RUN conda install -y python=3.6.8
RUN conda clean -y --all
# Install essencial packages
RUN conda install -y \
cython=0.29.11 \
numpy=1.17.3 \
pandas=0.23.4 \
wrapt=1.11.2
# Install non-math packages
RUN conda install -y \
beautifulsoup4=4.8.0 \
dill=0.2.9 \
jsonschema=3.0.1 \
lxml=4.3.4 \
msgpack-python=0.5.6 \
setuptools-git=1.2
# Install math/ML packages
RUN conda install -y \
blaze=0.11.3 \
cvxopt=1.2.0 \
gensim=3.8.0 \
keras=2.2.4 \
lightgbm=2.2.3 \
nltk=3.4.3 \
pomegranate=0.10.0 \
scipy==1.3.1 \
tensorflow=1.13.1 \
xarray=0.13.0
# Install math/ML from conda-forge
RUN conda install -y -c conda-forge \
fbprophet=0.5 \
pulp=1.6.8 \
pymc3=3.7 \
rauth=0.7.3 \
scikit-learn==0.21.3 \
scikit-multiflow=0.4.1 \
scikit-optimize=0.5.2 \
theano=1.0.4 \
tsfresh=0.12.0
# Install math/ML from pytorch
RUN conda install -y -c pytorch \
pytorch=1.1.0 \
torchvision=0.3.0
# Install math/ML from fastai
RUN conda install -y -c fastai \
nvidia-ml-py3=7.352.0 \
fastai=1.0.54
# Clean up before pip installs
RUN conda clean -y --all
# Updates conda and pip
RUN pip install --upgrade pip
# Install from PIP I
RUN pip install gym==0.13.1 \
arch==4.8.1 \
copulalib==1.1.0 \
copulas==0.2.1 \
creme==0.3.0 \
cvxpy==1.0.24
# Install from PIP II
RUN pip install deap==1.3.0 \
mlfinlab==0.4.1 \
pykalman==0.9.5 \
pyportfolioopt==0.4.3 \
pyramid-arima==0.9.0 \
pyro-ppl==0.3.3
# Install from PIP III
RUN pip install sklearn==0.0 \
stable-baselines==2.6.0 \
statistics==1.0.3.5 \
tensorforce==0.4.3 \
QuantLib-Python==1.15 \
xgboost==0.90
RUN pip install --upgrade hmmlearn==0.2.2
RUN python -m nltk.downloader -d /usr/share/nltk_data punkt
RUN conda clean -y --all
# Install TA-lib for python
RUN wget http://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 && \
pip install TA-lib && cd .. && rm -irf ta-lib
# Install DX Analytics
RUN wget https://cdn.quantconnect.com/dx/dx-master-ffe19a6.zip && \
unzip -q dx-master-ffe19a6.zip && cd dx-master && \
python setup.py install && cd .. && rm -irf dx-master
# Install py-earth
RUN wget https://cdn.quantconnect.com/py-earth/py-earth-master-b209d19.zip && \
unzip -q py-earth-master-b209d19.zip && cd py-earth-master && \
python setup.py install && cd .. && rm -irf py-earth-master
# Install fastText
RUN wget https://cdn.quantconnect.com/fastText/fastText-master-9479e4e.zip && \
unzip -q fastText-master-9479e4e.zip && cd fastText-master && \
python setup.py install && cd .. && rm -irf fastText-master
# Update ODO
RUN wget https://cdn.quantconnect.com/odo/odo-master-9fce669.zip && \
unzip -q odo-master-9fce669.zip && cd odo-master && \
python setup.py install && cd .. && rm -irf odo-master
# Delete temporary zip files
RUN rm -irf *.zip *.gz
# Remove black-listed packages
RUN conda remove --force-remove -y s3transfer # Installed by gensim
RUN conda clean -y --all
# List all packages
RUN conda list