Volume Base OHLC

Forgive me very new to this, but here is my question

Given my trade table 

date  | 2013.12.02

time  | 12:00:09.159

sym   | `MSFT

price | 38.2

volume| 300i

I can build an ohlc bar that is time sensitive like so 

q)select open:first price,high:max price,low:min price,close:last price,volume:sum volume by 60 xbar time.minute from trades where time> 14:00

minute| open   high    low     close   volume

------| --------------------------------------

14:00 | 38.15  38.49   38.04   38.37   5849796

15:00 | 38.37  38.49   38.15   38.37   8491338

16:00 | 38.37  38.54   38.3498 38.533  4526692

17:00 | 38.535 38.78   38.4984 38.515  5384621

18:00 | 38.51  38.6925 38.44   38.4944 3233415

19:00 | 38.495 38.535  38.44   38.508  3591717

20:00 | 38.505 38.51   38.3401 38.455  8158938

21:00 | 38.46  38.659  38.28   38.34   6853541

22:00 | 38.34  38.45   38.34   38.39   19570

23:00 | 38.39  38.4    38.36   38.4    2580

My question is how would i build some sort of OHLC query that would take into account the grouping off of the sum of the volume? Allowing me to build bars that are based off of volume.

Thanks in advance!

by 1000000 xbar sums volume

Cheers,

  Attila

Something like this?<o:p></o:p>

<o:p> </o:p>

N:25<o:p></o:p>

(::)t:`time xasc (time:N?.z.t;prx:0.01*floor 100*10 + N?1.0;qty:N?500)<o:p></o:p>

select last time, o:first prx,h:max prx,l:min prx,c:last prx,qty by 1000 xbar sums qty from t<o:p></o:p>

<o:p> </o:p>

Kim<o:p></o:p>

<o:p> </o:p>

Von: personal-kdbplus@googlegroups.com [mailto:personal-kdbplus@googlegroups.com] Im Auftrag von Carson Wilkins
Gesendet: Freitag, 11. April 2014 22:44
An: personal-kdbplus@googlegroups.com
Betreff: [personal kdb+] Volume Base OHLC<o:p></o:p>

<o:p> </o:p>

Forgive me very new to this, but here is my question<o:p></o:p>

<o:p> </o:p>

Given my trade table <o:p></o:p>

<o:p> </o:p>

date  | 2013.12.02<o:p></o:p>

time  | 12:00:09.159<o:p></o:p>

sym   | `MSFT<o:p></o:p>

price | 38.2<o:p></o:p>

volume| 300i<o:p></o:p>

<o:p> </o:p>

I can build an ohlc bar that is time sensitive like so <o:p></o:p>

<o:p> </o:p>

q)select open:first price,high:max price,low:min price,close:last price,volume:sum volume by 60 xbar time.minute from trades where time> 14:00<o:p></o:p>

minute| open   high    low     close   volume<o:p></o:p>

------| --------------------------------------<o:p></o:p>

14:00 | 38.15  38.49   38.04   38.37   5849796<o:p></o:p>

15:00 | 38.37  38.49   38.15   38.37   8491338<o:p></o:p>

16:00 | 38.37  38.54   38.3498 38.533  4526692<o:p></o:p>

17:00 | 38.535 38.78   38.4984 38.515  5384621<o:p></o:p>

18:00 | 38.51  38.6925 38.44   38.4944 3233415<o:p></o:p>

19:00 | 38.495 38.535  38.44   38.508  3591717<o:p></o:p>

20:00 | 38.505 38.51   38.3401 38.455  8158938<o:p></o:p>

21:00 | 38.46  38.659  38.28   38.34   6853541<o:p></o:p>

22:00 | 38.34  38.45   38.34   38.39   19570<o:p></o:p>

23:00 | 38.39  38.4    38.36   38.4    2580<o:p></o:p>

<o:p> </o:p>

My question is how would i build some sort of OHLC query that would take into account the grouping off of the sum of the volume? Allowing me to build bars that are based off of volume.<o:p></o:p>

<o:p> </o:p>

Thanks in advance!<o:p></o:p>


Submitted via Google Groups

Thank you this works to get me started in the direction that i need to go.!