# Grid Aggregate C Sequence Functions

> All Grid Aggregate C functions take an input sequence iterator argument and an interval argument of type `uint8`. The result of all Grid Aggregate functions is returned in the result sequence as the calculated aggregate for each interval. The interval argument determines the maximum number of elements in the group, though there may be fewer. So the input sequence will be divided into blocks of interval elements on which the operation is performed.

> The function signatures are of the following form:

>         MCO_RET mco_seq_grid_agg_operation_TYPE(mco_seq_iterator_h result,
>                 mco_seq_iterator_h input,
>                 mco_size_t interval);

> where TYPE is one of the types listed in the Analytics Functions page and operation is one of the following:

> mco_seq_grid_agg_max_TYPE() | Returns the result sequence of the same `TYPE` with the maximum value for each interval of elements
> mco_seq_grid_agg_min_TYPE() | Returns the result sequence of the same `TYPE` with the minimum value for each interval of elements
> mco_seq_grid_agg_sum_TYPE() | Returns the result sequence of the same `TYPE` with the sum of each interval of elements
> mco_seq_grid_agg_avg_TYPE() | Returns the `double` result sequence with the average of each interval of elements
> mco_seq_grid_agg_var_TYPE() | Returns the `double` result sequence with the variance of each interval of elements
> mco_seq_grid_agg_var_samp_TYPE() | Returns the `double` result sequence with the sample variance of each interval of elements
> mco_seq_grid_agg_dev_TYPE() | Returns the `double` result sequence with the standard deviation of each interval of elements
> mco_seq_grid_agg_dev_samp_TYPE() | 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 function:

>         {
>             mco_trans_h trans;
>             mco_cursor_t quote_cursor;
>             Quote quote;
>             mco_seq_iterator_t close_iterator, max_iterator;
>             MCO_RET 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, &quote);
>                 Quote_close_iterator(&quote, &close_iterator);

>                 mco_seq_grid_agg_max_float(&max_iterator, &close_iterator, 7);

>                 ...
>             }
>             ...
>         }