Skip to content
Programming

Example of a clean code – Black Scholes Model

Account required to view full content

Hereby an example of how to write a clean class to price an option using the Black Scholes model.

from numpy import exp, sqrt, log
from scipy.stats import norm


class BlackScholes:
    def __init__(
        self, time_to_maturity: float, strike: float, current_price: float, volatility: float, interest_rate: float,......