April 2019
Intermediate to advanced
426 pages
11h 13m
English
Before going any further and implementing the various pricing models that we are about to discuss, let's create a StockOption class to store and calculate the common attributes of the stock option that will be reused throughout this chapter:
In [ ]: import math """ Stores common attributes of a stock option """ class StockOption(object): def __init__( self, S0, K, r=0.05, T=1, N=2, pu=0, pd=0, div=0, sigma=0, is_put=False, is_am=False): """ Initialize the stock option base class. Defaults to European call unless specified. :param S0: initial stock price :param K: strike price :param r: risk-free interest rate :param T: time to maturity :param N: number of time steps :param pu: probability at up state ...
Read now
Unlock full access