2018-09-30 02:12:00 +00:00
|
|
|
|
# 用户
|
|
|
|
|
1、root,用于安装系统环境,如cmake,nodejs,boost等
|
|
|
|
|
2、trade,用于安装anaconda,运行vnpy服务程序
|
|
|
|
|
|
|
|
|
|
# 安装
|
2018-10-20 02:05:51 +00:00
|
|
|
|
1、下载 anaconda 3.6得64位安装包[trade用户]
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
1) wget -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.2.0-Linux-x86_64.sh
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
2) sh Anaconda3-5.2.0-Linux-x86_64.sh
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
安装过程,输入yes,同意安装目录 /home/trade/Anaconda3, 同意加入到trade这个用户得shell路径
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
3) 退出当前trade用户,重新登录
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
4) 更新一下 pip install --upgrade pip
|
|
|
|
|
|
2018-10-20 02:05:51 +00:00
|
|
|
|
2、 添加清华同方得源,到anaconda中. (如果服务器在海外,就免拉)[trade用户]
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
|
|
|
|
|
conda config --set show_channel_urls yes
|
|
|
|
|
|
2018-10-20 02:05:51 +00:00
|
|
|
|
3、创建python 3.5版本得环境。(为何不用3.6?我还没搞掂)[trade用户]
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
conda create --name py35 python=3.5
|
|
|
|
|
|
|
|
|
|
激活py35
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
source activate py35
|
|
|
|
|
|
2018-10-20 02:05:51 +00:00
|
|
|
|
4、更新ubuntu得开发环境 [ root用户 ]
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
apt-get -y install gcc
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
apt-get -y install make
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-10-20 06:58:05 +00:00
|
|
|
|
apt-get -y install cmake
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
apt-get -y install libssl-dev
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
apt-get -y install freetds-dev
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
apt-get -y install python-dev
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
apt-get -y install mpi-default-dev
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
apt-get -y install libicu-dev
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
apt-get -y install libbz2-dev
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
apt-get -y install libboost-thread-dev
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
apt-get -y install libboost-python-dev
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
apt-get -y install cython
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
apt-get -y install nodejs
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
apt-get -y update
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
apt-get -y install build-essential
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
apt-get -y install unzip
|
|
|
|
|
|
2018-10-20 02:05:51 +00:00
|
|
|
|
5、boost得安装( 仅用于支持CTP的接口)[ root用户 ]
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
wget http://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.tar.gz/download
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
改名 mv download boost_1_66_0.tar.gz
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
解压 tar -xvzf boost_1_66_0.tar.gz
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
cd boost_1_66_0/
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
记得先创建好py35的虚拟环境
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
export CPLUS_INCLUDE_PATH=/home/trade/anaconda3/envs/py35/include/python3.5m
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
修改 boost_1_66_0/tools/build/example/user-config.jam :
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
using python : 3.5 : /home/trade/anaconda3/envs/py35/bin/python3 : /home/trade/anaconda3/envs/py35/include/python3.5m : /home/trade/anaconda3/envs/py35/lib ;
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
把user-config.jam复制到用户目录
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
cp user-config.jam /root/
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
回到 boost_1_66_0/
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
运行bootstrap.sh
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
./bootstrap.sh --with-python=/home/trade/anaconda3/envs/py35/bin/python3 --with-python-version=3.5 --with-python-root=/home/trade/anaconda3/envs/py35
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
编译,安装
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
./b2 --buildtype=complete install 时间大概十几分钟
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-09-30 02:12:00 +00:00
|
|
|
|
检查 /usr/local下,include/boost, lib/libboos_python3.so等是否存在
|
|
|
|
|
|
2018-10-20 02:05:51 +00:00
|
|
|
|
6、安装talib [trade用户]
|
2018-10-20 07:01:57 +00:00
|
|
|
|
|
|
|
|
|
conda install -c quantopian ta-lib=0.4.9
|
2018-09-30 02:12:00 +00:00
|
|
|
|
|
2018-10-20 02:05:51 +00:00
|
|
|
|
7、下载vnpy [trade用户]
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-10-20 07:01:57 +00:00
|
|
|
|
wget -c https://github.com/msincenselee/vnpy/archive/master.zip
|
|
|
|
|
|
|
|
|
|
unzip master.zip
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-10-20 07:01:57 +00:00
|
|
|
|
cd vnpy-master
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-10-20 07:01:57 +00:00
|
|
|
|
安装 所有前置数据包
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-10-20 07:01:57 +00:00
|
|
|
|
pip install -r requirements.txt
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-10-20 07:01:57 +00:00
|
|
|
|
安装pyqt
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-10-20 07:01:57 +00:00
|
|
|
|
conda install pyqt
|
2018-09-30 02:12:00 +00:00
|
|
|
|
|
2018-10-20 06:57:34 +00:00
|
|
|
|
8、重新编译一次 CTP API(CentOS下无需重新编译)[trade用户]
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-10-20 06:57:34 +00:00
|
|
|
|
cd /home/trade/vnpy-master/api/ctp
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-10-20 06:57:34 +00:00
|
|
|
|
chmod a+x build.sh
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-10-20 06:57:34 +00:00
|
|
|
|
./build.sh
|
2018-10-20 06:59:44 +00:00
|
|
|
|
|
2018-10-20 06:57:34 +00:00
|
|
|
|
如果你全程不用trade用户得话,你需要修改 CMakefile.txt里面得路径哦,把/home/trade 修改为/root
|
|
|
|
|
|
2018-10-20 07:01:57 +00:00
|
|
|
|
9、数字货币方面[trade用户]
|
|
|
|
|
|
|
|
|
|
pip uninstall websocket;
|
|
|
|
|
|
|
|
|
|
pip uninstall websocket-client;
|
|
|
|
|
|
|
|
|
|
pip install websocket-client.
|