# Cumulative Aggregate C Sequence Functions

> All Cumulative Aggregate C functions take a single input sequence argument and produce a result sequence which is of the same type as the input sequence or of type `double` depending on the operation performed. The value of each element is the result of the specified operation on all of the preceding elements.

> The function signatures are of the following form:

>         MCO_RET mco_seq_cum_agg_operation_TYPE(mco_seq_iterator_h result,
>                 mco_seq_iterator_h input);

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

> mco_seq_cum_agg_max_TYPE() | Returns the result sequence of the same `TYPE` with the cumulative maximum: each element is the maximum value of all the preceding elements
> mco_seq_cum_agg_min_TYPE() | Returns the result sequence of the same `TYPE` with the cumulative minimum: each element is the minimum value of all the preceding elements
> mco_seq_cum_agg_sum_TYPE() | Returns the result sequence of the same `TYPE` with the cumulative sum: each element is the sum of all the preceding elements
> mco_seq_cum_agg_prd_TYPE() | Returns the result sequence of the same `TYPE` with the cumulative product: each element is the product of all the preceding elements
> mco_seq_cum_agg_avg_TYPE() | Returns the `double` result sequence with the cumulative average: each element is the average of all the preceding elements
> mco_seq_cum_agg_var_TYPE() | Returns the `double` result sequence with the cumulative variance: each element is the variance of all the preceding elements
> mco_seq_cum_agg_var_samp_TYPE() | Returns the `double` result sequence with the cumulative sample variance: each element is the cumulative sample variance of all the preceding elements
> mco_seq_cum_agg_dev_TYPE() | Returns the `double` result sequence with the cumulative standard deviation: each element is the cumulative standard deviation of all the preceding elements
> mco_seq_cum_agg_dev_samp_TYPE() | Returns the `double` result sequence with the sample standard deviation: each element is the cumulative sample standard deviation of all the preceding elements

> ## Example

> Following is an example code snippet demonstrating a cumulative 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_window_cum_agg_max_float(&max_iterator, &close_iterator);

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