Wyższa Szkoła Zarządzania i Bankowości
LECTURESNOTEBOOKSPACKAGES
7 Special Topic in Stochastic Finance
7.2 Computational Finance in General

1 Introduction to Simulation and Modeling
2 Discrete Medeling (L-Systems)
3 Population Dynamics
4 Number Representation and Error Propagation
5 Modeling with Random Numbers
6 Heat Transfer in a Rod (Connection Mathematica and C: MathLink)
7 Special Topics in Stochastic Finance
7.1 A Brief Introduction to Finance
7.2 Computational Finance in General
7.3 Stochastic Modeling and Simulation in Finance
7.4 APPENDIX
7.5 References
8 Appendix: Introduction to Mathematica
9 Population Dynamics in Vensim®PLE
     
 

II.1  Computational Finance

Computational finance refers generally to the application of computational techniques to finance. It is a rather broad field, including many diverse areas of applied mathematics, computer science and economics. Nowadays, computational finance has become an integral part of modeling, analysis, and decision-making in financial industry
Many models used in finance end up in formulation of highly mathematical problems. Solving these equations exactly in closed form is impossible as the experience in other fields suggests. Therefore, we have to look for efficient numerical algorithms in solving complex problems such as option pricing, risk analysis, portfolio management, etc.
Especially, in the finance market, financial models used in online information processing are generally large and dynamic, normally ending up in large number of equations, say, 1000 to 100,000 equations. Solving these models is, due to their size, computationally intensive. For this type of problems, high performance computing is needed to generate solutions quickly in order to respond adequately on rapid changes in the financial market.
Recently, enabled by powerful computational tools, computational finance is able to proceed in novel directions:  new stochastic methods, neural networks, chaos theory, genetic algorithms, artificial life, simulated annealing and control of dynamic systems etc. These new computational techniques have greatly enhanced our understanding of complex economic and financial behaviors.

II.2  Some Active Fields


II.2.1  Stochastic Simulation
The financial market is random by nature, e.g the stock prices, interest rates of bonds, foreign exchange rates, etc present typical stochastic behaviors. Understanding this financial probability process can help us to develop correct valuation models for estimating expected returns and volatilities and their effects on asset and derivative prices, which are essential in financial decision making.  The financial stochastic dynamics is mathematically modeled with stochastic calculus and other stochastic methods.
Many complex financial problems exist for which analytical formulae are not possible. Stochastic simulation (Monte Carlo simulation) provides flexible methods for solving these types of problem. Monte Carlo simulation is advantageous at dealing easily with multiple random factors, implementing some more realistic asset pricing processes, such as that with jumps in asset prices, and that for exotic path-dependent options. The main drawback of Monte Carlo method is its computational inefficiency. However, new research and recent innovations in both technologic and algorithmic aspects have dramatically reduced computational time of Monte Carlo simulation by increasing speed and efficiency, and have been enhancing its attractiveness for modern financial computation.

II.2.2   Complexity Theory
The most important characteristics of chaos theory are clearly contradictory to the fundamental notions of the Newtonian world view of science. For instance, it demonstrates that many types of phenomena (fractal phenomena) are not susceptible to definitive measurement because they lack a characteristic scale, and is hence contradictory to the Newtonian world view which portrays the universe as a clockwork mechanism susceptible to precise measurement, prediction, and control.
The new vision of chaos theory or complexity theory is undermining the methodological perspective advocated by capital markets researchers most notably with respect to the assumptions of linearity and predictability. It is also challenging the validity of the most fundamental or traditional theories and models: EMH (efficient market hypothesis), MPT (modern portfolio theory), the CAPM (the capital asset pricing model), which underlie most of the research about the relationship between market prices and accounting information. The new vision is also breeding new theories of stock price behavior that are quite inconsistent with the traditional capital markets models and it has led to the emergence of a fractal market hypothesis.

II.2.3.  Agent-Based Simulation
Agent-based computational finance models economic markets with large numbers of interacting agents, relying heavily on computational tools to push beyond the restrictions of analytic methods. This new research methodology stresses interactions and learning dynamics in groups of traders who learn about the relations between prices and market information.
In this framework, traders are made up from a very diverse set of types and behaviors. To make the situation more complex, the population of agent types, or the individual behaviors themselves, are allowed to change over time in response to past performance. The finance market is thought of as an adaptive non-linear network whose primary building blocks are adaptive agents. Also, the research achievements on increasing return and path dependency contribute to this evolutionary perspective of finance and economy.

