Path: blob/master/1.1 Black-Scholes numerical methods.ipynb
1675 views
Black Scholes valuation methods
The purpose of this notebook is to review the most common algorithms and implement them numerically.
Contents
European option
Under the Black-Scholes (BS) model, the best method to price a vanilla European option is to use the BS closed formula.
The BS formula for a call is:
with
where is the cumulative distribution function of a standard normal random variable. The formula for a put is similar and can be found in the wiki page.
The value of an option can be also computed as the discounted expectation of a future payoff in this way:
where is the risk neutral transition probability of the process starting at . This is a log-normal density function
Comment:
Usually in statistics random variables are indicated by capital letters, and non-random variables are indicated with small letters. However, it is very common to indicate the stock price in the Black-Scholes formula with a capital letter e.g wiki notation. I'm going to use a capital letters to indicate random variables, and small letters for non random. However there will be exceptions where it will be clear from the context e.g. strike K and maturity T are non random, or most of the time is a fixed variable.
Let us analyze better the previous formulas
Let us introduce the following change of measure (under the stock numeraire):
By Girsanov theorem, under the driving Brownian motion has the new dynamics
and the corresponding stock dynamics becomes
The first term is
We have just seen how to interpret the terms and . These are the risk neutral probabilities of in the stock and money market numeraires respectively.
I implemented the BS closed formula in the class BS_pricer
.
Let us consider the following set of parameters, that will be recurrent in all the next notebooks.
The function log_normal(x, e_ret, vol)
defined above, corresponds to the scipy.stats function:
In the next calculation, I'm going to use the scipy function.
Let us perform the integration with the scipy.integrate
function quad:
The put option payoff is positive for .
In the call case, the integration is from to .
In the put case, the integration is from to .
What if we use the change of measure proposed above? In this way the integrations are simpler. Let us compute and .
It is quite common to compute the Black-Scholes formula using and .
The reason is that the cumulative function of the standard Normal distribution is more accessible (I guess). In the BS_pricer
class I used the function scipy.stats.norm.cdf
.
For completeness, let me recall that if is a Normal random variable, then is Log-Normal. Therefore we have:
This permits to use the Normal cumulative function.
BS_pricer
In the next notebooks I will present better the class BS_pricer
. But now let's have a look at the prices obtained by different pricing methods:
The PDE approach is the topic of the notebook 2.1.
Binomial tree
Of course I cannot forget about the Binomial model! This is a simple but very powerful numerical method!
I expect you to be familiar with this model. If not, have a look at the wiki page. Although I said I expect you to know the model, I'm not expecting that you have already implemented it! Therefore, here I present an efficient implementation:
The stock price on each node of a binomial tree is where the price at is obtained starting from := and applying up factors and down factors.
In a (recombining) binomial tree at each time point there are nodes. The total number of nodes of a binomial tree is
Since , we can rewrite the formula above as
In this way, we can decrease the number of operations and increase the speed of the program:
The last approach for the computation of is the fastest.
The BS formula is an increasing function of the volatility. However, for higher volatilities, the graph becomes almost flat!!
We can conclude that the model is reliable for volatilities in the range .