Code Monkey home page Code Monkey logo

uikline's Introduction

uiKLine

本工具用来显示交易信号csv 效果图: 效果图

配合vnpy2.0+使用说明:

  • 第一步: 确保vnpy已经安装成功。并参考本项目文件夹vnpy下的engine.py修改vnpy项目中vnpy/app/cta_backtester/engine.py: 在run_backtesting函数中添加保存交易文件的代码:

      trades = self.get_all_trades() 
      self.write_log('正在计算交易清单')
      self.calc_trades_pnl(trades,size,rate,slippage,interval)
      self.write_log('计算完成,正在写入交易结果文件')
      self.trade_to_csv(trades)
      self.write_log('交易文件保存完成')
    

    以及对应的calc_trades_pnl和trade_to_csv两个函数。

  • 第二步:回测策略后生成trade_result.csv在vnpy的用户目录下(一般是/user/xxx/trade_result.csv) 这时候可以修改csv第一行的interval列为想显示的K线,比如回测用的是1m数据,显示的时候想显示在小时图上, 可以将第一行的interval改为60m,即可显示小时图K线。 sample

  • 第三步:直接运行uiKLine.py即可,K线数据会自动从vnpy的database_manager数据库中调用。

uikline's People

Contributors

moonnejs avatar eachout avatar

Watchers

James Cloos avatar

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.