deephaven.experimental.ema

This modules allows users to define exponential moving averages that can be used in the Deephaven query language.

ByEmaSimple(nullBehavior, nanBehavior, mode, timeScale, timeUnit, type=None)[source]

Constructor for an engine aware Exponential Moving Average (EMA) which performs a groupBy ema calculation without the added inefficiency of explicitly performing the grouping and then ungrouping operations.

Parameters:
  • nullBehavior – enum value ‘BD_RESET’, ‘BD_SKIP’, ‘BD_PROCESS’ which determines calculation behavior upon encountering a null value.

  • nanBehavior – enum value ‘BD_RESET’, ‘BD_SKIP’, ‘BD_PROCESS’ which determines calculation behavior upon encountering a null value.

  • mode – enum value ‘TICK’, ‘TIME’ specifying whether to calculate the ema with respect to record count or elapsed time.

  • timeScale – the ema decay constant.

  • timeUnit – None (assumed Nanoseconds), or one of the java.util.concurrent.TimeUnit enum values - like ‘MILLISECONDS’, ‘SECONDS’, ‘MINUTES’, ‘HOURS’, …

  • type – None or enum value ‘LEVEL’, ‘DIFFERENCE’.

Returns:

io.deephaven.numerics.movingaverages.ByEmaSimple instance.

Ema(type, mode, timeScale)[source]

Constructor for a Exponential Moving Average (EMA) calculation object.

Parameters:
  • type – None or enum value ‘LEVEL’, ‘DIFFERENCE’.

  • mode – enum value ‘TICK’, ‘TIME’ specifying whether to calculate the ema with respect to record count or elapsed time.

  • timeScale – the ema decay constant (wrt nanosecond timestamp).

Returns:

io.deephaven.numerics.movingaverages.Ema instance.

EmaArray(type, mode, timeScales)[source]

Constructor for object managing an array of Exponential Moving Average (EMA) objects.

Parameters:
  • type – enum value ‘LEVEL’, ‘DIFFERENCE’.

  • mode – enum value ‘TICK’, ‘TIME’ specifying whether to calculate the ema with respect to record count or elapsed time.

  • timeScales – the ema decay constants (wrt nanosecond timestamp) - list, tuple, numpy.ndarray, or java double array.

Returns:

io.deephaven.numerics.movingaverages.EmaArray instance.

ExponentiallyDecayedSum(decayRate, enableTimestepOutOfOrderException=True)[source]

Constructor for an object to calculate a sum where the values are decayed at an exponential rate to zero.

Parameters:
  • decayRate – (double) rate in milliseconds to decay the sum.

  • enableTimestepOutOfOrderException – (boolean) true to allow an exception to be thrown when timesteps are not sequential.

Returns:

io.deephaven.numerics.movingaverages.ExponentiallyDecayedSum instance.