LINEBURG

 << Пред. стр. страница 5(всего 20)ОГЛАВЛЕНИЕ След. стр. >>

30
one state, we also п¬Ѓnd the probability of the other as (1 в€’ q). Equation 5.1 demonstrates this calculation for
the underlying security.
S0 = eв€’r (qSu + (1 в€’ q)Sd ) (5.1)
Now, any derivative security based on this underlying security can be priced using the same вЂњprobabilityвЂќ q.
The contribution of binomial option pricing is in actually calculating the number q. To do valuation, start
by introducing constants u and d implicitly deп¬Ѓned by Su = uS0 and Sd = dS0 , and you get a process as
illustrated in п¬Ѓgure 5.1.

ВЁ uS0
B
ВЁ
ВЁ
ВЁВЁ
S0 rr
r
rr dS0
j

Figure 5.1: Binomial Tree

and calculate the artiп¬Ѓcal вЂњprobabilityвЂќ q as
er в€’ d
q=
uв€’d
The price of a one-period call option in a binomial framework is shown in formula 5.1 and implemented in
code 5.1.

Cu = max(0, Su в€’ K)

Cd = max(0, Sd в€’ K)

C0 = eв€’r (qCu + (1 в€’ q)Cd )

er в€’ d
q=
uв€’d
Su = uS0 and Sd = dS0 are the possible values for the underlying security next period, u and d are constants, r is the (continously
compounded) risk free interest rate and K is the call option exercise price.

Formula 5.1: The single period binomal call option price

The вЂњstate price probabilityвЂќ q is found by an assumption of no arbitrage opportunities. If one has the
possibility of trading in the underlying security and a risk free bond, it is possible to create a portfolio of
these two assets that exactly duplicates the future payoп¬Ђs of the derivative security. Since this portfolio has
the same future payoп¬Ђ as the derivative, the price of the derivative has to equal the cost of the duplicating
portfolio. Working out the algebra of this, one can п¬Ѓnd the expression for q as the function of the up and
down movements u and d.
Exercise 1.
The price of the underlying security follows the binomial process

ВЁ Su
B
ВЁ
ВЁ
ВЁ
S0 ВЁ
rr
rr
r Sd
j

31
#include <cmath> // standard mathematical library
#include <algorithm> // deп¬Ѓning the max() operator
using namespace std;

double option price call european binomial( const double& S, // spot price
const double& X, // exercice price
const double& r, // interest rate (per period)
const double& u, // up movement
const double& d){ // down movement
double p up = (exp(r)в€’d)/(uв€’d);
double p down = 1.0в€’p up;
double c u = max(0.0,(u*Sв€’X));
double c d = max(0.0,(d*Sв€’X));
double call price = exp(в€’r)*(p up*c u+p down*c d);
return call price;
};

Code 5.1: Binomial European, one period

A one period call option has payoп¬Ђs

ВЁ Cu = max(0, Su в€’ K)
B
ВЁ
ВЁ
ВЁ
C0 ВЁ
rr
rr
r Cd = max(0, Sd в€’ K)
j

1. Show how one can combine a position in the underlying security with a position in risk free bonds to create
a portfolio which exactly duplicates the payoп¬Ђs from the call.
2. Use this result to show the one period pricing formula for a call option shown in formula 5.1.

5.1 Multiperiod binomial pricing

Of course, an assumption of only two possible future states next period is somewhat unrealistic, but if we
iterate this assumption, and assume that every date, there are only two possible outcomes next date, but
then, for each of these two outcomes, there is two new outcomes, as illustrated in the next п¬Ѓgure:

u(uSt ) = uuSt
B
ВЁ
ВЁВЁ
ВЁВЁ
ВЁВЁ
ВЁ uS
ВЁ
ВЁ rr t
B
ВЁВЁ rr
ВЁ r
ВЁВЁ rr
r
j
ВЁSt d(uSt ) = u(dSt ) = udSt
rr ВЁ
B
ВЁ
ВЁ
r
ВЁВЁ
rr
ВЁ
r
r ВЁВЁ
r dSt
j
rr
r
rr
rr
d(dSt ) = ddSt
r
j

32
Iterating this idea a few times more, the number of diп¬Ђerent terminal states increases markedly, and we get
closer to a realistic distribution of future prices of the underlying at the terminal date. Note that a crucial
assumption to get a picture like this is that the factors u and d are the same on each date.

ВЁ
ВЁ
ВЁ
ВЁВЁrr r
ВЁ
ВЁ rr ВЁВЁ
ВЁ r
ВЁ
ВЁВЁ rr ВЁ rr
r r
r
ВЁ
ВЁ
rr ВЁВЁ r ВЁ
ВЁ ВЁ
ВЁ rВЁ
ВЁ
r
rr ВЁ r ВЁВЁrr
ВЁ rr r
rr ВЁВЁ r ВЁВЁ ВЁ
ВЁ
rВЁ
rr ВЁВЁrr
ВЁ r
rr ВЁ
ВЁ
rВЁ
rr
r

Pricing in a setting like this is done by working backwards, starting at the terminal date. Here we know all
the possible values of the underlying security. For each of these, we calculate the payoп¬Ђs from the derivative,
and п¬Ѓnd what the set of possible derivative prices is one period before. Given these, we can п¬Ѓnd the option
one period before this again, and so on. Working ones way down to the root of the tree, the option price is
found as the derivative price in the п¬Ѓrst node.
For example, suppose we have two periods, and price a two period call option with exercise price K.

