I would like get accumulating weighted-average prices by sym from a table, meaning taking account of not just the previous record but all previous records.
Input
q)show t:([]sym:`a`a`a`b`b;size:(2;6;2;7;5);price:(2;10;3;4;9))
sym size price
--------------
a   2    2
a   6    10
a   2    3
b   7    4
b   5    9

Desired Output:
q)show t:([]sym:`a`a`b`b;size:(2;6;7;5);price:(2;10;4;9);avgPrice:(2;8;4;6.083))
sym size price avgPrice
-----------------------
a   2    2     2
a   6    10    8
a   2    3     7
b   7    4     4
b   5    9     6.083
so for the second row: (2*2+10*6)/(2+6)=8
so for the third row: (2*2+10*6+2*3)/(2+6+2)=7
so for the forth row: (7*4+5*9)/(7+5)=6.083

Any help would be appreciated.
Thanks in advance.

How can I get accumulating weighted-average prices in KDB+ by symbol from a table, taking into account all previous records?
update avgPrice:(sums price*size)%sums size by sym from t
sym size price avgPrice
-----------------------
a   2    2     2
a   6    10    8
a   2    3     7
b   7    4     4
b   5    9     6.083333

