| Applying science to business management |
  
Black-Scholes Example
Suppose you want a function that implements the Black-Scholes
pricing model. The Black-Scholes model, first published in 1973
by Fischer Black and Myron Scholes, is used to calculate the
present value of a call option. Without going into the background
theory here, we will simply present the resulting equations we
wish to implement as a model.
The present value of a call option is:
P = the current price of the underlying security
E = the strike or exercise price in the options contract
t = the time to expiration of the option
v = the volatility of the underlying security's price
r = the risk-free interest rate
The function Cnorm is the cumulative normal
distribution function; it is used frequently in statistics and
management science. Cnorm is defined as:
The Cnorm function alone is a good candidate for a
separate library model. In fact, to build the Black-Scholes
model, it is best first to build a separate Cnorm model.
You will not find a closed form solution to the integral in
the Cnorm definition because the integral cannot be
solved. Instead, you are likely to find a table in the back of
every statistics book that lists the value of this function for a
range of input values. However, DecisionPro can handle the
integration quite easily using the integral
primitive, which performs numerical integration.
The Cnorm function can be implemented with two
definitions taken straight from the equations above:
Once defined, this model should be saved in LBM format under
the name Cnorm.lbm.
The complete Black-Scholes model can be implemented as
follows:
Once created, this model should be saved in LBM format under
the name Black.lbm. From then on, this model can be used
in any other model simply by using the function Black(P,E,t,v,r)
where the arguments P, E, t, v, and r
are replaced with the appropriate input values.
Nesting Models
The Black-Scholes model has been split into two separate
models, Black and Cnorm, where Black uses
the model Cnorm. Library models can use other library
models as components. In fact, there is no practical limit to how
deeply you can nest library models.
The ability to nest models allows you to build libraries of
models hierarchically. Each successive model can draw on previous
models you have developed to perform increasingly more complex
tasks. For example, once you have the Black model, you can
build a model that uses Black to evaluate investment
options.
When DecisionPro loads a library model, all component models
are automatically loaded as well.
|