Giter Club home page Giter Club logo

vnpy_ctabacktester's Introduction

VeighNa框架的CTA投研模块

说明

图形化CTA策略回测模块,基于用户友好的图形界面实现简洁易用的数据下载、历史回测和参数优化等投研功能。

安装

安装环境推荐基于3.7.0版本以上的【VeighNa Studio】。

直接使用pip命令:

pip install vnpy_ctabacktester

或者下载源代码后,解压后在cmd中运行:

pip install .

vnpy_ctabacktester's People

Contributors

edanflame avatar lanceyliao avatar noranhe avatar vnpy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vnpy_ctabacktester's Issues

回测k线图表 数据量多了后拖动很卡, 建议进行显示内存优化

环境
操作系统: 如Windows 11
Python版本: 3.7
VeighNa版本: 3.3.0
Issue类型
三选一:Enhancement

预期程序行为
拖动不卡,流畅拖动,

实际程序行为
实际行为: 导入10年1分钟的数据大概50w条,拖一下卡半天,卡得电脑都动不了。建议进行大数据量下的内存优化。

重现步骤
微信截图_20220923151947

策略编辑不支持Linux

  1. ui/widget.py 中建议增加Linux环境判断,获得系统default editor;
  2. line 515, 在Linux中测试 subprocess.run(cmd, check=True) 可以,但是 subprocess.run(cmd, shell=True)就看不到当前编辑的文件了。

mac环境下加载策略失败

可能mac和windows的路径分隔符不一致,mac环境下会失败
需要修改/vnpy_ctabacktester/engine.py:95的代码为

pathname: str = str(path) + f"/*.{suffix}"

希望作者兼容一下mac

backtester statistics error: divide by zero

The backtester gives the runtime error:

RuntimeWarning: divide by zero encountered in double_scalars
  return_drawdown_ratio: float = -total_return / max_ddpercent

This is due to the max_ddpercent may be 0 in some kind of trading.

We can just assign return_drawdown_ratio=0 if the max_ddpercent is 0. This can avoid runtime waning.

50w数据量 点击回测 回放数据大概要30分钟 而且不能ui卡住 不能动弹,这个能优化下吗 缩短时间

环境
操作系统: 如Windows 10 8G 内存 10400F的cpu 显卡1080ti
Python版本: 3.7
VeighNa版本: 3.3.0
Issue类型
三选一:Enhancement

预期程序行为
回放速度正常,UI不被卡住。

实际程序行为
实际行为: 50w数据量 点击回测 回放数据大概要30分钟 而且不能ui卡住 不能动弹,这个能优化下吗 缩短时间。UI不会被卡住啊

重现步骤
大概50w数据量 点击-开始回测 等待数据导入-等待数据回放 (因为数据量太大,卡住了 鼠标转圈,UI不能动)

遗传算法问题

在vnstation或者jupyter中使用遗传算法优化策略时,有概率会出现多进程和numpy问题。

PySide6.QtWidgets.QBoxLayout.addWidget(pg.GraphicsLayoutWidget) TypeError

self.chart: BacktesterChart = BacktesterChart() //pg.GraphicsLayoutWidget
chart: QtWidgets.QVBoxLayout = QtWidgets.QVBoxLayout()
chart.addWidget(self.chart)

TypeError("'PySide6.QtWidgets.QBoxLayout.addWidget' called with wrong argument types:\n PySide6.QtWidgets.QBoxLayout.addWidget(BacktesterChart)\nSupported signatures:\n PySide6.QtWidgets.QBoxLayout.addWidget(PySide6.QtWidgets.QWidget, int = 0, PySide6.QtCore.Qt.Alignment = Default(Qt.Alignment))")

dialog.Accepted 没有定义

Traceback (most recent call last):
File "/opt/homebrew/Caskroom/miniforge/base/envs/vnpy/lib/python3.10/site-packages/vnpy_ctabacktester/ui/widget.py", line 406, in start_optimization
if i != dialog.Accepted:
AttributeError: 'OptimizationSettingEditor' object has no attribute 'Accepted'. Did you mean: 'accepted'?
Traceback (most recent call last):
File "/opt/homebrew/Caskroom/miniforge/base/envs/vnpy/lib/python3.10/site-packages/vnpy_ctabacktester/ui/widget.py", line 406, in start_optimization
if i != dialog.Accepted:
AttributeError: 'OptimizationSettingEditor' object has no attribute 'Accepted'. Did you mean: 'accepted'?
qt.pointer.dispatch: skipping QEventPoint(id=1 ts=0 pos=0,0 scn=4549.06,697.076 gbl=4549.06,697.076 Released ellipse=(1x1 ∡ 0) vel=0,0 press=-4549.06,-697.076 last=-4549.06,-697.076 Δ 4549.06,697.076) : no target window

Macos 13.1
VNPY 3.5.0
根据1.0.9版本升级说明,应给是替换GraphicsWindow到 GraphicsLayoutWidget 以后的问题,不知道是不是mac上qt6的问题

希望增加几个回测指标

实盘中,有两个回撤指标特别受关注
1、最长回撤时间
2、最大回撤对应的恢复时间
看是否有时间添加

另外,cta的单独回测或者组合回测的时候,能否显示仓位的杠杆率水平(或者仓位水平),时序的或者最大的杠杆率(仓位)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.