Option Pricing, Numerical Methods, Monte Carlo, Monte Carlo Simulation.
monte_carlo(S0, K, r, sigma, T, N): dt = T / N # Time step S = np.empty(N+1) # Stock price S[0] = S0 for i in range(N): S[i+1] = S[i] * np.exp((r - sigma**2 / 2) * dt + sigma * np.sqrt(dt) * np.random.normal()) return np.maximum(S[-1] - K, 0) # Payoff of call option # Parameters S0 = 100 # Initial