II.2.4.  Neural Networks
Neural networks are computing models often used for pattern classification and pattern recognition problems. They can learn from examples or experiences and particularly noted for their flexible function mapping ability, and achieves a high degree of prediction accuracy. Therefore, financial application areas that require pattern matching, classification, and prediction, such as bankruptcy prediction, loan evaluation, credit scoring, and bond rating, are fruitful candidate areas for neural network technology.
Especially, financial forecasting is always and will remain difficult because such data are greatly influenced by economical, political, international and even natural shocks.  Neural networks are data-driven self-adaptive methods in that there are few a priori assumptions about the model form for a problem under study. Unlike linear regression analysis, which is limited to the linear function mappings, neural networks are able to discover complex nonlinear relationships in the data. These unique features make them valuable for solving many practical problems such as option price, stocks price, foreign exchange rate forecasting, etc in terms of accuracy, adaptability, robustness, effectiveness, and efficiency.

II.3  Mathematica in Finance

II.3.1  Symbolic Computation Systems in Finance
Financial problems normally turn out to be highly complex and dynamic, and the solutions of them need powerful computational tools. In the last decade or so, powerful software programs, generally called symbolic processors or computer algebra systems, have become readily available for assistance in solving problems mathematically. More advanced symbolic processing programs combine numeric, symbolic, and graphic computation in a single, unified computing environment.
Numerous existed environments will be of interest to financial problem solvers.  These include such packages as GAUSS, MATLAB, GAMS, Mathematica, Maple etc. While each of these is potentially useful, they are not all the same type of environment. Some of them are quite specially designed programming environments for doing matrix-type calculations easily and effectively; some else of them are basically statistical packages, etc. Among them, [Graphics:Images/nb7_gr_57.gif] is one of the most popular and widely used product, which provides a coherent environment that integrates specific functions such as numeric calculations, symbolic calculations, graphics, statistics, a programming language, and document preparation.
The most common applications of Mathematica in finance are categorized as follows
     •  Modelling, programming, and visualization of financial problem
     •  Analytical valuation of financial assets
     •  Financial derivatives pricing
     •  Measurement of financial risks


II.3.2.  Examples of Mathematica Implementation

II.3.2.1 Black-Scholes Model
The Black-Scholes model provides a direct way of valuing a standard European call option for common stock. To implement it in Mathematica, we at first define the auxiliary functions d, d1 for calculating the parameters d and [Graphics:Images/nb7_gr_58.gif]of the Black-Scholes model:

[Graphics:Images/nb7_gr_59.gif]
[Graphics:Images/nb7_gr_60.gif]
[Graphics:Images/nb7_gr_61.gif]
[Graphics:Images/nb7_gr_62.gif]
[Graphics:Images/nb7_gr_63.gif]
[Graphics:Images/nb7_gr_64.gif]

We are now ready to compute the dollar value for stock options by calling the function BlackScholes with numerical arguments. For example, we might wish to find the value of a call option on a stock with an exercise price of 60 assuming that the current price of it is 58.5, the time until expiration is 0.3 years, the volatility of the stock is 29%, and the continuously compounded risk-free rate of return is 4% as follows:

[Graphics:Images/nb7_gr_65.gif]
[Graphics:Images/nb7_gr_66.gif]

Using the graphic capabilities of Mathematica one can easily explore the various qualitative properties of the Black-Scholes formula. For example, We can plot the dependence of the option price on the stock price for the option, and that on the time to maturity:

[Graphics:Images/nb7_gr_67.gif]

[Graphics:Images/nb7_gr_68.gif]

[Graphics:Images/nb7_gr_69.gif]
[Graphics:Images/nb7_gr_70.gif]

[Graphics:Images/nb7_gr_71.gif]

[Graphics:Images/nb7_gr_72.gif]

REQUIRED
II.3.a
Give a financial interpretation of this figure. It is helpful to run the code again by setting a short plotting range, i.e, { 0 , 0.5 }.

We can make a 3D plot of option value as a function of both stock price and time to expiration.

[Graphics:Images/nb7_gr_73.gif]

[Graphics:Images/nb7_gr_74.gif]

