LINEBURG

 << Пред. стр. страница 8(всего 20)ОГЛАВЛЕНИЕ След. стр. >>
for (int i=0;i<dividend times.size();i++) {
if (dividend times[i]<=time to maturity){
adjusted S в€’= dividend amounts[i] * exp(в€’r*dividend times[i]);
};
};
return option price call black scholes(adjusted S,K,r,sigma,time to maturity);
};

Code 8.2: European option price, dividend paying stock

51
The program

void test black scholes with dividends(){
double S = 100.0; double K = 100.0;
double r = 0.1; double sigma = 0.25;
double time=1.0;
double dividend yield=0.05;
vector<double> dividend times; vector<double> dividend amounts;
dividend times.push back(0.25); dividend amounts.push back(2.5);
dividend times.push back(0.75); dividend amounts.push back(2.5);
cout << " european stock call option with contininous dividend = "
<< option price european call payout(S,K,r,dividend yield,sigma,time) << endl;
cout << " european stock call option with discrete dividend = "
<< option price european call dividends(S,K,r,sigma,time,dividend times,dividend amounts) << endl;
};

provides the output
european stock call option with contininous dividend = 11.7344
european stock call option with discrete dividend = 11.8094

8.2 American options.

American options are much harder to deal with than European ones. The problem is that it may be optimal
to use (exercise) the option before the п¬Ѓnal expiry date. This optimal exercise policy will aп¬Ђect the value of
the option, and the exercise policy needs to be known when solving the pde. There is therefore no general
analytical solutions for American call and put options. There is some special cases. For American call
options on assets that do not have any payouts, the American call price is the same as the European one,
since the optimal exercise policy is to not exercise. For American Put is this not the case, it may pay to
exercise them early. When the underlying asset has payouts, it may also pay to exercise the option early.
There is one known known analytical price for American call options, which is the case of a call on a stock
that pays a known dividend once during the life of the option, which is discussed next. In all other cases the
American price has to be approximated using one of the techniques discussed in later chapters: Binomial
approximation, numerical solution of the partial diп¬Ђerential equation, or another numerical approximation.

8.2.1 Exact american call formula when stock is paying one dividend.

When a stock pays dividend, a call option on the stock may be optimally exercised just before the stock goes
ex-dividend. While the general dividend problem is usually approximated somehow, for the special case of one
dividend payment during the life of an option an analytical solution is available, due to RollвЂ“GeskeвЂ“Whaley.
If we let S be the stock price, K the exercise price, D1 the amount of dividend paid, t1 the time of dividend
payment, T the maturity date of option, we denote the time to dividend payment П„1 = T в€’ t1 and the time
to maturity П„ = T в€’ t.
A п¬Ѓrst check of early exercise is:

D1 в‰¤ K 1 в€’ eв€’r(T в€’t1 )

If this inequality is fulп¬Ѓlled, early exercise is not optimal, and the value of the option is

c(S в€’ eв€’r(t1 в€’t) D1 , K, r, Пѓ, (T в€’ t))

where c(В·) is the regular Black Scholes formula.
If the inequality is not fulп¬Ѓlled, one performs the calculation shown in formula 8.2 and implemented in
code 8.3

52
C = (S в€’ D1 eв€’r(t1 в€’t) ) (N (b1 ) + N (a1 , в€’b1 , ПЃ)) + Keв€’r(T в€’t)) N (a2 , в€’b2 , ПЃ) в€’ (K в€’ D1 )eв€’r(t1 в€’t) N (b2 )

