Analytic functions

Analytic functions perform complex calculation over a window of grouped events

Objective

Analytic functions are used when calculations over a event window is required. These functions are executed on each window generation trigger, windows are generated when the window policy is satisfied.

Joule is shipped with a starter pack of stateful and stateless functions to support initial use cases. The platform can be extended using the Analytics API to build custom functions.

Example

This code defines a sliding time window for calculating and emitting additional attributes.

  1. window functions

    1. ema rates Calculates the exponential moving average (EMA) for ask and bid with a smoothing factor of 0.001996007984032.

    2. ranges Calculates the min-max range for ask and bid.

    3. norms Computes the Z-score for ask and bid.

  2. policy

    1. slidingTime The window slides every 500 milliseconds.

    2. window size The window covers 2500 milliseconds (2.5 seconds).

This configuration calculates attributes like ask_EMA, bid_EMA, ask_MINMAX_NORM, bid_MINMAX_NORM, ask_ZSCORE, and bid_ZSCORE over a sliding time window.

time window:
  emitting type: slidingQuoteAnalytics
  window functions:
    ema rates:
      function:
        exponential moving average:
          parameters:
            smoothing factor: 0.001996007984032
      attributes: [ ask,bid ]

    ranges:
      function:
        minmax: {}
      attributes: [ ask,bid ]

    norms:
      function:
        zscore: {}
      attributes: [ ask,bid ]
  policy:
    type: slidingTime
    slide: 500
    window size: 2500

Available options

Last updated