pfhedge.nn.functional.bs_european_price

pfhedge.nn.functional.bs_european_price(log_moneyness, time_to_maturity, volatility, strike=1.0, call=True)[source]

Returns Black-Scholes price of a European option.

Parameters
  • log_moneyness (torch.Tensor, optional) – Log moneyness of the underlying asset.

  • time_to_maturity (torch.Tensor, optional) – Time to expiry of the option.

  • volatility (torch.Tensor, optional) – Volatility of the underlying asset.

Shape:
  • log_moneyness: \((N, *)\) where \(*\) means any number of additional dimensions.

  • time_to_maturity: \((N, *)\)

  • volatility: \((N, *)\)

  • output: \((N, *)\)

Returns

torch.Tensor

Examples

>>> from pfhedge.nn.functional import bs_european_price
...
>>> bs_european_price(torch.tensor([-0.1, 0.0, 0.1]), 1.0, 0.2)
tensor([0.0375, 0.0797, 0.1467])