The following collapse methods take an input sequence argument, and produce a result sequence of type double where the computed scalar result is the first element.
The two input sequences must be of the same type. If the two input sequences are of different lengths the operation will be performed on only the number of elements in the shorter of the two sequences.
The operation can be one of the following:
wsum() The first element of the result sequence is the weighted sum of the two sequences wavg() The first element of the result sequence is the weighted average of the two sequences cov() The first element of the result sequence is the covariance of the two sequences corr() The first element of the result sequence is the correlation of the two sequences var() The first element of the result sequence is the variance of the two sequences dev() The first element of the result sequence is the standard deviation of the two sequences Example
Following is an example code snippet demonstrating a collapse method:
cursor = con.cursor("Quote", "by_sym") for quote in cursor: ... correlationIterator = quote.high.corr(quote.low) ...