Ones

class pfhedge.features.Ones[source]

A feature filled with the scalar value 1.

Name:

'ones'

Examples

>>> from pfhedge.features import Ones
>>> from pfhedge.instruments import BrownianStock
>>> from pfhedge.instruments import EuropeanOption
...
>>> derivative = EuropeanOption(BrownianStock(), maturity=5/250, strike=2.0)
>>> derivative.simulate()
>>> f = Ones().of(derivative)
>>> f.get()
tensor([[[1.],
         [1.],
         [1.],
         [1.],
         [1.],
         [1.]]])