Package: quant-vnpy
quant vnpy一、 简介1. 功能简介本工具包是基于vnpy的回测库的一些增强函数quant_vnpy 目录包含各种增强函数及类库strategies 为策略库2. 版本历史2021-01-22 v0.6.0feat: add track performance feature.2021-01-19 v0.5.12fix: TargetPosAndPriceTemplate current_pos -> target_pos by one step
fix: strategy_class_name wrong2021-01-15 v0.5.5fix: add exception handle and logger on TradeDataCollector
fix: TargetPosAndPriceTemplate current_pos -> target_pos by one step2021-01-14 v0.5.1feat: record backtest statsfeat: add default rate for backtestfix: DCE夜盘交易日期为下一交易日，将会被重写为当前系统日期
fix: 修复跨日报表统计错误fix: cross_limit_method param missing for file_name_func functionfix: 主力合约、次主力合约数据复权整理 bug2021-01-08 v0.5.0refactor: merge portfolio run_backtest and cta run_backtest2021-01-07 v0.4.13feat: set_strategy_status(StrategyStatusEnum.Stopped)feat: monitor add setting2021-01-05 v0.4.11refactor: longer interval of plotly.io._orca.cleanupfeat: backtest: output param file if it's available2021-01-04 v0.4.10fix: MACDSignal2021-01-04 v0.4.9fix: check not strategy_status_monitor.is_alive()2020-12-27 v0.4.8feat: backtest: reset_index on result_dffix: portfolio template, last_order_dt -> dictfeat: add new TargetPosAndPriceTemplate, MACrossSignal2020-12-27 v0.4.7feat: backtest: default ratefeat: backtest: available filter for return_drawdown_ratio < 2 and np.round for some stats items2020-12-25 v0.4.6feat: backtest: auto search symbol sizefix: report gl calc wrong in some cases2020-12-23 v0.4.4fix: report holding pos status calc wrongfix: stop_opening_pos on templates2020-12-22 v0.4.2fix: order_data_collector error on portfolio_strategy.template2020-12-21 v0.4.1fix: open_price -> last_price2020-12-18 v0.4.0feat: support user_name, broker_idfeat: add last_order_dt on template2020-12-18 v0.3.9fix: orm close connectionfeat: position daily stat.2020-12-16 v0.3.7feat: add CrossLimitMethod.fix_price for backtestfeat: add quant_vnpy.backtest.cta_strategy.template.CtaTemplatefeat: backtest cross price method2020-12-14 v0.3.2add position monitor2020-12-11 v0.2.16feat: on_tick active on_bar by bg on template.pyfeat: add OrderDataCollector, TradeDataCollector classfeat: add stop_if_pos_2_0 on cta templatefix: bug fix of on_tick and report error2020-12-04 v0.2.8feat: more readable log2020-11-30 v0.2.7feat: orm add symbols2020-11-27 v0.2.3fix: bug fix on log format2020-11-25 v0.2.2fix: bug fix on on_stop of portfolio template2020-11-25 v0.2.1feat: add strategy status monitor2020-11-24 v0.1.10feat: add bar_count2020-11-20 v0.1.8bug fix on portfolio's template2020-11-17 v0.1.7feat: 对 cta 及 portfolio 增加 template 模板类feat: signal 增加  0 判断 当 0 时，默认为 default 值feat: add current_bar for cta, portfolio's template classesfix: template bugs2020-11-15 v0.1.2feat: 最新依赖版本 IBATS_Common>=0.20.8，最新支持道 vnpy 2.1.7 版本feat: 调整 INSTRUMENT_TRADE_TIME_PAIR_DIC 道 constants.py2020-11-10 v0.1.0feat: 基于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.txtorca 组件
orca 组件为回测功能中保存回测视图结果的组件，windows系统性需要单独安装，才可保证功能正常使用安装步骤如下：安装组件包conda install -c plotly plotly-orca下载并安装 orca 应用组件下载地址：orca组件安装后设置话就环境变了 Path 加入相应路径，默认情况下window10操作系统 orca 组件将被安装在如下路径：C:\Users\mmmaaaggg\AppData\Local\Programs\orca批量关闭 orca 进程方法ps-ef|greporca|grep-vgrep|awk'{print $2}'|xargskill-9MD文件转word文档工具到pandoc官网下载对应的软件并安装后即可运行 Scripts\md_2_docx.bat 脚本三、 常用命令1. 切换远程仓库地址方法>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
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:  
34% (25/72)Unpacking objects:  
Unpacking 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(-)2. 数据库 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.sql3. 压缩命令zip-r0q/media/mg/Data/output_20201220.zipoutput4. 独立启动交易界面d:\ide\vnstudio\python.exe -m vnstation runtrader "{'gateway': {'CTP': true}, 'app': {'CtaStrategy': true, 'PortfolioStrategy': true, 'PortfolioManager': true}, 'path': 'D:\\TradeTools\\vnpy\\jianxin_11859077'}"四、 各个版本常见错误2.0.3版本错误提示框太长，无法看到错误信息python.exe -m vnstation错误提示：ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject
解决方法：Scripts\pip.exe install numpy==1.16.1 --user穿透式测试通不过，采集不到CPU、硬盘、BIOS信息
修改环境变量
增加目录C:\Windows\SysWOW64\wbem