Skip to content

Commit

Permalink
Merge pull request vnpy#2432 from vnpy/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
vnpy authored Apr 14, 2020
2 parents f1f86b4 + 83105a1 commit d7607da
Show file tree
Hide file tree
Showing 422 changed files with 44,821 additions and 23,950 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
recursive-include vnpy *.ico *.ini *.dll *.so *.pyd *.h *.hpp *.cpp *.a *.dat
recursive-include vnpy *.ico *.ini *.dll *.so *.pyd *.h *.hpp *.cpp *.a *.dat *.pfx
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</p>

<p align="center">
<img src ="https://img.shields.io/badge/version-2.1.1-blueviolet.svg"/>
<img src ="https://img.shields.io/badge/version-2.1.2-blueviolet.svg"/>
<img src ="https://img.shields.io/badge/platform-windows|linux|macos-yellow.svg"/>
<img src ="https://img.shields.io/badge/python-3.7-blue.svg" />
<img src ="https://img.shields.io/github/workflow/status/vnpy/vnpy/Python%20application/master"/>
Expand Down Expand Up @@ -44,7 +44,9 @@ vn.py是一套基于Python的开源量化交易系统开发框架,于2015年1

* 宽睿(oes):国内证券(A股)

* 中泰XTP(xtp):国内证券(A股)
* 中泰XTP(xtp):国内证券(A股)、ETF期权

* 恒生期权(hsoption):ETF期权

* 华鑫奇点(tora):国内证券(A股)

Expand All @@ -54,6 +56,8 @@ vn.py是一套基于Python的开源量化交易系统开发框架,于2015年1

* 融航(rohon):期货资管

* 中汇亿达(comstar):银行间市场

* 海外市场

* 富途证券(futu):港股、美股
Expand All @@ -68,6 +72,8 @@ vn.py是一套基于Python的开源量化交易系统开发框架,于2015年1

* OANDA(oanda):外汇、CFD

* Alpaca(alpaca):美股(零佣金)

* 数字货币

* BitMEX(bitmex):数字货币期货、期权、永续合约
Expand Down Expand Up @@ -116,6 +122,8 @@ vn.py是一套基于Python的开源量化交易系统开发框架,于2015年1

* option_master:期权交易模块,针对国内期权市场设计,支持多种期权定价模型、隐含波动率曲面计算、希腊值风险跟踪等功能

* portfolio_strategy:组合策略模块,面向同时交易多合约的量化策略(Alpha、期权套利等),提供历史数据回测和实盘自动交易功能

* algo_trading:算法交易模块,提供多种常用的智能交易算法:TWAP、Sniper、Iceberg、BestLimit等等,支持常用算法配置保存

* script_trader:脚本策略模块,针对多标的组合类交易策略设计,同时也可以直接在命令行中实现REPL指令形式的交易,不支持回测功能
Expand All @@ -128,8 +136,6 @@ vn.py是一套基于Python的开源量化交易系统开发框架,于2015年1

* data_manager:历史数据管理模块,通过树形目录查看数据库中已有的数据概况,选择任意时间段数据查看字段细节,支持CSV文件的数据导入和导出

* csv_loader:CSV历史数据加载器,用于加载CSV格式文件中的历史数据到平台数据库中,用于策略的回测研究以及实盘初始化等功能,支持自定义数据表头格式

* data_recorder:行情记录模块,基于图形界面进行配置,根据需求实时录制Tick或者K线行情到数据库中,用于策略回测或者实盘初始化

* excel_rtd:Excel RTD(Real Time Data)实时数据服务,基于pyxll模块实现在Excel中获取各类数据(行情、合约、持仓等)的实时推送更新
Expand All @@ -150,7 +156,7 @@ vn.py是一套基于Python的开源量化交易系统开发框架,于2015年1

## 环境准备

