354 字
2 分钟
vectorbt学习_01安装
参考教程:
官方文档:https://vectorbt.dev/
vector-bt 例程介绍:https://www.jianshu.com/p/4fc4ce04b925
vectorbt中文资料有限,阅读官方英文材料效率较低,将学习过程梳理为笔记,方便大家学习。
由于水平所限,如有错误,欢迎指正。
docker失败
docker具体构建步骤参考
/home/john/docker/vectorbt/readme.txt原始安装docker时这里会卡顿
Collecting plotly>=4.12.0。。。
Collecting ccxt>=4.0.14 Downloading ccxt-4.1.2-py2.py3-none-any.whl (3.9 MB)
Collecting TA-Lib Downloading TA-Lib-0.4.28.tar.gz (357 kB)需要修改
(base) john@john-HLYL-WXX9:~/docker/vectorbt/vectorbt$ git diff Dockerfilediff --git a/Dockerfile b/Dockerfileindex 0200fa1..a9da8aa 100644--- a/Dockerfile+++ b/Dockerfile@@ -14,6 +14,8 @@ RUN chmod -R +x scripts
ARG FULL="yes"
+RUN pip install plotly>=4.12.0 -i https://pypi.doubanio.com/simple ## 新增的行+ RUN if [[ -n "${FULL}" ]] ; then \ scripts/install-talib.sh && pip install --no-cache-dir .[full] ; else \ pip install --no-cache-dir . ; fi@@ -36,4 +38,4 @@ RUN if [[ -n "${TEST}" ]] ; then \不可行,docker里安装talib失败。
conda+jupyter支持(依赖源码,成功)
conda create -n vectorbt_env python=3.8conda activate vectorbt_env
git clone git@github.com:polakowo/vectorbt.git vectorbtpip install -e vectorbt
conda install pyyamlpip install yfinancepip install PyPortfolioOpt
pip install backtraderpip install flask-SQLAlchemypip install pymysqlpip install -U kaleido
源码安装talib后pip安装(直接pip安装提示找不到头文件)源码下载:https://ta-lib.org/install/源码安装步骤:$ untar and cd$ ./configure --prefix=/usr$ make$ sudo make install
pip安装:pip install TA-Lib
pip install matplotlib==3.2.0 #cannot import name 'warnings' from 'matplotlib.dates'增加jupyter支持 、
另外根据文档https://algotrading101.com/learn/vectorbt-guide/,可通过
pip install -U "vectorbt[full]"安装完整版vectorbt(包含相关依赖项)
包升级
新增指标修改vectorbt源码和包升级
cd /home/john/git/repo_quantconda activate vectorbt_envpip install -e vectorbt部分信息可能已经过时