Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A股回测框架, 模拟实盘账户交易, 适合编写T+0策略

NotificationsYou must be signed in to change notification settings

NashLea/autoxd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

简单快捷的A股回测环境, 适合编写T+0策略

  • 特性

    • 使用pandas编写策略
    • 结果可以在页面显示, 类似matlab的publish
    • 并行执行策略
    • 本地账户, 模拟实盘交易细节, 支持T+0, 交易成本计算
    • 自创FOUR指标, 简单计算多空
  • 变更

    • 见docs/changelog.txt
    • v0.4.1 支持macos
    • v0.4 大幅优化速度
    • v0.3 python3支持
  • 日线例子

python boll_fencang.py

image
image

  • 5分钟例子
python five_chengben.py

  • 依赖
  1. rediswindow可以去网盘 下载一个, 调用里面的bat即可安装
  2. 支持py2及py3 windows; macos支持py3, linux未知
  3. 推荐使用wingide, 可直接加载wpr项目文件
  4. 用pip install -r requirements.txt安装相关依赖包
  • 安装

    • 安装Anaconda
    • 下载autoxd
    git clone https://github.com/nessessary/autoxd.gitcd autoxdpip install -r requirements.txtpip install git+https://github.com/hanxiaomax/pyh.gitpip install git+https://github.com/matplotlib/mpl_finance.gitpython setup.py install
    • 安装redis
    • 跑strategy/five_chengben.py, 策略都放在该目录
  • 使用

  1. 跑five_chengben.py, 定义参数 setParams函数实现策略 Run函数, 修改cpu_num可以使用多进程
cd strategypython five_changben.py
  1. 数据源,使用自定义的数据; 注意,已使用ths分红表进行了前复权

    • 使用自定义的第三方数据源, 已实现了一个调用tushare的例子,datasource_mode=stock.DataSources.datafrom.custom
    • 5分钟线使用的是pytdx的例子
  2. 调用

#设置策略参数defsetParams(s):s.setParams(trade_num=300,pl=publish.Publish()#发布至页面, 注释则不发布                      )backtest_policy.test_strategy(codes,BollFenCangKline,setParams,mode=myenum.hisdat_mode,start_day='2017-4-10',end_day='2018-9-15',datasource_mode=DataSources.datafrom.custom,datasource_fn=fnSample                                )

About

A股回测框架, 模拟实盘账户交易, 适合编写T+0策略

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python99.3%
  • HTML0.7%

[8]ページ先頭

©2009-2025 Movatter.jp