TimeToMaturity

class pfhedge.features.TimeToMaturity[source]

Remaining time to the maturity of the derivative.

Name:

'time_to_maturity'

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()
>>> f = TimeToMaturity().of(derivative)
>>> f.get()
tensor([[[0.0200],
         [0.0160],
         [0.0120],
         [0.0080],
         [0.0040],
         [0.0000]]])