我有一张表,上面有价格和数量信息。对于每个股票和每个时间戳,我只想用price>current价格计算最后60行中的那些行的总成交量。它类似于带有条件过滤器的dolphindb中的msum函数。我尝试在dolphindb中使用moving模板函数,但仍然无法找到解决方案。有没有办法在dolphindb这样做?
发布于 2021-04-23 20:01:00
这个例子应该会有所帮助。它使用了dolphindb中的高阶函数moving。它没有像msum这样的移动窗口函数那样快,但可以完成这项工作。
t=table(09:30:00 + (0..59)*60 as time, (1..20) join (20..1) join (1..20) as x, rand(10.0, 60) as y)
f = def(x,y){return sum(y[x>x.tail()])}
select time, x, y, moving(f, [x, y], 10) from thttps://stackoverflow.com/questions/67226041
复制相似问题