Class RateChangeRTIndicator

All Implemented Interfaces:
ClockAware, Resettable, RTIndicator

public class RateChangeRTIndicator extends AbstractDecorableIncrementalRTIndicator
Gets the rate of change of an RTIndicator between updates
  • Field Details

    • ID

      public static final String ID
      Canonical catalog id, set as an explicit IndicatorMeta.ID override where getId() class-name derivation would be wrong.
      See Also:
  • Constructor Details

    • RateChangeRTIndicator

      public RateChangeRTIndicator(RTIndicator indicator)
  • Method Details

    • initValue

      protected double initValue(double initValue)
      Description copied from class: AbstractIncrementalRTIndicator
      Non periodic init value
      Overrides:
      initValue in class AbstractIncrementalRTIndicator
      Parameters:
      initValue -
      Returns:
    • getPrevValue

      protected double getPrevValue()
      Overrides:
      getPrevValue in class AbstractIncrementalRTIndicator
    • nextValue

      protected double nextValue(double prevValue, double newValue)
      Computes the rate of change as (newValue - prevValue) / |prevValue|. Uses the absolute value of prevValue in the denominator to handle negative base values correctly. Returns 0 when prevValue is zero to avoid division by zero.
      Overrides:
      nextValue in class AbstractDecorableIncrementalRTIndicator
      Parameters:
      prevValue - the previous raw input value
      newValue - the current raw input value
      Returns:
      the fractional rate of change