Class AggregateFilter

java.lang.Object
com.motivewave.platform.sdk.common.AggregateFilter
All Implemented Interfaces:
TickOperation, Cloneable

public class AggregateFilter extends Object implements TickOperation, Cloneable
Aggregates ticks and filters by volume of the aggregated ticks. Aug 7, 2020 Adjusted this filter to account for ticks that include the exchange order id. if this id is available (currently Rithmic live data only) it will be used to aggregate (ignoring the agg period). NB: If the exchange order id is available it may cause the same tick to be emitted multiple times with an updated size.
  • Field Details

    • op

      protected TickOperation op
    • aggPeriod

      protected long aggPeriod
    • aggregate

      protected boolean aggregate
    • checkMax

      protected boolean checkMax
    • minSize

      protected float minSize
    • maxSize

      protected float maxSize
    • filterOp

      protected TickOperation filterOp
    • aggTick

      protected Tick aggTick
    • tickStart

      protected long tickStart
  • Constructor Details

    • AggregateFilter

      public AggregateFilter(boolean aggByOrder, long aggPeriod, float minSize, float maxSize, TickOperation op)
      Constructor. Creates an Aggregate Filter with the given criteria and tick operation.
      Parameters:
      aggByOrder - If true, ticks will be aggregated using the aggressor order id (if available)
      aggPeriod - period in milliseconds to allow the aggregation of ticks (0 for no aggregation)
      minSize - minimum trade size for applying the tick operation (0 for no min size)
      maxSize - maximum trade size for applying the tick operation (0 for no max size)
      op - operation to perform for ticks that meet the min/max size requirement
  • Method Details

    • onTick

      public void onTick(Tick tick)
      Description copied from interface: TickOperation
      Executes the operation on the given tick
      Specified by:
      onTick in interface TickOperation
      Parameters:
      tick - tick to process
    • setOperation

      public void setOperation(TickOperation op)
      Sets the operation to execute on each aggregated/filtered tick.
      Parameters:
      op - operation to execute
    • reset

      public void reset()
      Resets the internal state for aggregating ticks.
    • clone

      public AggregateFilter clone()
      Overrides:
      clone in class Object
    • setCancelled

      public void setCancelled(boolean b)
    • isCancelled

      public boolean isCancelled()