pfhedge.nn.functional.bs_european_gamma

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

Returns Black-Scholes gamma 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_gamma
...
>>> bs_european_gamma(torch.tensor([-0.1, 0.0, 0.1]), 1.0, 0.2)
tensor([2.0350, 1.9848, 1.5076])