Hi All,
Sometimes exchange trading hours ahead of a small, leading to more some of the bars.
for example?
q)trade
sym time price size
IBM 09:24:57 20.30 100
IBM 09:30:00 20.31 150
q)t:select last price?sum size by sym,1 xbar time.minute from trade
q)t
sym time price size
IBM 09:25 20.30 100
IBM 09:30 20.31 150
But some bar is not what I want, I want to combine them to one or before the next bar.For example, I want to put the table t two bar merged into:
sym time price size
IBM 09:30 20.31 250
How do i do?
Thanks,
Sky
Hi Sky
Im not sure I completely understand the question, but xbar is just a function which coverts a list to a set of boundaries, and then the select statement allows you to group based on the produced values. You can perhaps derive what you want from something like this:
// create a list of times
q)t:09:25:00 + asc 10 ? 00:10:00
q)t
09:26:30 09:26:30 09:28:41 09:29:17 09:30:14 09:30:44 09:31:00 09:32:48 09:33:42 09:34:45
// standard xbar grouping
q)1 xbar t.minute
09:26 09:26 09:28 09:29 09:30 09:30 09:31 09:32 09:33 09:34
q)5 xbar t.minute
09:25 09:25 09:25 09:25 09:30 09:30 09:30 09:30 09:30 09:30
// split into non-uniform bars
q)b:09:25:00 09:31:00 09:33:30
q)b bin t
0 0 0 0 0 0 1 1 2 2
q)b b bin t
09:25:00 09:25:00 09:25:00 09:25:00 09:25:00 09:25:00 09:31:00 09:31:00 09:33:30 09:33:30
Thanks
Jonny
Rolf1
March 25, 2015, 12:48am
3
q)t:( sym:`IBM;time:09:25 09:30;price:20.30 20.31;size:100 150)
q)select last price, sum size by sym,time:1 xbar 09:30|time.minute from t
sym time
price size
IBM 09:30
20.31 250