Aggregate Functions

Standard statistics across streaming event windows


Joule provides a set of standard aggregate functions that can be applied to a set of events within a triggered window. These are processed using the groupby definition provided with the use case.

Example

processing unit:
  pipeline:
    - time window:
        emitting type: tumblingAggregatesAnalytics
        aggregate functions:
          FIRST: [ask,bid]
          LAST: [ ask,bid ]
          MIN: [ ask,bid ]
          MAX: [ ask,bid ]
          SUM: [ volume ]
          MEAN: [ volatility ]
          VARIANCE: [ volatility ]
          STDEV: [ volatility ]
        policy:
          type: tumblingTime
          window size: 5000

This will produce the calculated aggregate attributes within the emitting event e.g.

  • ask_FIRST and bid_FIRST

  • ask_LAST and bid_LAST

  • volatility_MEAN

  • etc;.


Available functions

When the function applied the field the result is added in the returned stream events as an additional field e.g <field_name>_SUM

TypeDescription

SUM

Sum of field values

MIN

Min of field value

MAX

Max of field value

MEAN

Mean of field value

VARIANCE

Variance of field value

STDEV

Standard deviation of field value

FIRST

First field value in window

LAST

Last field value in window

HARMONIC_MEAN

Harmonic mean of field value

GEOMETRIC_MEAN

Geometric mean of field value

PVARIANCE

Population variance of field value

SECOND_MOMENT

Seond moment of field value

SUM_SQRTS

Sum of square root of field value

SUM_LOGS

Sum of log of field value

Last updated