Moneyness¶
- class pfhedge.features.Moneyness(log=False)[source]¶
Moneyness of the derivative.
Moneyness reads \(S / K\) where \(S\) is the spot price of the underlying instrument and \(K\) is the strike of the derivative.
- Name:
'moneyness'
Examples
>>> from pfhedge.features import Moneyness >>> from pfhedge.instruments import BrownianStock >>> from pfhedge.instruments import EuropeanOption ... >>> _ = torch.manual_seed(42) >>> derivative = EuropeanOption(BrownianStock(), maturity=5/250, strike=2.0) >>> derivative.simulate() >>> derivative.underlier.spot tensor([[1.0000, 1.0016, 1.0044, 1.0073, 0.9930, 0.9906]]) >>> f = Moneyness().of(derivative) >>> f.get() tensor([[[0.5000], [0.5008], [0.5022], [0.5036], [0.4965], [0.4953]]])