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) constReturns the result sequence of the sameTYPEwith the maximum value for each interval of elements.Sequence<T> gridAggMin(mco_size_t interval) constReturns the result sequence of the sameTYPEwith the minimum value for each interval of elements.Sequence<R> gridAggSum(mco_size_t interval) constReturns the result sequence of the sameTYPEwith the sum of each interval of elements.Sequence<double> gridAggAvg(mco_size_t interval) constReturns thedoubleresult sequence with the average of each interval of elements.Sequence<double> gridAggVar(mco_size_t interval) constReturns thedoubleresult sequence with the variance of each interval of elements.Sequence<double> gridAggVarSamp(mco_size_t interval) constReturns thedoubleresult sequence with the sample variance of each interval of elements.Sequence<double> gridAggDev(mco_size_t interval) constReturns thedoubleresult sequence with the standard deviation of each interval of elements.Sequence<double> gridAggDevSamp(mco_size_t interval) constReturns thedoubleresult 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, "e_cursor); rc != MCO_S_CURSOR_END; rc = mco_cursor_next(trans, "e_cursor)) { quote.from_cursor(trans, "e_cursor); // Calculate the maximum close price for each week print_sequence(quote, quote.close_iterator().gridAggMax(7)); } mco_trans_rollback(trans); } }