thresholdΒΆ
Defined in fynance.signal
- threshold(pred, long=0.0, short=0.0)[source]
Position with a flat dead-band.
+1wherepred > long,-1wherepred < short,0between.Examples
>>> import numpy as np >>> threshold(np.array([0.5, 0.05, -0.5]), long=0.1, short=-0.1) array([ 1., 0., -1.])