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

相关推荐
ThreeS2 小时前
手搓MiniVLA全实战教程-一步一步用pytorch解释原理与思路
人工智能·python
金銀銅鐵3 小时前
[Python] 模 n 乘法的逆元计算器
python·数学·游戏
aqi004 小时前
15天学会AI应用开发(十)把文本嵌入模型换成国产模型
人工智能·python·ai编程
金銀銅鐵21 小时前
[Python] 扩展欧几里得算法
python·数学·算法
Duckdblab21 小时前
DuckDB 性能调优终极指南:打造闪电般的分析体验
python
带派擂总21 小时前
Python全栈开发精华版最全合集(包含各种面试题) Day24_异常和错误
python
金銀銅鐵1 天前
n^5 和 n 的个位数是否总相等?
python·数学
aqi001 天前
15天学会AI应用开发(九)利用Chroma持久化向量数据
人工智能·python·大模型·ai编程·ai应用