deadbandΒΆ

Defined in fynance.signal

deadband(pred, band=0.1)[source]

Hold the previous position unless the target moves by more than band.

A sticky dead-band: out[t] = pred[t] only when |pred[t] - out[t-1]| > band, else out[t] = out[t-1]. Magnitude is preserved (unlike threshold), but small oscillations are ignored, so the position changes only on meaningful moves. Anti-churn.

Parameters:
predarray-like, shape (T,)

Raw position / prediction series.

bandfloat

Minimum change required to update the held position (>= 0).

Examples

>>> import numpy as np
>>> deadband(np.array([0.0, 0.05, 0.5, 0.55, -0.4]), band=0.2)
array([ 0. ,  0. ,  0.5,  0.5, -0.4])