iso_volΒΆ

Defined in fynance.features.money_management

iso_vol(series, target_vol=0.20, leverage=1., period=252, half_life=11)[source]

Make an iso-vol vector to apply to signal vector.

Parameters:
seriesnp.ndarray[ndim=1, dtype=np.float64]

Series of price of underlying.

target_volfloat (default 20 %)

Volatility to target.

leveragefloat (default 1)

Max leverage to use.

periodint (default 250)

Number of period per year.

half_lifeint (default 11)

Half-life of exponential moving average used to compute volatility.

Returns:
ivnp.ndarray[ndim=1, dtype=np.float64]

Series of iso-vol coefficient.

Examples

>>> series = np.array([95, 100, 85, 105, 110, 90]).astype(np.float64)
>>> iso_vol(series, target_vol=0.5, leverage=2, period=12, half_life=3)
array([1.        , 1.        , 2.        , 1.28407693, 0.78278978,
       1.07186485])