HI, I would like to get the moving average across close price for number of dates , I try to do
select mavg[2;close] from eod where date>xxxx,sym=yyyy
But it doesn’t work as expected, look like the passing single element to the moving average. In order to make it working, I need to do this
mavg[2;exec close from eod where date>xxxx,sym=yyyy]
Just wonder, how can I run the mavg inside the select?
Hi,
Is the eod table partitioned by date?
Assuming this then you will have to run a select on the data first and then apply the mavg in the exec:
exec 2 mavg close from select close from eod where date>xxxx,sym=yyy
From: personal-kdbplus@googlegroups.com <personal-kdbplus@googlegroups.com> on behalf of Carfield Yim <carfield@gmail.com>
Sent: 18 June 2016 14:46
To: Kdb+ Personal Developers
Subject: [personal kdb+] Question about running mavg in a table
HI, I would like to get the moving average across close price for number of dates , I try to do
select mavg[2;close] from eod where date>xxxx,sym=yyyy
But it doesn’t work as expected, look like the passing single element to the moving average. In order to make it working, I need to do this
mavg[2;exec close from eod where date>xxxx,sym=yyyy]
Just wonder, how can I run the mavg inside the select?
–
Submitted via Google Groups
Thanks Andrew, yes, it is, I see, so I can do
select mavg[2;close] from select close from eod where date>xxxx,sym=yyyy