python开发的k线系统_【开源一个用于回测的Python交互K线工具】之【一】K线核心功能...

动机

个人量化研究,用vn.py回测和研究策略。

发现最痛苦的事情就是写完一个策略后,根本没法方便地检查自己的交易逻辑。每次打印日志之后,翻日志再找其他K线工具来校对,这个过程简直泪流满面。

在无数次面对日志抓瞎以后,决心寻找一个好用的Python K线工具,于是在知乎搜索 Python K线

哦,不错,有很多不错的Python K线案例嘛!

但是!!

刨去静态图片啊,上面的动态交互工具,都没办法让我方便地把策略回测的结果放进去。

如果能按一下键盘就可以在开平仓标记位置biu,biu跳转就更好了。

看来自己手撸一个交互K线是免不了的

结合商业软件的K线,简单列一下需求:屏幕K线数少的时候,反应要快

鼠标滚轮缩放,键盘缩放跳转

十字光标 显示K线详细信息

缩放自适应Y轴坐标

策略回测运行中产生的指标可以放到K线图中

买卖开平仓位置有箭头标记,并且通过键盘可以在标记之间跳转

成果

废话不说了,先来看成果基础K线模块回测结果K线展示界面风格抄袭了市面上看到的商业软件

界面缩放,十字光标移动顺畅

回测完以后可以直接把开平仓标记和策略的技术指标显示到界面

键盘PgUp和PgDn可以在开平仓点自由切换了

K线图形对象部分代码

########################################################################

# K线图形对象

########################################################################

class CandlestickItem(pg.GraphicsObject):

"""K线图形对象"""

# 初始化

#----------------------------------------------------------------------

def __init__(self, data):

"""初始化"""

pg.GraphicsObject.__init__(self)

# 数据格式: [ (time, open, close, low, high),...]

self.data = data

# 只重画部分图形&#

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
html5和c++开源 K线工具, Create interactive charts easily for your web projects. Used by tens of thousands of developers and 61 out of the world's 100 largest companies, Highcharts is the simplest yet most flexible charting API on the market. Read more » Download » TemperatureRainfallTokyo climateSunshine hoursJanFebMarAprMayJunJulAugSepOctNovDec5°C10°C15°C20°C25°C30°C0 mm50 mm100 mm150 mm200 mm250 mmHighcharts.com Highstock Highstock lets you create stock or general timeline charts in pure JavaScript. Including sophisticated navigation options like a small navigator series, preset date ranges, date picker, scrolling and panning. Read more » Download » ZoomUSD to EUR14. Feb21. Feb28. Feb7. Mar14. Mar21. Mar28. Mar4. Apr11. Apr18. Apr25. Apr2. May9. May20042006200820100.70.650.751m3m6mYTD1yAllHighcharts.com Highmaps Interactive map charts with drilldown and touch support. Build interactive maps to display sales, election results or any other information linked to geography. Perfect for standalone use or in dashboards in combination with Highcharts! Read more » Download » Highcharts © Natural Earth Highcharts Cloud Online charts for non-techies. Create smashing, interactive diagrams for your news site or blog, or for sharing with your friends on social media. Read more » Highcharts Cloud 1 2 3 4 Free for non-commercial Do you want to use Highcharts for a personal website, a school site or a non-profit organisation? Then you don't need our permission, just go on! HTML 5 Based on native browser technologies, no plugins needed Open Fork us on GitHub and participate in tech discussions Compatible With modern browsers including mobile, tablets and old IE back to IE6 Dynamic Add, remove and modify series and points or modify axes Any chart you'd like Highcharts supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerang
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值