-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.sh
More file actions
108 lines (97 loc) · 1.84 KB
/
install.sh
File metadata and controls
108 lines (97 loc) · 1.84 KB
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
#!/bin/bash
set -ex
function check_result() {
if [ $? -ne 0 ]; then
echo " "
echo "do command failed for $1 !!!"
echo " "
exit 1
fi
}
RUN_QUIETLY=0
BUILD_CTP=0
INSTALL_TALIB=0
DEPS_ONLY=0
NO_CACHE=0
while getopts "qctdn" opt; do
case $opt in
q)
RUN_QUIETLY=1
;;
t)
INSTALL_TALIB=1
;;
c)
BUILD_CTP=1
;;
d)
DEPS_ONLY=1
;;
n)
NO_CACHE=1
;;
\?)
echo "Invalid option: -$OPTARG"
;;
esac
done
function build_ctp() {
pushd vnpy/api/ctp
bash build.sh
popd
}
function install_talib() {
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xzf ta-lib-0.4.0-src.tar.gz
pushd ta-lib/
./configure --prefix=/usr
make
make install
if [ $NO_CACHE -eq 0 ]; then
pip install ta-lib
else
pip install --no-cache ta-lib
fi
popd
rm ta-lib-0.4.0-src.tar.gz
rm -rf ta-lib
}
function query_build_ctp() {
echo "是否要安装'CTP'接口? (Do you need 'CTP' interface?)"
read -p "Enter [y]n: " var1
var1=${var1:-y}
if [ "$var1" = "y" ]; then
BUILD_CTP=1
fi
}
function query_install_talib() {
set +ex
python -c "import talib"
if [ $? -ne 0 ]; then
INSTALL_TALIB=1
fi
set -ex
}
function main() {
if [ $RUN_QUIETLY -eq 0 ]; then
query_build_ctp;
fi
query_install_talib;
if [ $BUILD_CTP -ne 0 ]; then
build_ctp;
fi
if [ $INSTALL_TALIB -ne 0 ]; then
install_talib;
fi
if [ $DEPS_ONLY -eq 0 ]; then
#Install Python Modules
if [ $NO_CACHE -eq 0 ]; then
pip install -r requirements.txt
else
pip install --no-cache -r requirements.txt
fi
#Install vn.py
python setup.py install
fi
}
main;