Skip to content
All library documents

Robust Volume Scaling with Median-Based Outlier Caps

Article Quant Q&A · Author: Gracie williams

Summary

The document considers how to scale minute-by-minute trading volumes into a bounded range when an unusually large observation distorts ordinary normalization. It proposes a dynamic cap based on twice the sample median, then clips values above that limit before scaling the adjusted series to a maximum of ten. The example shows that a volume spike is capped while smaller observations retain relative differences below the cap.

The suggested median is intended to be less sensitive to extreme values than the mean or standard deviation. The response presents this as one possible modeling choice, not a universal rule. The choice of multiplier and the normalization window can affect how volumes are compressed, and the example does not evaluate predictive value, execution impact, or behavior across other volume distributions.

Key ideas

  • An extreme volume observation can dominate normalization based on the observed maximum.
  • A robust upper limit can be estimated from the median of the volume observations.
  • Values above the selected limit can be clipped before scaling the series to a bounded range.
  • The median is less influenced by an extreme observation than the mean or standard deviation.
  • The cap and observation window are modeling choices that should suit the intended use.

Tags

Full text
# Normalization of volume


# Normalization of volume












suppose we have volumes every minute like below

```
100, 200 , 19,  0 , 200 , 12 , 100
```

I want to convert all these numbers to less than 10 , where 10 is max and 1 is min.

I can do this with normalisation but problem occurs when there is some sudden high volume comes like below

```
100, 200 , 19,  0 , 200 , 12 , 20000
```

where when I use normalization for past past 100 volumes, , this 20000 is affecting all other volumes.

Is there something I can do by taking averages of volumes and do normalisation for that or something ?

## Answer by Attack68 (score 1, accepted)

https://quant.stackexchange.com/a/50152

Since it is your model you can do anything. What I would do is use some dynamic outlier exclusion. For example in this case you know the min is zero.

One method (of many) might be to evaluate the median (since it might be more robust that the standard deviation or mean) and use 2 x median as your upper limit:

```
>>> arr = np.array([100,200,19,0,200,12,20000])
>>> upper_lim = np.median(arr) * 2
>>> arr_adj = np.where(arr>upper_lim, upper_lim, arr) / upper_lim
>>> arr_adj *= 10
>>> arr_adj
array([5, 10, 0.95, 0, 10, 0.6, 10])
```

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.