Skip to content

Risk Neutral Pricing API

Risk-neutral valuation for derivatives pricing.

risk_neutral_valuation(payoff_function, underlying_price, risk_free_rate, volatility, time_to_expiry, steps=100, simulations=1000, dividend_yield=0.0, seed=None)

Price a derivative using risk-neutral valuation with optimized NumPy vectorization.

Parameters:

Name Type Description Default
payoff_function callable

Function that takes the final underlying price and returns the payoff

required
underlying_price float

Current price of the underlying asset

required
risk_free_rate float

Risk-free interest rate (annualized)

required
volatility float

Volatility of the underlying asset (annualized)

required
time_to_expiry float

Time to expiration in years

required
steps int

Number of time steps in the simulation, by default 100

100
simulations int

Number of Monte Carlo simulations, by default 1000

1000
dividend_yield float

Continuous dividend yield, by default 0.0

0.0
seed int

Random seed for reproducibility, by default None

None

Returns:

Type Description
dict

Derivative price and details

Raises:

Type Description
ValueError

If the payoff function is not callable, underlying price is not positive, time to expiry is not positive, volatility is not positive, steps is not a positive integer, or simulations is not a positive integer.