Aggregation of data in microseconds in kdb +

How can I use the xbar function to combine rows into a table in 10 microsecond bars. The table consists of columns timestampand val. For aggregation in millisecond bars, instead, I already know that I can just use timestamp.datetimexbar in the request.

A possible result table should look like this:

timestamp                 | val
--------------------------| ---
2015.12.02D12:19:44.434430| 2
2015.12.02D12:19:44.434440| 8
2015.12.02D12:19:44.434450| 5

Any help is appreciated.

+4
source share
1 answer

The following should work:

d:([]t:asc .z.P+100*10?100;v:10?10)
select avg v by (10*1000) xbar t from d

Note that the output time column is still of type "timestamp" ("p"), however values ​​are not allowed in microseconds.

xbar (10 * 1000) . 5 , (5 * 1000) ..

+3

Source: https://habr.com/ru/post/1618346/


All Articles