当前位置:首页 > 编程笔记 > 正文
已解决

[量化投资-学习笔记003]Python+TDengine从零开始搭建量化分析平台-Grafana画K线图

来自网友在路上 151851提问 提问时间:2023-10-28 21:04:43阅读次数: 51

最佳答案 问答题库518位专家为你答疑解惑

在前面两个笔记:
Python+TDengine从零开始搭建量化分析平台-数据存储
Python+TDengine从零开始搭建量化分析平台-MA均线的多种实现方式

中有提到使用 Grafana 画图,不过画的都是均线。除了均线,Grafana 非常人性的提供了 K线图模块 搭配 TDengine 配置简单一键生成。

1.新建一个Panel,选择 Candlestick

在这里插入图片描述

2.数据源选择 TDengine,填入数据

最高价

select _wstart,max(high) as high from trade_data_a.tdata where fcode="000001"  and  tdate>=$from and tdate<=$to interval(1d)

最低价

select _wstart,min(low) as low from trade_data_a.tdata where fcode="000001"  and  tdate>=$from and tdate<=$to interval(1d)

收盘价

select _wstart,last(close) as close from trade_data_a.tdata where fcode="000001"  and  tdate>=$from and tdate<=$to interval(1d)

Grafana 会使用上一日收盘价作为当日开盘价。

3.点击 Apply

K线图就画好了。

在这里插入图片描述

查看全文

99%的人还看了

猜你感兴趣

版权申明

本文"[量化投资-学习笔记003]Python+TDengine从零开始搭建量化分析平台-Grafana画K线图":http://eshow365.cn/6-27092-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!