An Analysis of Option Pricing Models
Charles Vu
2002-2003
Code Development

So far this quarter I have put aside the getting the stock quotes function and decided to get some actual code down on the computer with the option pricing models. I talked to Vladimir Novakovski, an Economics major at Harvard, and he suggested to me some ways to adjust my project idea. He thought that overall, the model could work well, but that I needed to adjust the way that I evaluated the validity of the pricing models. I had initially thought that the ideal pricing model would yield a zero market return after all the testing, but Vlad correctly noted that in actuality, the market typically trends upward over the long term, and that the ideal pricing model would yield that historical market return, (8%).

But first, I need to code the pricing models into the computer. I started off with the most popular model, the Black-Scholes model. It is a complicated formula, but that usually isn't a big deal when you are coding, since the computer can do all the advanced calculations. However, there were some aspects of the formula which lead to some difficulty. The formula required that you use the standard normal cumulative distribution function (CDF). The CDF is the area along the normal (bell) curve up to a certain point, and that certain point is given in the Black-Scholes formula. So I had to calculate the integral from -infinity to that point along the normal curve. It took me a while to think of a good way to calculate the integral, but I decided to use the traditional Riemann integral, by partitioning the curve into many small rectangles. I've gotten the computer to compile the program, but I haven't been able to properly calculate the Black-Scholes option price quite yet.

Sample shots don't quite work yet, but here's some input from the formula, what it should be, and what my formula gave me.

Input: 50 50 .1 .04 .44
My Price: 2.8579
Real Price: 2.8857

Input: 50 45 .1 .04 .44
My Price: 5.3181
Real Price: 6.0019

Input: 50 55 .1 .04 .44
My Price: 0.76770
Real Price: 1.1326

Clearly, some debugging is in store. I'm not quite sure where exactly the error is, but I do not think it is in the CDF function, because I tested that function and it worked perfectly. The input for the CDF function may be incorrect, or some other part of the formula may have been programmed incorrectly.

My Black-Scholes Formula Code

Assignments First Quarter
Assignments Second Quarter