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

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

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

1.新建一个Panel,选择 Candlestick

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

最高价

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

最低价

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

收盘价

sql 复制代码
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线图就画好了。

相关推荐
萌新小白YXY19 小时前
SAE J1587/SAE J1708 协议笔记
笔记·单片机·嵌入式硬件
鬼手点金19 小时前
Scrapy + Playwright 完整示例(JS 动态渲染网页)
开发语言·javascript·爬虫·python·scrapy·html·json
IT古董19 小时前
【MES学习笔记系列】MES 推荐书籍与资源
笔记·学习
迪丽热爱19 小时前
每日英语-11
学习
vx-程序开发20 小时前
springboot旅游推介平台---附源码24175
java·spring boot·python·spring cloud·eclipse·django·idea
心运软件20 小时前
基于深度学习的宝石图像分类系统
人工智能·python·深度学习·机器学习·分类·数据挖掘
一米阳光866120 小时前
软考(中级)软件设计师核心笔记(9)算法——时间复杂度与空间复杂度、查找算法、排序算法
笔记·算法·职场发展·软考·软件设计师·中级职称
米饭不加菜20 小时前
常用基本求导公式与法则(超详细推导版——上)
经验分享·笔记
一木 之林20 小时前
AI实战 : Numpy图像处理与深度学习框架
python
c_lb728820 小时前
零基础选策略工具,先分清三件事
人工智能·python