Option Pricing, Numerical Methods, Monte Carlo, Monte Carlo Simulation.
for j in range(i+1): values[i][j] = np.exp(-r*dt)*(p*values[i+1][j+1] + (1-p)*values[i+1][j]) return values # Example usage: S = 50 X = 45 r = 0.05 T = 0.5 N = 20 sigma = 0.7 option_type = "call" option_values = binomial_option_values(S, X, r, T, N, sigma, option_type) # Plot the option values over