基于VNPY进行功能增强
Project description
quant vnpy
一、 简介
1. 功能简介
本工具包是基于vnpy的回测库的一些增强函数
- quant_vnpy 目录包含各种增强函数及类库
- strategies 为策略库
2. 版本历史
2021-01-04 v0.4.10
fix: MACDSignal
2021-01-04 v0.4.9
fix: check not strategy_status_monitor.is_alive()
2020-12-27 v0.4.8
backtest: reset_index on result_df fix: portfolio template, last_order_dt -> dict feat: add new TargetPosAndPriceTemplate, MACrossSignal
2020-12-27 v0.4.7
backtest: default rate backtest: available filter for return_drawdown_ratio < 2 and np.round for some stats items
2020-12-25 v0.4.6
backtest: auto search symbol size fix: report gl calc wrong in some cases
2020-12-23 v0.4.4
fix: report holding pos status calc wrong fix: stop_opening_pos on templates
2020-12-22 v0.4.2
fix: order_data_collector error on portfolio_strategy.template
2020-12-21 v0.4.1
fix: open_price -> last_price
2020-12-18 v0.4.0
support user_name, broker_id add last_order_dt on template
2020-12-18 v0.3.9
fix: orm close connection feat: position daily stat.
2020-12-16 v0.3.7
add CrossLimitMethod.fix_price for backtest add quant_vnpy.backtest.cta_strategy.template.CtaTemplate backtest cross price method
2020-12-14 v0.3.2
add position monitor
2020-12-11 v0.2.16
on_tick active on_bar by bg on template.py add OrderDataCollector, TradeDataCollector class add stop_if_pos_2_0 on cta template bug fix of on_tick and report error
2020-12-04 v0.2.8
more readable log
2020-11-30 v0.2.7
orm add symbols
2020-11-27 v0.2.3
bug fix on log format
2020-11-25 v0.2.2
bug fix on on_stop of portfolio template
2020-11-25 v0.2.1
add strategy status monitor
2020-11-24 v0.1.10
add bar_count
2020-11-20 v0.1.8
bug fix on portfolio's template
2020-11-17 v0.1.7
对 cta 及 portfolio 增加 template 模板类 signal 增加 0 判断 当 0 时,默认为 default 值 add current_bar for cta, portfolio's template classes fix template bugs
2020-11-15 v0.1.2
最新依赖版本 IBATS_Common>=0.20.8,最新支持道 vnpy 2.1.7 版本 调整 INSTRUMENT_TRADE_TIME_PAIR_DIC 道 constants.py
2020-11-10 v0.1.0
基于vnpy 2.1.6进行的功能增强。此前版本不支持。
二、 环境设置及组件安装(首次运行前需要)
1. 系统环境包含 Anaconda 或 Miniconda(python 3.7 版本)
2. 安装 vnpy 2.1.6或以上版本 \
3. 运行按照相关组件
pip isntall -r requirement.txt
conda install -c plotly plotly-orca
conda install -c plotly python-kaleido
如果执行遇到问题可分别执行如下:
-
通用组件
pip install -r requirement.txt
-
orca 组件 orca 组件为回测功能中保存回测视图结果的组件,windows系统性需要单独安装,才可保证功能正常使用
安装步骤如下:-
安装组件包
conda install -c plotly plotly-orca
-
下载并安装 orca 应用
组件下载地址:orca组件
安装后设置话就环境变了 Path 加入相应路径,默认情况下window10操作系统 orca 组件将被安装在如下路径:
C:\Users\mmmaaaggg\AppData\Local\Programs\orca
- 批量关闭 orca 进程方法
ps -ef | grep orca | grep -v grep | awk '{print $2}' | xargs kill -9
-
-
MD文件转word文档工具
到pandoc官网下载对应的软件并安装后即可运行 Scripts\md_2_docx.bat 脚本
三、 常用命令
-
切换远程仓库地址方法
>git remote origin >git remote get-url --all origin git@192.168.10.117:quant/quant_vnpy.git >git remote set-url origin http://209386rt46.51vip.biz:23987/quant/quant_vnpy.git >git pull Username for 'http://209386rt46.51vip.biz:23987': Username for 'http://209386rt46.51vip.biz:23987': maguo Password for 'http://maguo@209386rt46.51vip.biz:23987': remote: Enumerating objects: 8, done. remote: Counting objects: 25% (2/8) remote: Counting objects: 100% (8/8), done. remote: Total 72 (delta 8), reused 8 (delta 8), pack-reused 64 Unpacking objects: 6% (5/72)Unpacking objects: 18% (13/72)Unpacking objects: 23% (17/72)Unpacking objects: 29% (21/72)Unpacking objects: 34% (25/72)Unpacking objects: 38% (28/72)Unpacking objects: 41% (30/72)Unpacking objects: 43% (31/72)Unpacking objects: 44% (32/72)Unpacking objects: 47% (34/72)Unpacking objects: 50% (36/72)Unpacking objects: 56% (41/72)Unpacking objects: 59% (43/72)Unpacking objects: 62% (45/72)Unpacking objects: 70% (51/72)Unpacking objects: 76% (55/72), 13.34 KiB | 26.00 KiB/sUnpacking objects: 80% (58/72), 13.34 KiB | 26.00 KiB/sUnpacking objects: 84% (61/72), 13.34 KiB | 26.00 KiB/sUnpacking objects: 88% (64/72), 13.34 KiB | 26.00 KiB/sUnpacking objects: 90% (65/72), 13.34 KiB | 26.00 KiB/sUnpacking objects: 94% (68/72), 13.34 KiB | 26.00 KiB/sUnpacking objects: 97% (70/72), 13.34 KiB | 26.00 KiB/sUnpacking objects: 100% (72/72), 17.93 KiB | 23.00 KiB/s, done. From http://209386rt46.51vip.biz:23987/quant/From http://209386rt46.51vip.biz:23987/quant/quant_vnpy cb6c014..1afe166 master -> origin/master Updating cb6c014..1afe166 Fast-forward README.md | 7 + ... 8 files changed, 404 insertions(+), 106 deletions(-)
-
数据库 dump 数据
备份主力合约
"c:\Program Files\MySQL\MySQL Server 8.0\bin\mysqldump.exe" -u mg -p --databases vnpy dbbardata --where="symbol in ('rb9999', 'hc9999', 'i9999') and `interval`='1m'" > dbbardata_dump.sql
备份主力,次主力合约
"c:\Program Files\MySQL\MySQL Server 8.0\bin\mysqldump.exe" -u mg -p vnpy dbbardata --where="(symbol like'%9999' or symbol like'%8888') and `interval`='1m'" > dbbardata_dump.sql
-
压缩命令
zip -r0q /media/mg/Data/output_20201220.zip output
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for quant_vnpy-0.4.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5a533b0c8a4ca04fbfc8aa14503cd70a611d120471a07b6f8a1d527534c23ab |
|
MD5 | 5b57ba3618fae9b54a5ae9744b2a2b30 |
|
BLAKE2b-256 | 503354e3a93bfa2d1cf954b27862fc2e8979dcf21e70ede2eaa3292fb907d8ae |