MAIR: Moving Average with Interquartile Range Filter

The MAIR (Moving Average with Interquartile Range Clearing) filter is the application of the Moving Average filter to data that was previously cleared by the Interquartile Range filtering system.

Trade Collection

All trades from the queried time range are ordered by timestamp.

For each second in the time range, there exists a "slot" where trades are put into.

Price Calculation

As soon as all trades in the block have been finalized (usually 120 seconds per block), for each 1 second slot the closing price is taken.

These slots are then weighted against the volume for each data point and the weighted average price is taken to arrive at the final price.

The result is then returned as the result of the filter operation.

Filter Application

The MAIR filter is used in DIA's price determination. Our price quotations are the latest MAIR-120 filter values, i.e., the filter results from a 120 second interval of all recorded trades for an asset.

Implementation

The filter is implemented as part of the FiltersBlockService in this file in our Github repository.