uuS0
B
ВЁ
ВЁВЁ
ВЁВЁ
ВЁ
ВЁВЁ0
ВЁ ruS
B
ВЁВЁ rr
ВЁ r
ВЁ r
ВЁВЁ rr
r
j
ВЁS0 udS0
rr B
ВЁ
ВЁ
ВЁ
rr ВЁ
ВЁ
r
rr ВЁВЁ
r ВЁdS0
j
rr
r
rr
r
r ddS0
r
j

First step: Find terminal payoп¬Ђs of derivative security:

33
Cuu = max(0, Suu в€’ X)
ВЁ
B
ВЁВЁ
ВЁВЁ
ВЁВЁ
ВЁ
ВЁ rr
ВЁ
B
ВЁ r
ВЁ rr
ВЁВЁ rr
ВЁВЁ Cdu = max(0, duS в€’ X)
j
r
r B
ВЁ
ВЁ
rr ВЁ
ВЁВЁ
r
rr ВЁ
r ВЁВЁ
j
r
rr
rr
r
rr
Cdd в€’ max(0, ddS в€’ X)
r
j

Next step: Find the two possible call prices at time 1:

Cu = eв€’r (qCuu + (1 в€’ q)Cud )

Cd = eв€’r (qCud + (1 в€’ q)Cdd )

ВЁ Cu
B
ВЁ
ВЁ
ВЁВЁ
C0 r
rr
rj Cd
r

Final step: Using the two possible payoп¬Ђs at time 1, Cu and Cd , п¬Ѓnd option value at time 0:

C0 = eв€’r (qCu + (1 в€’ q)Cd )

Thus, binomial pricing really concerns вЂњrolling backwardвЂќ in a binomial tree, and programming therefore
concerns an eп¬ѓcient way of traversing such a tree. The obvious data structure for describing such a tree is
shown in code 5.2, where the value in each node is calculated from п¬Ѓnding out the number of up and down
steps are used to get to the particular node.
Exercise 2.
In terms of computational eп¬ѓciency the approcach of code 5.2 will not be optimal, since it requires a lot of calls
to the pow() functional call. More eп¬ѓcient would be to carry out the tree building by doing the multiplication
from the previous node, for example the jвЂ™th vector is the j в€’ 1вЂ™th vector times u, and then one need to add one
more node by multiplying the lowest element by d.

1. Implement such an alternative tree building procedure.

Basing the recursive calculation of a derivative price on a triangular array structure as shown in code 5.2 is
the most natural approach, but with some cleverness based on understanding the structure of the binomial
tree, we can get away with the more eп¬ѓcienent algorithm that is shown in code 5.3. Note that here we only
use one vector<double>, not a triangular array as built above.
Exercise 3.
Implement pricing of single and multi period binomial put options.

Further reading The derivation of the single period binomial is e.g. shown in Bossaerts and Г˜degaard
. Hull  and McDonald  are standard references.

34
#include <vector>
#include <cmath>
using namespace std;

vector< vector<double> > binomial tree(const double& S0,
const double& u,
const double& d,
const int& no steps){
vector< vector<double> > tree;
for (int i=1;i<=no steps;++i){
vector<double> S(i);
for (int j=0;j<i;++j){
S[j] = S0*pow(u,j)*pow(d,iв€’jв€’1);
};
tree.push back(S);
};
return tree;
};

Code 5.2: Building a binomial tree

#include <cmath> // standard mathematical library
#include <algorithm> // deп¬Ѓning the max() operator
#include <vector> // STL vector templates
using namespace std;

double option price call european binomial(const double& S, // spot price
const double& K, // exercice price
const double& r, // interest rate (per period)
const double& u, // up movement
const double& d, // down movement
const int& no periods){ // no steps in binomial tree
double Rinv = exp(в€’r); // inverse of interest rate
double uu = u*u;
double p up = (exp(r)в€’d)/(uв€’d);
double p down = 1.0в€’p up;
vector<double> prices(no periods+1); // price of underlying
prices = S*pow(d, no periods); // п¬Ѓll in the endnodes.
for (int i=1; i<=no periods; ++i) prices[i] = uu*prices[iв€’1];
vector<double> call values(no periods+1); // value of corresponding call
for (int i=0; i<=no periods; ++i) call values[i] = max(0.0, (prices[i]в€’K)); // call payoп¬Ђs at maturity
for (int step=no periodsв€’1; step>=0; в€’в€’step) {
for (int i=0; i<=step; ++i) {
call values[i] = (p up*call values[i+1]+p down*call values[i])*Rinv;
};
};
return call values;
};

Code 5.3: Binomial multiperiod pricing of European call option

35
Let S = 100.0, K = 100.0, r = 0.025, u = 1.05 and d = 1/u.
1. Price one and two period European Call options.

The program

void test bin eur call ud (){
double S = 100.0; double K = 100.0; double r = 0.025;
double u = 1.05; double d = 1/u;
cout << " one period european call = "
<< option price call european binomial(S,K,r,u,d) << endl;
int no periods = 2;
cout << " two period european call = "
<< option price call european binomial(S,K,r,u,d,no periods) << endl;
 << Пред. стр. страница 5(всего 20)ОГЛАВЛЕНИЕ След. стр. >>