where
(t1 в€’ t
ПЃ=в€’
T в€’t
Sв€’D1 eв€’q(П„1
+ (r + 1 Пѓ 2 )П„
ln K 2
в€љ
a1 =
ПѓП„
в€љ
a2 = a1 в€’ Пѓ T в€’ t
Sв€’D1 eв€’r(t1 в€’t)
+ (r + 1 Пѓ 2 )(t1 в€’ t)
ln ВЇ 2
S
b1 =
(t1 в€’ t)
Пѓ
в€љ
b 2 = b1 в€’ Пѓ T в€’ t
ВЇ
and S solves
ВЇ ВЇ
c(S, t1 ) = S + D1 в€’ K
S is the price of the underlying secrutity, K the exercise price, r the risk free interest rate, D1 is the dividend amount and Пѓ the
standard deviation of the underlying asset, t the current date, T the maturity date, T в€’ t the time to maturity for the option and
N (В·) the cumulative normal distribution. N () with one argument is the univariate normal cumulative distribution. N () with three
arguments is the bivariate normal distribution with the correlation between the two normals given as the third arguement.
Formula 8.2: RollвЂ“GeskeвЂ“Whaley price of american call option paying one п¬Ѓxed dividend

Exercise 6.
The Black approximation to the price of an call option paying a п¬Ѓxed dividend is an approximation to the value
of the call. Suppose the dividend is paid as some date t1 before the maturity date of the option T . Blacks
approximation calculates the value of two European options using the Black Scholes formula. One with expiry
date equal to the ex dividend date of the options. Another with expiry date equal to the option expiry, but the
current price of the underlying security is adjusted down by the amount of the dividend.

1. Implement BlackвЂ™s approximation.

53
#include <cmath>
#include "normdist.h" // deп¬Ѓne the normal distribution functions
#include "fin_recipes.h" // the regular black sholes formula

double option price american call one dividend(const double& S,
const double& K,
const double& r,
const double& sigma,
const double& tau,
const double& D1,
const double& tau1){
if (D1 <= K* (1.0в€’exp(в€’r*(tauв€’tau1)))) // check for no exercise
return option price call black scholes(Sв€’exp(в€’r*tau1)*D1,K,r,sigma,tau);
const double ACCURACY = 1eв€’6; // decrease this for more accuracy
double sigma sqr = sigma*sigma;
double tau sqrt = sqrt(tau);
double tau1 sqrt = sqrt(tau1);
double rho = в€’ sqrt(tau1/tau);

double S bar = 0; // п¬Ѓrst п¬Ѓnd the S bar that solves c=S bar+D1-K
double S low=0; // the simplest: binomial search
double S high=S; // start by п¬Ѓnding a very high S above S bar
double c = option price call black scholes(S high,K,r,sigma,tauв€’tau1);
double test = cв€’S highв€’D1+K;
while ( (test>0.0) && (S high<=1e10) ) {
S high *= 2.0;
c = option price call black scholes(S high,K,r,sigma,tauв€’tau1);
test = cв€’S highв€’D1+K;
};
if (S high>1e10) { // early exercise never optimal, п¬Ѓnd BS value
return option price call black scholes(Sв€’D1*exp(в€’r*tau1),K,r,sigma,tau);
};
S bar = 0.5 * S high; // now п¬Ѓnd S bar that solves c=S bar-D+K
c = option price call black scholes(S bar,K,r,sigma,tauв€’tau1);
test = cв€’S barв€’D1+K;
while ( (fabs(test)>ACCURACY) && ((S highв€’S low)>ACCURACY) ) {
if (test<0.0) { S high = S bar; }
else { S low = S bar; };
S bar = 0.5 * (S high + S low);
c = option price call black scholes(S bar,K,r,sigma,tauв€’tau1);
test = cв€’S barв€’D1+K;
};
double a1 = (log((Sв€’D1*exp(в€’r*tau1))/K) +( r+0.5*sigma sqr)*tau) / (sigma*tau sqrt);
double a2 = a1 в€’ sigma*tau sqrt;
double b1 = (log((Sв€’D1*exp(в€’r*tau1))/S bar)+(r+0.5*sigma sqr)*tau1)/(sigma*tau1 sqrt);
double b2 = b1 в€’ sigma * tau1 sqrt;
double C = (Sв€’D1*exp(в€’r*tau1)) * N(b1) + (Sв€’D1*exp(в€’r*tau1)) * N(a1,в€’b1,rho)
в€’ (K*exp(в€’r*tau))*N(a2,в€’b2,rho) в€’ (Kв€’D1)*exp(в€’r*tau1)*N(b2);
return C;
};

Code 8.3: Option price, RollвЂ“GeskeвЂ“Whaley call formula for dividend paying stock

54
The program

void test rgw price am call div(){
double S = 100.0; double K = 100.0;
double r = 0.1; double sigma = 0.25;
double tau = 1.0; double tau1 = 0.5;
double D1 = 10.0;
cout << " american call price with one dividend = "
<< option price american call one dividend(S,K,r,sigma,tau,D1, tau1)<< endl;
};

provides the output
american call price with one dividend = 10.0166

Example 8.1: Example of pricing of option on stock paying one dividend during the life of the option

55
8.3 Options on futures

8.3.1 BlackвЂ™s model

For an European option written on a futures contract, we use an adjustment of the Black Scholes solution,
which was developed in Black . Essentially we replace S0 with eв€’r(T в€’t)r F in the Black Scholes formula,
and get the formula shown in 8.3 and implemented in code 8.4.

c = eв€’r(T в€’t) (F N (d1 ) в€’ KN (d2 ))

where
F
+ 1 Пѓ 2 (T в€’ t)
ln K
в€љ2
d1 =
Пѓ T в€’t
в€љ
d2 = d1 в€’ Пѓ T в€’ t

F is the futures price, K is the exercise price, r the risk free interest rate, Пѓ the volatility of the futures
price, and T в€’ t is the time to maturity of the option (in years).
Formula 8.3: Blacks formula for the price of an European Call option with a futures contract as the
underlying security

#include <cmath> // mathematics library
// normal distribution
#include "normdist.h"
using namespace std;

double futures option price call european black( const double& F, // futures price
const double& K, // exercise price
const double& r, // interest rate
const double& sigma, // volatility
const double& time){ // time to maturity
double sigma sqr = sigma*sigma;
double time sqrt = sqrt(time);
double d1 = (log (F/K) + 0.5 * sigma sqr * time) / (sigma * time sqrt);
double d2 = d1 в€’ sigma * time sqrt;
return exp(в€’r*time)*(F * N(d1) в€’ K * N(d2));
};

Code 8.4: Price of European Call option on Futures contract

The program

void test futures option price black(){
double F = 50.0; double K = 45.0;
double r = 0.08; double sigma = 0.2;
double time=0.5;
cout << " european futures call option = "
<< futures option price put european black(F,K,r,sigma,time) << endl;
};

provides the output
european futures call option = 0.851476

Example 8.2: Pricing of Futures option using the Black formula

Exercise 7.

56
The Black formula for a put option on a futures contract is

p = eв€’r(T в€’t) (KN (в€’d2 ) в€’ F N (в€’d1 ))

where the varibles are as deп¬Ѓned for the call option.

1. Implement the put option price.

57
8.4 Foreign Currency Options

Another relatively simple adjustment of the Black Scholes formula occurs when the underlying security is a
currency exchange rate (spot rate). In this case one adjusts the Black-Scholes equation for the interest-rate
diп¬Ђerential.
Let S be the spot exchange rate, and now let r be the domestic interest rate and rf the foreign interest rate.
Пѓ is then the volatility of changes in the exchange rate. The calculation of the price of an European call
option is then shown in formula 8.4 and implented in code 8.5.

c = Seв€’rf (T в€’t) N (d1 ) в€’ Keв€’r(T в€’t) N (d2 )

where
S
+ r в€’ rf + 1 Пѓ 2 (T в€’ t)
ln K 2
в€љ
d1 =
Пѓ T в€’t
в€љ
d2 = d1 в€’ Пѓ T в€’ t
S is the spot exchange rate and K the exercise price. r is the domestic interest rate and rf the foreign interest rate. Пѓ is the volatility
of changes in the exchange rate. T в€’ t is the time to maturity for the option.
Formula 8.4: European currency call

#include <cmath>
#include "normdist.h" // deп¬Ѓne the normal distribution function

double currency option price call european( const double& S, // exchange rate,
const double& X, // exercise,
const double& r, // r domestic,
const double& r f, // r foreign,
const double& sigma, // volatility,
const double& time){ // time to maturity
double sigma sqr = sigma*sigma;
double time sqrt = sqrt(time);
double d1 = (log(S/X) + (rв€’r f+ (0.5*sigma sqr)) * time)/(sigma*time sqrt);
double d2 = d1 в€’ sigma * time sqrt;
return S * exp(в€’r f*time) * N(d1) в€’ X * exp(в€’r*time) * N(d2);
};

Code 8.5: European Futures Call option on currency

The program

void test currency option european call(){
double S = 50.0; double K = 52.0;
double r = 0.08; double rf=0.05;
double sigma = 0.2; double time=0.5;
cout << " european currency call option = "
<< currency option price call european(S,K,r,rf,sigma,time) << endl;
};

provides the output
european currency call option = 2.22556

Example 8.3: Pricing a foreign currency call option

Exercise 8.

58
The price for an european put for a currency option is

p = Keв€’r(T в€’t) N (в€’d2 ) в€’ Seв€’rf (T в€’t) N (в€’d1 )

1. Implement this formula.

59
8.5 Perpetual puts and calls

A perpetal option is one with no maturity date, it is iniп¬Ѓnitely lived. Of course, only American perpetual
options make any sense, European perpetual options would probably be hard to sell.1 For both puts and
calls analytical formulas has been developed. We consider the price of an American call, and discuss the put
in an exercise. Formula 8.5 gives the analytical solution.

h1
h1 в€’ 1 S
K
p
C=
h1 в€’ 1 h1 K

where
2
1 rв€’q rв€’q 1 2r
h1 = в€’ в€’
+ +
Пѓ2 Пѓ2 Пѓ2
2 2
S is the current price of the underlying security, K is the exercise price, r is the risk free interest rate, q is the dividend yield and Пѓ is
the volatility of the underlying asset.
Formula 8.5: Price for a perpetual call option

#include <cmath>
using namespace std;

double option price american perpetual call(const double& S,
const double& K,
const double& r,
const double& q,
const double& sigma){
double sigma sqr=pow(sigma,2);
double h1 = 0.5в€’ ((rв€’q)/sigma sqr);
h1 += sqrt(pow(((rв€’q)/sigma sqrв€’0.5),2)+2.0*r/sigma sqr);
double pric=(K/(h1в€’1.0))*pow(((h1в€’1.0)/h1)*(S/K),h1);
return pric;
};

Code 8.6: Price for an american perpetual call option

The program

void test option price perpetual american call(){
 << Пред. стр. страница 8(всего 20)ОГЛАВЛЕНИЕ След. стр. >>