请问如何将分钟级数据聚合成小时级别数据?

我有一张所有股票的分钟级数据(包含了很多只股票),我想将其聚合成小时级别或者30mins的数据,想使用contextby stock_code然后用rolling进行聚合,但是好像不行,是否有比较好的方式完成这个操作?
例如我使用的是这个语句:

mins_data = select rolling(first, code, 15,15) as Code,rolling(first, time_all, 15,15) as time , rolling(first, open, 15, 15) as Openrolling(max, high, 15,15) as High, rolling(min, low, 15, 15) as Low, rolling(last, close, 15, 15) as Closerolling(sum, volume, 15, 15) as Volume, rolling(sum, turnover, 15, 15) as Turnover from mins_data context by code;

但是会报错。具体改怎么操作呢?

请先 登录 后评论

1 个回答

Jax Wu

k线数据可以用group by code, date, bar(time,...)的方式实现,具体例子可参阅k线教程:
https://gitee.com/dolphindb/T...

请先 登录 后评论