240 likes | 895 Views
The Monte Carlo Method Part 2 with maple programming. By: Joe Casey. Review . T he Monte Carlo method solves a problem by directly simulating the underlying (physical) process and then calculating the (average) result of the process. 1. Draw a random number
E N D
The Monte Carlo MethodPart 2with maple programming By: Joe Casey
Review • The Monte Carlo method solves a problem by directly simulating the underlying (physical) process and then calculating the (average) result of the process. 1. Draw a random number 2. Process this random number in some way, for example plug it into an equation 3. Repeat steps 1 and 2 a large number of times 4. Analyze the cumulative results to find an estimation for a non random value
How to use the Method • There are many different ways to implement the Monte Carlo Method. But because of their reliance on repeated computation of random numbers, these methods are most suited to calculation by a computer • Multiple finical software companies, such as sap and vanguard, have expensive Monte Carlo programs for sale • We will focus on using a piece of software that we are all familiar with; Maple.
Maple • Maple does not include a built in Monte Carlo Method • However, this does not mean we can not use it for Monte Carlo Methods • We will have to write our own program
Intro to Maple Programming • We will need to learn a few programming techniques in order to write a Monte Carlo program • First, something we all probably have a little experience with: assignment. • The syntax for assignment is: Name:=equationOrNumber; • every time you enter “Name” you will now call the value.
Handling multiple assignments: Arrays • Instead of tediously assigning each value to a separate value, most programming languages make use of arrays. • What is an Array? It is similar to a variable but it can hold multiple values. • The syntax for an Array in maple looks like this: NameOfArray:=array([value1,value2,valueN]);
Procedures in Maple • What is a procedure? It is just another name for the code that the computer follows • We have already used some built in procedures.blackscholes(S, K, r, T, volatility); plot([xvalues],[yvalues]); • The values in the () are called the parameters. The answer the procedure produces is based on the values of these parameters.
Making our your own procedure • This will be helpful for all math classes • To make your own procedure we will use the “proc” command • The basic syntax of a procedure is ProcedureName:=proc(parameter1,parametersN) commands; end proc;
Creating Random Numbers • Maple has a built in random number generator • It can produce random numbers from many variety of distributions • For example, if you wanted to get random numbers from the normal distribution: RandomNumber:=stats[random, normal]:
Pricing Financial Derivatives Using Maple • Now using those techniques, and a few unmentioned ones, we are going to look at a Monte Carlo Calculation of a call-option • We will need to use the Monte Carlo method to create many different random walks and then estimate a payout for each walk • The program will finally average all of the results and provide us with a price range
Guess the price, win a prize • First we are going to do a review of how the underlying parameters effect the call option. • The base parameters will be Stock price: 100 Strike Price: 120 Time: 1 year Interest Rate: .03 Volatility: .25 • We will only vary one at a time, keeping all others constant • Price of call option with base parameters = 4.44 with MC (4.46 with Black)
Call Option: Volatility • Does the price off the Option go up or down as Volatility increases? • Price with volatility raised to .50 = 14.26 with MC (14.1 with Black)
Call Option: Strike Price • Does the Price of a Call option increase or decrease with strike price? • Price with Strike Price raised to 140 = 1.51 with MC (1.54 with Black)
Asian Option Pricing • Unlike the call option, The Asian Option can not be priced with the BlackScholes Method • The most common way to price these exotic options is with the Monte Carlo Method • The Asian Option payoff is determined by the average underlying price over some pre-set period of time • Because of the averaging feature, Asian options reduce the volatility inherent in the option; therefore, Asian options are typically cheaper than European or American options.
Asian Option: Volatility • How will the Asian Option react when Volatility Is increased? • Price with volatility raised to .5 = 5.86 using MC
KnockOut Option • This Option is very similar to the call except for one thing, there is a set price barrier • If the stock price goes above the barrier price, the value of the option is 0 • This is an exotic type option, and the most effective way to calculate it is with the Monte Carlo Method • The base Strike price was lowered to 110, to allow for a higher chance of profitability
KnockOut Option: Volatility • Will the KnockOut Option price decrease or increase with much higher volatility? • Price with Volatility raised to .6 = 0.09
Sources • John Sonchack and Dr. Volperts Maple Algorithm • http://ems.calumet.purdue.edu/mcss/kraftrl/mfmm/pdf/Worksheet13.pdf • http://www.finweb.com/investing/exotic-options.html • http://en.wikipedia.org/wiki/Monte_Carlo_method