The
seq_grid_agg_var()
andseq_grid_agg_dev()
functions compute the variance and standard deviation for the sample volume blocks.Following is an example script demonstrating the
seq_grid_agg_var()
andseq_grid_agg_dev()
functions:SELECT symbol, seq_search(day, 20130101, 20130331) as Q1_13, volume@Q1_13 as "Volume_Q1_13", seq_grid_agg_var(volume@Q1_13, 7) as "var_Q1_13", seq_grid_agg_dev(volume@Q1_13, 7) as "dev_Q1_13" FROM Quote WHERE symbol='SYM0'; symbol Q1_13{} Volume_Q1_13{} var_Q1_13{} dev_Q1_13{} ------------------------------------------------------------------------------ SYM0 {20130101, 20130104, 20130106, 20130110, 20130123, 20130125, 20130129, 20130213, 20130214, 20130216, 20130311, 20130326} {335, 808, 45, 402, 732, 48, 805, 450, 385, 420, 367, 69} {96397.387755, 18935.760000} {310.479287, 137.607267}Note that the variance and standard deviation values computed for the sample volume blocks can be verified using the following table (built with Microsoft Excel version 2010):
![]()
Sample script
A sample script to demonstrate this
select
statement using xSQL can be run from thesamples/xsql/scripts/financial
directory with the following command:g 7