![](https://csdnimg.cn/release/download_crawler_static/10937179/bg14.jpg)
Chapter 1
[ 9 ]
The preceding equation needs to be solved in an iterative way for each time interval
between now and the maturity of the contract. If these time intervals are days and
the contract has a maturity of 30 days from now, then we compute tomorrow's
price in terms of todays. Then we compute the day after tomorrow as a function of
tomorrow's price and so on. In order to price the derivative, we require to compute
the expected payoff E[H(ST)] at maturity and then discount it to the present. In this
way, we would be able to compute what should be the fair premium
associated
with a European option contract with the help of the following equation:
exp( ) [ (S )] exp( ) [max(S ,0)]
T T
rT E H rT E K
π
= − × = − × −
Equation 4
Discipline 3 – informatics
(C++ programming)
What is the role of C++ in pricing derivatives? Its role is fundamental. It allows us
to implement the actual calculations that are required in order to solve the pricing
problem. Using the preceding techniques to describe the dynamics of the underlying,
we require to simulate many potential future scenarios describing its evolution. Say
we ought to price a futures contract on the EUR/USD exchange rate with one year
maturity. We have to simulate the future evolution of EUR/USD for each day for
the next year (using equation 3). We can then compute the payoff at maturity (using
equation 1). However, in order to compute the expected payoff (using equation 4),
we need to simulate thousands of such possible evolutions via a technique known
as Monte Carlo simulation. The set of steps required to complete this process is
known as an algorithm. To price a derivative, we ought to construct such algorithm
and then implement it in an advanced programming language such as C++. Of
course C++ is not the only possible choice, other languages include Java, VBA,
C#, Mathworks Matlab, and Wolfram Mathematica. However, C++ is an industry
standard because it's exible, fast, and portable. Also, through the years, several
numerical libraries have been created to conduct complex numerical calculations in
C++. Finally, C++ is a powerful modern object-oriented language.
It is always difcult to strike a balance between clarity and efciency. We have aimed
at making computer programs that are self-contained (not too object oriented) and
self-explanatory. More advanced implementations are certainly possible, particularly
in the context of larger nancial pricing libraries in a corporate context. In this book, all
the programs are implemented with the newest standard C++11 using Code::Blocks
(http://www.codeblocks.org) and MinGW (http://www.mingw.org).
www.allitebooks.com