tutorial using stochastic processes - fairmat...tutorial using stochastic processes in this tutorial...

15
Tutorial Using Stochastic Processes In this tutorial we demonstrate how to use Fairmat Academic to solve exercises involving Stochastic Processes 1 , that can be found in John C. Hull Options, futures and other derivatives [Chapter 20, 5th Edition]. You can also find a video for this tutorial at: http://youtu.be/cjk3zFL0ovI 1 Hull & White, Mean Reverting 1

Upload: others

Post on 21-Mar-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Tutorial Using Stochastic Processes - Fairmat...Tutorial Using Stochastic Processes In this tutorial we demonstrate how to use Fairmat Academic to solve exercises involving Stochastic

Tutorial

Using Stochastic Processes

In this tutorial we demonstrate how to use Fairmat Academic to solveexercises involving Stochastic Processes1, that can be found in John C. HullOptions, futures and other derivatives [Chapter 20, 5th Edition].

You can also find a video for this tutorial at: http://youtu.be/cjk3zFL0ovI

1Hull & White, Mean Reverting

1

Page 2: Tutorial Using Stochastic Processes - Fairmat...Tutorial Using Stochastic Processes In this tutorial we demonstrate how to use Fairmat Academic to solve exercises involving Stochastic

1 How to determine expected value of Call and Put options

1 How to determine expected value of Call andPut options

As you know in order to calculate the expected value of a call or a put option it’snecessary to calculate the maximum value many times before the end period:

c = (S −K)+ , p = (K − S)+

where K is the strike price.We can’t know the price of a future date, but financial theory says that price

dynamic evolves as a stochastic process (Wiener, Geometric Brownian motionetc...):

dS = µdt+ σdw

Note: A European option may be exercised only at the expiry date2. AnAmerican option on the other hand may be exercised at any time before theexpiry date.

Fairmat creates a particular stochastic process.In order to calculate call/put value:

• Create parameters:

– K: it is the strike price;

– mu: it is average of process;

Parameters & Functions → Add → Select Constant

2Maturity/end date.

2

Page 3: Tutorial Using Stochastic Processes - Fairmat...Tutorial Using Stochastic Processes In this tutorial we demonstrate how to use Fairmat Academic to solve exercises involving Stochastic

1 How to determine expected value of Call and Put options

• Create a Stochastic Process3: choose the stochastic models. Differentbuilt-in dynamics are available.

Note: f these process aren’t available you can install them as follows:

Setting → Plugins Settings → Available online plugins.

3Fairmat names them V1,V2,...

3

Page 4: Tutorial Using Stochastic Processes - Fairmat...Tutorial Using Stochastic Processes In this tutorial we demonstrate how to use Fairmat Academic to solve exercises involving Stochastic

1 How to determine expected value of Call and Put options

In this case we have chose Mean Reverting Process4, but you can chooseany one you wish.

Note: in the Edit Stochastic Process (highlighted in orange) insertparameters (Mean Reversion Rate=µ Long-term Mean=K). Here you cansee the process Dynamics Preview (highlighted in red) and the Distribu-tion (highlighted in blue) at time t moving the cursor (highlighted ingreen).

4dSt = µ (L− St)dt+ σ dW

4

Page 5: Tutorial Using Stochastic Processes - Fairmat...Tutorial Using Stochastic Processes In this tutorial we demonstrate how to use Fairmat Academic to solve exercises involving Stochastic

1 How to determine expected value of Call and Put options

In this case Long-Term Mean is a constant, but Fairmat can show it inanother way, for example as a time function:

Create a function in t (highlighted in blue), insert it in to the Long-term meanin Edit Stochastic Process. You can show then see a preview (highlighted inpink).

• Create in Option Map a option block. You can choose three types:

– European-style (green rhombus);

– American-style (blue rhombus);

– Custom (pink rhombus);

Note: now consider a European-style.

5

Page 6: Tutorial Using Stochastic Processes - Fairmat...Tutorial Using Stochastic Processes In this tutorial we demonstrate how to use Fairmat Academic to solve exercises involving Stochastic

1 How to determine expected value of Call and Put options

• The option payoff can be any analytical expression. In this case we aremodelling a call5 option:

Insert call formula (V 1−K)6 and the End(Maturity).

• Choose a Simulation date and click the Run button

Double click on Exp. Value and you can see the MTM price andpresent value distribution (highlighted in pink).

5Use K-V1 for put modelling.6Fairmat considers maximum.

6

Page 7: Tutorial Using Stochastic Processes - Fairmat...Tutorial Using Stochastic Processes In this tutorial we demonstrate how to use Fairmat Academic to solve exercises involving Stochastic

2 Forward Rate Agreement

You can change the type of option, for example from European to American-style, using the combo box in the option block:

Fairmat automatically changes the type of Option.

Fairmat computes the Mark-to-Market (MTM) price using Monte-Carlosimulation with a default setting, but you can change this:

Choose the number of step and of simulation.

2 Forward Rate Agreement

