# Grid Aggregate C++ Sequence Methods

> All Grid Aggregate C++ Sequence methods take an integer interval argument and produce a result sequence containing the calculated aggregate for each interval.

> Sequence<T> gridAggMax(mco_size_t interval) const | Returns the result sequence of the same `TYPE` with the maximum value for each interval of elements
> Sequence<T> gridAggMin(mco_size_t interval) const | Returns the result sequence of the same `TYPE` with the minimum value for each interval of elements
> Sequence<R> gridAggSum(mco_size_t interval) const | Returns the result sequence of the same `TYPE` with the sum of each interval of elements
> Sequence<double> gridAggAvg(mco_size_t interval) const | Returns the `double` result sequence with the average of each interval of elements
> Sequence<double> gridAggVar(mco_size_t interval) const | Returns the `double` result sequence with the variance of each interval of elements
> Sequence<double> gridAggVarSamp(mco_size_t interval) const | Returns the `double` result sequence with the sample variance of each interval of elements
> Sequence<double> gridAggDev(mco_size_t interval) const | Returns the `double` result sequence with the standard deviation of each interval of elements
> Sequence<double> gridAggDevSamp(mco_size_t interval) const | Returns the `double` result sequence with the sample standard deviation of each interval of elements

> ## Example

> Following is an example code snippet demonstrating a grid aggregate method:

>         {
>             mco_trans_h trans;
>             mco_cursor_t quote_cursor;
>             Quote quote;
>             MCO_RET rc;
>             ...
>             rc = mco_trans_start(db, MCO_READ_ONLY, MCO_TRANS_FOREGROUND, &trans);
>             if ( MCO_S_OK == rc )
>             {

>                 for (rc = mco_cursor_first(trans, &quote_cursor);
>                     rc != MCO_S_CURSOR_END;
>                     rc = mco_cursor_next(trans, &quote_cursor))
>                 {
>                     quote.from.cursor(trans, &quote_cursor);

>                     // Calculate the maximmum close price for each week
>                     print_sequence(quote, quote.close_iterator().gridAggMax(7));
>                 }
>                 mco_trans_rollback(trans);
>             }
>         }