[量化投资-学习笔记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线图就画好了。

相关推荐
Amelia1111117 分钟前
day47
python
Chris_121936 分钟前
Halcon学习笔记-Day6进阶:工业级视觉系统核心技术详解
人工智能·python·深度学习·halcon
AI视觉网奇1 小时前
audio2face mh_arkit_mapping_pose_A2F 不兼容
笔记·ue5
wdfk_prog1 小时前
[Linux]学习笔记系列 -- [fs]super
linux·笔记·学习
飞鸟真人1 小时前
关于python -m http.server的一些安全问题
python·安全·http
GHL2842710901 小时前
Temperature、Top P 学习
学习·ai
tjjucheng1 小时前
小程序定制开发哪家性价比高
python
追风的木木1 小时前
TDengine在NetCore中数据查询的使用
大数据·tdengine
No0d1es2 小时前
2025年12月 GESP CCF编程能力等级认证Python六级真题
python·青少年编程·gesp·ccf·六级