The Binomial tree pricing model was first established by Cox, Ross and Robinstein. It is a numerical method in modeling the varying price over time on the underlying asset, then by using risk neutral pricing method to discount back the final payoff in order to get the option price.
Creating the binomial tree
This is the first step in this pricing model. Generally, we assume that the underlying asset's price S will move upward to S*u with a probability p and a downward move to $S*d(u*d = 1)$ with probability $1-p$.
Calculate the final payoff
As in previous assumptions, withe the risk neutral probability p, we can discount back the final payoff with respect to each note to calculate the option price.
An simple example of Binomial tree in C++:
/* Binomial tree method
* Copyright (C) Eric, CrazyQuant, Wed Mar 27 09:56:06 SGT 2013
* keywords: binomial tree, risk neutral pricing
*/
int main(int argc, char *argv[]){
int numberOfSteps = 10000;
double spotPrice = 100;
double strike = 100;
double expiry = 1.0;
double delta_t = expiry / static_cast(numberOfSteps);
double sigma = 0.03;
double r = 0.02;
double upMove = exp(sigma * sqrt(delta_t));
double downMove = 1 / upMove;
double p = (exp(r * delta_t) - downMove) / (upMove - downMove);
double q = 1 - p;
double discounting = exp(-r * delta_t);
// create binomial tree
const int arraySize = numberOfSteps + 1;
double* stockPrice = new double[arraySize];
// calculate this base price then multiply by u^2 to save time
double basePrice = spotPrice * pow(downMove, numberOfSteps);
stockPrice[0] = basePrice;
for(int i = 1; i < arraySize; i++)
stockPrice[i] = stockPrice[i - 1] * upMove * upMove;
// calculate final payoff, for european call option
double* optionPayoff = new double[arraySize];
for(int i = 0; i < arraySize; i++)
optionPayoff[i] = stockPrice[i] > strike ? (stockPrice[i] - strike) : 0.0;
// discount back to get the option price
double* tmpPrice = optionPayoff;
for(int i = numberOfSteps; i > 0; i--){
for(int j = 0; j < i; j++)
tmpPrice[j] = discounting * (q * tmpPrice[j] + p * tmpPrice[j + 1]);
}
double callOptionPrice = tmpPrice[0];
cout << "European call option: " << callOptionPrice << endl;
delete[] stockPrice;
delete[] optionPayoff;
return 0;
}
outcome:
European call option: 2.42892
As compared to the Monte-Carlo method, the results are almost the same.
Hey Eric, I am Jasper, from HKUST
ReplyDeleteit is a very good website!!! keep it up!!!
Thanks Jasper. Sure I will keep working on tt. You can also reach me at journey.jie@gmail.com.
Delete