* 推荐使用vn.py团队为量化交易专门打造的Python发行版[VNStudio-2.1.1](https://download.vnpy.com/vnstudio-2.1.1.exe),内置了最新版的vn.py框架以及VN Station量化管理平台,无需手动安装
* 推荐使用vn.py团队为量化交易专门打造的Python发行版[VNStudio-2.1.2](https://download.vnpy.com/vnstudio-2.1.2.exe),内置了最新版的vn.py框架以及VN Station量化管理平台,无需手动安装
* 支持的系统版本:Windows 7以上/Windows Server 2008以上/Ubuntu 18.04 LTS
* 支持的Python版本:Python 3.7 64位(**注意必须是Python 3.7 64位版本**

Expand Down
64 changes: 0 additions & 64 deletions docs/csv_loader.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ vn.py项目文档
introduction.md
install.md
quickstart.md
csv_loader.md
cta_strategy.md
cta_backtester.md
data_recoder.md
Expand Down
4 changes: 2 additions & 2 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ VNStudio是vn.py团队自行打包的一键安装版本,整合了:
- vn.py框架和其他相关库
- VN Station量化工作站(vn.py框架的图形化管理工具)

下载地址:[vnstudio-2.0.6.exe](https://download.vnpy.com/vnstudio-2.0.6.exe)
下载地址:[vnstudio-2.1.1.exe](https://download.vnpy.com/vnstudio-2.1.1.exe)

&nbsp;

Expand All @@ -25,7 +25,7 @@ VNStudio是vn.py团队自行打包的一键安装版本,整合了:
一路点击“下一步”即可完成VNStudio安装,安装完成后可以查看相关运行目录:

- VNStudio默认安装路径为C:\vnstudio;
- VNStudio默认json配置文件和数据库路径为C:\Users\Administrator\.vntrader
- VNStudio默认json配置文件和数据库路径为C:\Users\Administrator\\.vntrader
- VN Station量化工作站运行目录为C:\vnstudio\Scripts\vnstation.exe;
- vnpy运行目录在C:\vnstudio\Lib\site-packages\vnpy(进入该目录后,用户可以修改vnpy的相关功能)

Expand Down
2 changes: 1 addition & 1 deletion docs/spread_trading.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@

2)成交委托监控

- 【日志】组件显示发出买入xbt价差合约的顺序是:发出XBTZ19多头委托 -> XBTZ19委托成交 -> 发出XBTUSD空头委托 -> XBTUSD委托成交。价差交易必须遵循的逻辑是主动腿成交后,才去用被动腿来对冲头寸,并且对冲必须尽可能即使。这也为什么一般被动腿选择较为活跃合约的原因。
- 【日志】组件显示发出买入xbt价差合约的顺序是:发出XBTZ19多头委托 -> XBTZ19委托成交 -> 发出XBTUSD空头委托 -> XBTUSD委托成交。价差交易必须遵循的逻辑是主动腿成交后,才去用被动腿来对冲头寸,并且对冲必须尽可能及时。这也为什么一般被动腿选择较为活跃合约的原因。

- 【价差】组件显示买入1手xbt价差合约成交后,【净仓】从0变成1;实际上,VN Trader【持仓】组件显示,XBTZ19合约多头持仓1手,XBTUSD合约空头持仓1手。

Expand Down
77 changes: 77 additions & 0 deletions examples/portfolio_backtesting/backtesting_demo.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#%%\n",
"from datetime import datetime\n",
"\n",
"from vnpy.app.portfolio_strategy import BacktestingEngine\n",
"from vnpy.app.portfolio_strategy.strategies.trend_following_strategy import TrendFollowingStrategy\n",
"from vnpy.trader.constant import Interval"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#%%\n",
"engine = BacktestingEngine()\n",
"engine.set_parameters(\n",
" vt_symbols=[\"IF888.CFFEX\"],\n",
" interval=Interval.MINUTE,\n",
" start=datetime(2010, 2, 1),\n",
" end=datetime(2020, 4, 30),\n",
" rates={\"IF888.CFFEX\": 0.3/10000},\n",
" slippages={\"IF888.CFFEX\": 0.2},\n",
" sizes={\"IF888.CFFEX\": 300},\n",
" priceticks={\"IF888.CFFEX\": 0.2},\n",
" capital=1_000_000,\n",
")\n",
"engine.add_strategy(TrendFollowingStrategy, {})"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"#%%\n",
"engine.load_data()\n",
"engine.run_backtesting()\n",
"df = engine.calculate_result()\n",
"engine.calculate_statistics()\n",
"engine.show_chart()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
12 changes: 7 additions & 5 deletions examples/vn_trader/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# from vnpy.gateway.okexs import OkexsGateway
from vnpy.gateway.xtp import XtpGateway
# from vnpy.gateway.hbdm import HbdmGateway
# from vnpy.gateway.tap import TapGateway
from vnpy.gateway.tap import TapGateway
# from vnpy.gateway.tora import ToraGateway
# from vnpy.gateway.alpaca import AlpacaGateway
# from vnpy.gateway.da import DaGateway
Expand All @@ -50,7 +50,8 @@
# from vnpy.app.option_master import OptionMasterApp
# from vnpy.app.chart_wizard import ChartWizardApp
# from vnpy.app.excel_rtd import ExcelRtdApp
from vnpy.app.data_manager import DataManagerApp
# from vnpy.app.data_manager import DataManagerApp
from vnpy.app.portfolio_strategy import PortfolioStrategyApp


def main():
Expand Down Expand Up @@ -81,7 +82,7 @@ def main():
# main_engine.add_gateway(OkexfGateway)
# main_engine.add_gateway(HbdmGateway)
main_engine.add_gateway(XtpGateway)
# main_engine.add_gateway(TapGateway)
main_engine.add_gateway(TapGateway)
# main_engine.add_gateway(ToraGateway)
# main_engine.add_gateway(AlpacaGateway)
# main_engine.add_gateway(OkexsGateway)
Expand All @@ -107,8 +108,9 @@ def main():
# main_engine.add_app(OptionMasterApp)
# main_engine.add_app(ChartWizardApp)
# main_engine.add_app(ExcelRtdApp)
main_engine.add_app(DataManagerApp)

# main_engine.add_app(DataManagerApp)
main_engine.add_app(PortfolioStrategyApp)

main_window = MainWindow(main_engine, event_engine)
main_window.showMaximized()

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
six==1.13.0
wheel
PyQt5
pyqtgraph
dataclasses; python_version<="3.6"
Expand Down
2 changes: 1 addition & 1 deletion vnpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.1.1"
__version__ = "2.1.2"
Loading

0 comments on commit d7607da

Please sign in to comment.