[Graphics:Images/nb7_gr_75.gif]

As indicated above, risk can be assessed by using sensitivity analysis of the Greeks.  The most important parameter that affects the value of an option is the price of the underlying stock. The Greek δ  is the partial derivative of option value with respect to stock price and is a useful measurement of risk for an option because it indicates how much the price of the option will respond to a $1 change in the price of the stock.
To find Delta, we at first calculate the derivative of the Norm function:

[Graphics:Images/nb7_gr_76.gif]
[Graphics:Images/nb7_gr_77.gif]

Then the function that computes Delta is

[Graphics:Images/nb7_gr_78.gif]

When Delta is applied to the situation given above, we have:

[Graphics:Images/nb7_gr_79.gif]
[Graphics:Images/nb7_gr_80.gif]

It shows that for a $1 increase in the stock, the price of this call option will increase by about 50 cents. A plot of Delta against stock price provides a fundamental insight into option valuation as follows:

[Graphics:Images/nb7_gr_81.gif]

[Graphics:Images/nb7_gr_82.gif]

[Graphics:Images/nb7_gr_83.gif]

REQUIRED
II.3.b
  Explain this figure upon the view of sensitivity analysis. Another Greek can facilitate you for this explanation. Which Greek is it? Why? Plot it against stock price.

The Black-Scholes formula provides a way to infer the volatility of a stock's price from the observed price of an option on that stock. Implied volatility is defined as the value of σ that makes the observed market price of the option equal to its Black-Scholes formula value. The function ImpliedVolatility to solve numerically for the volatility of an option given its price as follows:

[Graphics:Images/nb7_gr_84.gif]

Hence, if we knew the price of the option given above as 3.34886, we could verify that the volatility is 0.29 as follows:

[Graphics:Images/nb7_gr_85.gif]
[Graphics:Images/nb7_gr_86.gif]

Implied volatility is the collective wisdom of the market. It is also an extremely useful way of looking at options: indeed, some options on foreign currencies and other financial instruments are frequently quoted in terms of their implied volatility rather than by price. Many trading strategies are designed in the light of the value of implied volatility.

REQUIRED
II.3.2.2
Value at Risk

Suppose a portfolio manager manages a portfolio that consists of a single asset. The return of the asset is normally distributed with annual mean return 10% and annual standard deviation 30%. The value of the portfolio today is $100 million. We want to answer various simple questions about the end-of-year distribution of portfolio value:

1. What is the distribution of the end-of-year portfolio value?
2. What is the probability of a loss of more than 20 million dollars by year end (i.e., which is the probability that the end-of-year value is less than $80 million)?
3. With 1% probability what is the maximum loss at the end of the year? This is the VaR at 1%.

We start by loading Mathematica's statistical package:

[Graphics:Images/nb7_gr_87.gif]
[Graphics:Images/nb7_gr_88.gif]

We first want to know the distribution of the end-of-year portfolio value:

[Graphics:Images/nb7_gr_89.gif]

[Graphics:Images/nb7_gr_90.gif]

[Graphics:Images/nb7_gr_91.gif]

Then we can calculate the probability that the end-of-year portfolio value is less than $80:

[Graphics:Images/nb7_gr_92.gif]
[Graphics:Images/nb7_gr_93.gif]

The answer is about 15.9%.

To calculate the maximum loss at 1% at the end of the year, we can at first calculate the end-of-year value at 1%:

[Graphics:Images/nb7_gr_94.gif]
[Graphics:Images/nb7_gr_95.gif]

So the answer is (100-40.2096)  =  59.7904. i.e the VaR at 1% is about $60 million.

We can formalize this by defining a VaR function, which takes as its parameters the mean mu and standard deviation sigma of the distribution as well as the VaR level x.

[Graphics:Images/nb7_gr_96.gif]
[Graphics:Images/nb7_gr_97.gif]
[Graphics:Images/nb7_gr_98.gif]
[Graphics:Images/nb7_gr_99.gif]

REQUIRED
II.3.c
Using the parametric values in this example, calculate the 10%VAR. Plot two figures similar to the ones showed in section I.3.4.


 
     
  Lectures | Notebooks | Packages

 
  Copyright © 2003 Wyższa Szkoła Zarządzania i Bankowości. Wszystkie prawa zastrzeżone
webmaster@wszib.edu.pl