【问题标题】:How to replace the output timepoint with the ending point of a window in DolphinDB?如何将输出时间点替换为 DolphinDB 中窗口的结束点?
【发布时间】:2022-01-18 11:49:54
【问题描述】:

我使用子句group by interval(pricetime, 5m, 'none', ,false) 在 DolphinDB 中进行聚合计算。输出表使用每个窗口的起点作为价格时间。如何修改代码以将其替换为每个窗口的结束点?

【问题讨论】:

    标签: group-by dolphindb


    【解决方案1】:

    您可以尝试使用 DolphinDB 函数 temporalAdd 将窗口持续时间添加到输出价格时间。看例子:

    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)
    

    【讨论】:

      猜你喜欢
      • 2021-07-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-20
      相关资源
      最近更新 更多