A Forward Rate Agreement (FRA) is a forward contract (see Tutorial #1),between parties that determines the rate of interest to be paid or received on afuture date.

In Fairmat it is easy to calculate a Forward rate Agreement (FRA).

7

Page 8: Tutorial Using Stochastic Processes - Fairmat...Tutorial Using Stochastic Processes In this tutorial we demonstrate how to use Fairmat Academic to solve exercises involving Stochastic

2 Forward Rate Agreement

The following data are available:

• Pd: vector containing payment dates;

• tau: it is a vector difference transformation about Pd;

• zr: it is the zero rates vector;

Parameters

zr is a Interpolate function, column X (highlighted in pink) indicates theperiod column Y (highlighted in green) indicates the rates value. Pd is a vector

dates7.

7See Tutorial # 2 for import parameters.

8

Page 9: Tutorial Using Stochastic Processes - Fairmat...Tutorial Using Stochastic Processes In this tutorial we demonstrate how to use Fairmat Academic to solve exercises involving Stochastic

2 Forward Rate Agreement

The combo box (in blue) indicates the date on which to start the transformation(write it in Setting → Project Preferences8), the green indicates the con-vention of adjusting dates specified or determined with regard to a particulartransaction, and the pink indicates the difference between the actual date andthe previous one.

8See Tutorial # 2 to do it.

9

Page 10: Tutorial Using Stochastic Processes - Fairmat...Tutorial Using Stochastic Processes In this tutorial we demonstrate how to use Fairmat Academic to solve exercises involving Stochastic

2 Forward Rate Agreement

To enter the cash flows, open the Option Map and create a strip of options(pink rhombus), which can handle a sequences of payments.

The block FRA calculates the total rates for the nominal amount (in thiscase it is 1).9

Block FRA: the payoff FRA(Pd[#];Tau[#]; @zr) is calculated for elementin Vector in a determinate position expressed that takes the values 1,2,...,length(@Pd)

click Run Analysis and see the valuation result in the bottom panel (Valu-ation tab)

9Options Strips simplifies the repetition of similar payoffs and exercise dates (by allowingto parametrize expressions using the character #), and summing them over the componentsof an input vector.

10

Page 11: Tutorial Using Stochastic Processes - Fairmat...Tutorial Using Stochastic Processes In this tutorial we demonstrate how to use Fairmat Academic to solve exercises involving Stochastic

3 How to calculate a variable rate

3 How to calculate a variable rate

Consider section 3 in Tutorial #2. The floating rates aren’t known, but withFairmat you can do a simulation for them. For example, to calculate a VARleg with nominal amount, zero rates and payment date.

The data are:

• Pd: it is a vector contain the payment date;

• tau: it is a vector difference transformation about Pd;

• zr: it is the zero rates vector;

• RD: it is the rate date vector;

Parameters

Constant

Vector10

10See Tutorial # 2 for import parameters.

11

Page 12: Tutorial Using Stochastic Processes - Fairmat...Tutorial Using Stochastic Processes In this tutorial we demonstrate how to use Fairmat Academic to solve exercises involving Stochastic

3 How to calculate a variable rate

The combo box (in blue) indicates the date to start the transformation (writeit in Setting → Project Preferences so Fairmat calculates the differencebetween the actual date and the previous one.

In order to calculate the VAR leg create a Stochastic Process11

11Use Hull and White method John C. Hull Options, futures and other derivatives [Chapter24 section 24.1, 5th Edition]

12

Page 13: Tutorial Using Stochastic Processes - Fairmat...Tutorial Using Stochastic Processes In this tutorial we demonstrate how to use Fairmat Academic to solve exercises involving Stochastic

3 How to calculate a variable rate

Insert the Hull and White parameters. Note: zr is a vector12

In order to calculates the VAR leg open the Option map and insert a Option

Strip and click on it

12Write the symbol @ before vector name.

13

Page 14: Tutorial Using Stochastic Processes - Fairmat...Tutorial Using Stochastic Processes In this tutorial we demonstrate how to use Fairmat Academic to solve exercises involving Stochastic

3 How to calculate a variable rate

It calculates the total payment of the floating rates of the nominal amount(nominal ∗ (rate(Rd[#]; tau[#];@v1) + spread) ∗Rd[#]). Options Strips sim-plifies the repetition of similar payoffs and exercise dates (by allowing you toparametrize expressions using the character #), and summing them over thecomponents of an input vector.

The parameter RATE is a particular function in Fairmat

Click Ctrl+spacebar to show a help bar

14

Page 15: Tutorial Using Stochastic Processes - Fairmat...Tutorial Using Stochastic Processes In this tutorial we demonstrate how to use Fairmat Academic to solve exercises involving Stochastic

3 How to calculate a variable rate

To do the calculation click on Run Analysis. You will then see the valuationresult in the bottom panel (Valuation tab).

Note: the solutions have a Standard Deviation and a Standard Error becausethey are stochastic calculation

Double click on a solution and see the Project value graphic and statistics.

15