SQL Sequence Grid Aggregate Max and Min Functions

The seq_grid_agg_max() and seq_grid_agg_min() functions return sequences with two 7-element blocks whose elements correspond with the values in the Sample Volume Blocks.

Following is an example script demonstrating the seq_grid_agg_max() and seq_grid_agg_min() functions:

 
    SELECT symbol, seq_search(day, 20130101, 20130331) as Q1_13,
        volume@Q1_13 as "Volume_Q1_13",
        seq_grid_agg_max(volume@Q1_13, 7) as "max_Q1_13",
        seq_grid_agg_min(volume@Q1_13, 7) as "min_Q1_13"
    FROM Quote WHERE symbol='SYM0';
     
    symbol
    Q1_13{}
    Volume_Q1_13{}
    max_Q1_13{}
    min_Q1_13{}
    ------------------------------------------------------------------------------
    SYM0
    {20130101, 20130104, 20130106, 20130110, 20130123, 20130125, 20130129,
    0130213, 20130214, 20130216, 20130311, 20130326}
    {335, 808, 45, 402, 732, 48, 805,
    450, 385, 420, 367, 69}
    {808, 450}
    {45, 69}
     

Sample script

A sample script to demonstrate this select statement using xSQL can be run from the samples/xsql/scripts/financial directory with the following command:

     
    g 7