Ahh yea my mistake
So would have some table of prices
t:
time xasc (time:20?.z.T;sym:20?enlist a;price:20?100)
time symprice
01:03:02.668a38
01:09:50.253a88
01:30:50.872a90
01:32:21.596a97
01:33:14.916a54
…
And then what I would like is to have some x duration bars every y period, so for example 30sec bars every 5sec period
If I use xbar then bars are rounded to 30s
©¬ secondtimesymprice
01:03: 00 01:03:02.668a38
01:09: 30 01:09:50.253a88
01:30: 30 01:30:50.872a90
01:32: 00 01:32:21.596a97
would like to have something like
©¬ secondtimesymprice
01:03: 05 03:02.668a38
01:03: 10 01:09:50.253a88
01:03: 15 01:30:50.872a90
01:03: 20 01:32:21.596a97
with each bar as the last 30sec of data. I would like to pass in start and end time and have the bars reversed from the end time, so pass in say 01:04:00 and then get back 30sec bars at 01:03:55, 01:03:50, 01:03:45… I’ve got it to work by getting a time seq from end time down to start time, and then iterating each of those, doing a select, and then using aj but there must be a better way
getRollingBars:{[startTime;endTime;duration;period] //get raw data t:select from trade where ... //gen time seq timeseq:{y-z*til 1+
long$(y-x)%z}[startTime;endTime;period] //iterate seq and select last values and time at each interval t1:raze { } each timeseq; //use aj to get values at last interval time}`
hope that makes sense, thanks!