DolphinDB中如何将输出时间点替换为window的结束点?
How to replace the output timepoint with the ending point of a window in DolphinDB?
我在 DolphinDB 中使用子句 group by interval(pricetime, 5m, 'none', ,false)
进行聚合计算。输出 table 使用每个 window 的起点作为价格时间。我如何修改代码以将其替换为每个 window?
的终点
您可以尝试 DolphinDB 函数 temporalAdd
将 window 持续时间添加到输出价格时间。看例子:
t = table(13:01:00 13:02:00 13:03:00 13:04:00 13:04:59 13:05:00 13:07:00 13:09:00 13:09:59 13:10:00 as pricetime, rand(100, 10) as value)
res = select max(value) from t group by interval(pricetime, 5m, "none") as pricetime
update res set pricetime = temporalAdd(pricetime, 5m)
我在 DolphinDB 中使用子句 group by interval(pricetime, 5m, 'none', ,false)
进行聚合计算。输出 table 使用每个 window 的起点作为价格时间。我如何修改代码以将其替换为每个 window?
您可以尝试 DolphinDB 函数 temporalAdd
将 window 持续时间添加到输出价格时间。看例子:
t = table(13:01:00 13:02:00 13:03:00 13:04:00 13:04:59 13:05:00 13:07:00 13:09:00 13:09:59 13:10:00 as pricetime, rand(100, 10) as value)
res = select max(value) from t group by interval(pricetime, 5m, "none") as pricetime
update res set pricetime = temporalAdd(pricetime, 5m)