pfhedge.nn.functional

Payoff Functions

european_payoff

Returns the payoff of a European option.

lookback_payoff

Returns the payoff of a lookback option with a fixed strike.

american_binary_payoff

Returns the payoff of an American binary option.

european_binary_payoff

Returns the payoff of a European binary option.

european_forward_start_payoff

Returns the payoff of a European forward start option.

Nonlinear activation functions

leaky_clamp

Leakily clamp all elements in input into the range \([\min, \max]\).

clamp

Clamp all elements in input into the range \([\min, \max]\).

Criterion Functions

exp_utility

Applies an exponential utility function.

isoelastic_utility

Applies an isoelastic utility function.

entropic_risk_measure

Returns the entropic risk measure.

expected_shortfall

Returns the expected shortfall of the given input tensor.

value_at_risk

Returns the value at risk of the given input tensor.

quadratic_cvar

Returns the Quadratic CVaR of the given input tensor.

Black-Scholes formulas

European option

bs_european_price

Returns Black-Scholes price of a European option.

bs_european_delta

Returns Black-Scholes delta of a European option.

bs_european_gamma

Returns Black-Scholes gamma of a European option.

bs_european_vega

Returns Black-Scholes vega of a European option.

bs_european_theta

Returns Black-Scholes theta of a European option.

American binary option

bs_american_binary_price

Returns Black-Scholes price of an American binary option.

bs_american_binary_delta

Returns Black-Scholes delta of an American binary option.

bs_american_binary_gamma

Returns Black-Scholes gamma of an American binary option.

bs_american_binary_vega

Returns Black-Scholes vega of an American binary option.

bs_american_binary_theta

Returns Black-Scholes theta of an American binary option.

European binary option

bs_european_binary_price

Returns Black-Scholes price of a European binary option.

bs_european_binary_delta

Returns Black-Scholes delta of a European binary option.

bs_european_binary_gamma

Returns Black-Scholes gamma of a European binary option.

bs_european_binary_vega

Returns Black-Scholes vega of a European binary option.

bs_european_binary_theta

Returns Black-Scholes theta of a European binary option.

Lookback option

bs_lookback_price

Returns Black-Scholes price of a lookback option.

bs_lookback_delta

Returns Black-Scholes delta of a lookback option.

bs_lookback_gamma

Returns Black-Scholes gamma of a lookback option.

bs_lookback_vega

Returns Black-Scholes vega of a lookback option.

bs_lookback_theta

Returns Black-Scholes theta of a lookback option.

Other Functions

bilerp

Does a bilinear interpolation of four tensors based on a scalar or tensor weights and returns the resulting tensor.

box_muller

Returns two tensors obtained by applying Box-Muller transformation to two input tensors.

d1

Returns \(d_1\) in the Black-Scholes formula.

d2

Returns \(d_2\) in the Black-Scholes formula.

ncdf

Returns a new tensor with the normal cumulative distribution function.

npdf

Returns a new tensor with the normal distribution function.

pl

Returns the final profit and loss of hedging.

realized_variance

Returns the realized variance of the price.

realized_volatility

Returns the realized volatility of the price.

svi_variance

Returns variance in the SVI model.

terminal_value

Alias for pfhedge.nn.functional.pl().

topp

Returns the largest \(p * N\) elements of the given input tensor, where \(N\) stands for the total number of elements in the input tensor.