最近需要使用 RQAlpha 进行国内的量化分析工作,并对 RQAlpha 进行了容器化处理,
方便使用 docker 和ks进行容器化管理
1.基于 jupyter/minimal-notebook jupyter的官方镜像,默认使用 python 3
2.使用Anaconda的mini-conda进行环境管理,可以自由切换python27和python3运行环境
3.使用pip安装了其他非conda管理的包内容
pip install bs4 cx-Oracle docopt future hdfs pyecharts PyMySQL raven typing lxml
4.使用编译方式安装了TA-lib,暂时为32bit版本,安装了国内流行的tushare
pip install tushare TA-lib
5.将matplotlib.pyplot自动导入,同时配合安装了国内流行的pyechart
6.安装了HDFS,cx-Oracle,PyMySQL等常用的数据连接包
可以在以下位置找到
https://github.com/limccn/rqalpha/tree/master/docker
完整的 Docker file内容
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. FROM jupyter/minimal-notebook LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>" USER root # libav-tools for matplotlib anim RUN apt-get update && \ apt-get install -y --no-install-recommends libav-tools && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # Install TA-lib RUN wget https://jaist.dl.sourceforge.net/project/ta-lib/ta-lib/0.4.0/ta-lib-0.4.0-src.tar.gz && \ tar xf ta-lib-0.4.0-src.tar.gz && rm ta-lib-0.4.0-src.tar.gz && \ cd ta-lib && \ ./configure --prefix=/usr &&\ make && make install && \ rm -rf /home/$NB_USER/ta-lib USER $NB_UID # Install Python 3 packages # Remove pyqt and qt pulled in for matplotlib since we're only ever going to # use notebook-friendly backends in these images RUN conda install --quiet --yes \ 'nomkl' \ 'ipywidgets=7.1*' \ 'pandas=0.19*' \ 'numexpr=2.6*' \ 'matplotlib=2.0*' \ 'scipy=0.19*' \ 'seaborn=0.7*' \ 'scikit-learn=0.18*' \ 'scikit-image=0.12*' \ 'sympy=1.0*' \ 'cython=0.25*' \ 'patsy=0.4*' \ 'statsmodels=0.8*' \ 'cloudpickle=0.2*' \ 'dill=0.2*' \ 'numba=0.31*' \ 'bokeh=0.12*' \ 'sqlalchemy=1.1*' \ 'hdf5=1.8.17' \ 'h5py=2.6*' \ 'vincent=0.4.*' \ 'beautifulsoup4=4.5.*' \ 'protobuf=3.*' \ 'bcolz' \ 'xlrd' && \ conda remove --quiet --yes --force qt pyqt && \ conda clean -tipsy && \ # Install RQAlpha pip install -i https://pypi.tuna.tsinghua.edu.cn/simple rqalpha && \ rm -rf /home/$NB_USER/.rqalpha/bundle/ && \ rqalpha update_bundle && \ # Install RQAlpha libs pip install bs4 cx-Oracle docopt future hdfs pyecharts PyMySQL raven typing lxml && \ pip install tushare TA-lib && \ rm -rf /home/$NB_USER/.cache/pip/ && \ # Activate ipywidgets extension in the environment that runs the notebook server jupyter nbextension enable --py widgetsnbextension --sys-prefix && \ # Also activate ipywidgets extension for JupyterLab jupyter labextension install @jupyter-widgets/jupyterlab-manager@^0.33.1 && \ npm cache clean && \ rm -rf $CONDA_DIR/share/jupyter/lab/staging && \ rm -rf /home/$NB_USER/.cache/yarn && \ rm -rf /home/$NB_USER/.node-gyp && \ fix-permissions $CONDA_DIR && \ fix-permissions /home/$NB_USER # Install facets which does not have a pip or conda package at the moment RUN cd /tmp && \ git clone https://github.com/PAIR-code/facets.git && \ cd facets && \ jupyter nbextension install facets-dist/ --sys-prefix && \ rm -rf facets && \ fix-permissions $CONDA_DIR && \ fix-permissions /home/$NB_USER # Import matplotlib the first time to build the font cache. ENV XDG_CACHE_HOME /home/$NB_USER/.cache/ RUN MPLBACKEND=Agg python -c "import matplotlib.pyplot" && \ fix-permissions /home/$NB_USER USER $NB_UID
以上所述就是小编给大家介绍的《RQAlpha Docker容器化Dockerfile》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Alone Together
Sherry Turkle / Basic Books / 2011-1-11 / USD 28.95
Consider Facebookit’s human contact, only easier to engage with and easier to avoid. Developing technology promises closeness. Sometimes it delivers, but much of our modern life leaves us less connect......一起来看看 《Alone Together》 这本书的介绍吧!