Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 ·...

337

Transcript of Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 ·...

Page 1: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 1

Computational Methods in Finance

Nikos SkantzosIAE Toulouse 2011-12

N1

Page 2: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

∆ιαφάνεια 1

N1 Nikos, 10/20/2010

Page 3: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 2

Course Organisation� Introduction

� Organisation inside the dealing room� Why do we need numerical methods inside a dealingroom?

� Some reminders …� Derivative products� Mathematics used in finance� Introduction to stochastic processes and probability� Introduction to VBA programming

Page 4: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 3

Course Organisation� Evaluation of financial assets:

� Historical background� Brownian motion: motivation and examples� Black & Scholes model� Greeks� Other Models – Numerical methods – Payouts� Numerical methods

� Analytical solutions� Monte Carlo� Binomial Tree� Partial differential equations (PDE)

� Introduction to interest rate derivative products

Page 5: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 4

� Volatility smile and market models

� Risk Management� Calculation of VAR� Introduction to credit risk

� Real world markets� Stylised facts� Pairs trading: an example strategy� Kelly’s criterion

Course Organisation

Page 6: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 5

Introduction� Pictures from a dealing room

Page 7: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 6

Introduction

� A more realistic picture of the dealing room

Cartoon by Adam Zyglis

Page 8: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 7

Introduction� The presence and interaction of differentunits in a dealing room

TraderQuant

ITClient

Sales

Structurer

Risk Management Quant, IT

Page 9: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 8

Inside the dealing room: Sales

� Sales� In touch with customers� They sell options and other products of the bank.

� Structurers� design new products that are attractive to customers.

� Customers choose them if they offer low risk, high profit and small premium

Page 10: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 9

Inside the dealing room: Traders

� Traders� Hedge the position that the structurers open. � They buy sell/options to minimise the sensitivity of the bank’s portfolio to movements of the underlying.

� “Prop-traders”� Take position based on their expectation about the market’s next move.

Page 11: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 10

Introduction: « Quants »

� Who: � Develop and implement mathematical models to price the products of structurers and calculate the risk for the bank.

� Where: � Investment banks, hedge funds and more generally in anyfinancial institution dealing with derivatives and market risk.

� Background: � Mathematics, � Physics, � Engineering, � Economy.

Page 12: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 11

How a bank makes money

� Buying low & sell high� Selling financial products to customers� “Bid-offer” spread (buy price: bid, sell price: offer)

� Banks compete to offer best spread to customer

� Spread cannot go too high� The customer will go to someone else

� Spread cannot go too low� The bank will not have enough money to buy the hedge

Page 13: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 12

Derivative products: a reminder

� Main idea behind Options: pay now a small premium to have a choice in the future

� Example: exchange 1ml EUR for 1,3ml USD in one year� What is this option worth today ?

� Can be used as insurance, for example:� If we don’t want to risk receiving less than 1,3m USD(We need the money to fund a US company)

� Can be used for speculation, for example� If we believe that the USD will weaken

Page 14: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 13

Derivative products: a reminder

� Underlying asset:� Any asset sold/bought on a stock market or trading room� Example:Stocks Bonds Metals Grains ElectricityInterest-rates Indices Currencies Gas Oil

� "Spot" Transaction:� We buy or sell an underlying

� Example: Microsoft shares, USD

� Market price is fixed through supply and demand.

Page 15: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 14

Derivative products: a reminder

� Derivative product� Its price fluctuates as a function of the value of the underlying.� Requires either no or small initial investment

� Its settlement is made at a future date

� Derivative market growing rapidly since 1980s� Requires numerical and heavy mathematical methods� Requires strong computational power & IT infrastructure � Need to process market data & produce option premium and risk

� Now present in the bulk of financial activity� Derivative pricing

� Requires maths and IT

Page 16: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 15

Derivative products: discounting (1)� Today we put in a bank account N euro� Bank pays interest rate r once a year

� After 1 year we receive N·(1+r)� After 2 years we receive N·(1+r) ·(1+r)� …� After n years we receive N·(1+r)n

Page 17: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 16

Derivative products: discounting (2)� Today we put in a bank account N euro� Bank pays interest rate r two times in a year

� After 1 year we receive N·(1+r/2)·(1+r/2)� After 2 years we receive N·(1+r/2)4

� …� After n years we receive N·(1+r/2)2n

� If bank pays interest rate m times in a year for n years:� Return after n years: N·(1+r/m)mn

� If payment is very often : “continuously compounded interest rate”� In this case, the return after n years is: N·(1+r/m)nm= N·e nr

Page 18: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 17

Derivative products: discounting (3)

� This implies that an amount N today is equivalent to N·erT in T years

� Similarly, an amount N in T years is equivalent to N·e-rT today

� Exercise: Show that in the limit where m is very large we have (1+r/m)mn=er·n

� Remark: This is the same

Page 19: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 18

Derivative products: a reminder

� What is the “fair” value of an option?� Some intuition:

� More risk for the issuer, more expensive� Longer maturity, more expensive� More volatile market, more expensive

Page 20: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 19

Derivatives: finding the fair price� In the horse races there are two horses

� Horse A, wins 75% of races� Horse B, wins 25% of races

� The booker pays� 100€ if horse A wins� 200€ if horse B wins

� You want to buy the right to choose your horse after the end of the race

� How much is this option worth ?

Page 21: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 20

Derivatives: finding the fair price

� Fair price = average profit

� Average profit = 100 € · ¾ + 200 € · ¼ = 75 € + 50 € = 125 €

� Option’s fair price = 125 €

A (75%)

B (25%)

100 €

200 €

Horse race

Page 22: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 21

Derivatives: finding the fair price in stock options

� Central idea is similar:� Fair price ~ Average payoff� Simulate stock many times

� Record final value� Calculate payoff for that path� Average over all paths

� Discounting� This “average” price is valid at maturity� To calculate the equivalent price

today:� N € in a bank account today=

N · e rT € after T years� Inversely,

P at maturity = P · e-rT today

Option price =Discounted Average Payoff

Average taken over probabilities that eliminate all risk: Risk-neutral measure

Page 23: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 22

Derivative products: a reminder

� History� 6th century BC: Greek philosopher Thales of Miletus reports that options were used to secure a low price of olives in advance of harvest.

� Middle Ages: futures contracts to fix in advance the price ofimports of goods from Asia

� Holland 1637: The "Tulip Mania" one of the first speculativebubbles.

Page 24: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 23

Derivative products: a reminder� Two most simple and popular:

� Call = right to buyat an agreed future datea certain amount of the underlying assetat a price fixed today.

� Put = right to sellat an agreed future datea certain amount of the underlying assetat a price fixed today.

� Terminology� “Agreed future date” = Maturity of the option� “Amount of underlying” = Notional� “Price fixed today” = Strike

Page 25: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 24

Derivative products: a reminder� The payout of an option

� what the option would bring to its owner at maturity (T), � depends on price of the underlying at that time (ST).

� Long Call payout = max(0, ST- K)� Go « Long » a Call if you think the underlying will increase

K ST

Call

Long (the case of a buyer of a call)

Short (the case of a seller of a call)

payout = ST-K

Page 26: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 25

Derivative products: a reminder� Long Put payout = max(0, K- ST)

� Go « long » a Put if you think the underlying will go lower

� Calls and Puts are called vanillas� Vanilla flavour = simple.

K

ST

Put Long (the case for an owener of a Put)

Short (the case for a seller of a Put)

payout = K- ST

Page 27: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 26

Derivative products: a reminder� Barrier options

� Advantage: Cheaper than vanilla options� Disadvantage: More risky

K ST

At maturity (T)Regularbarrier

Reverse barrier

•Knock-In = the option is activated if the spot hits the barrier

•Knock-Out = the option is disactivated if the spot hits the barrier

Page 28: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 27

Derivative products: a reminder

� Price of an option

K ST

Call

payout = ST-K

At maturity (T)

Today (t<T)

StTime value

Page 29: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 28

Derivative products: a reminder

How option parameters affect the price. Examples:

� If spot goes up, call price goes up� The right to buy cheap shares is more expensive because underlying became more expensive

� If vol goes up, call price goes up� The right to buy cheap shares is more expensive because the underlying is more risky

Page 30: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 29

Derivative products: a reminder� How the option parameters affect the option price:

-+r

++

+-K

-+S

PutCall

Page 31: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 30

Derivative products: terminology� European Payout: payout is uniquely determined by the value of the underlying at maturity

� American Payout: payout is function of the evolution of the underlying during the lifetime of the option

� European exercise: the owner can only exercise the option atmaturity

� American exercise: the owner can exercise the option any time during the lifetime of the option

� European barrier: the barrier is active only at maturity� American barrier: the barrier is active continuously during the lifetime of the option

Page 32: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 31

Some derivative strategies

� Call spread(K1, K2) = Call(K1)- Call(K2)

=

� Cheaper than a simple call� Profit is limited to K2-K1 for spots>K2

+Call(K1)

-Call(K2)K1

K2

K1 K2

Page 33: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 32

Some derivative strategies

� Straddle(K) = Call(K) + Put(K)

� Expensive� If ST>K: gives the right to buy cheap� If ST<K: gives the right to sell expensive

K

CallPut

Page 34: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 33

Mathematical reminder

Page 35: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 34

The exponential function

-2 -1 1 2

1234567

ex = Exp(x)

ex is always positive

Page 36: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 35

Mathematical reminder

• e=2.71828182845904523536028747135…• ex = Exp(x), e0 = 1, e1 = e

∑∞

=

=++++++=0

5432

!...

!5!4!321

i

ix

ixxxxxxe

ex ~2.716ex=1+x+ x/2! + x/3! + x/4! + x/5!

ex ~2.708ex=1+x+ x/2! + x/3! + x/4!

ex ~2.66ex=1+x+ x/2! + x/3!

ex ~2.5ex=1+x+ x/2!

ex ~2ex=1+x

ex ~1ex=1

Page 37: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 36

Mathematical reminder

� LN(e)=1� eln(x) = x, or ln(ex) = x� Logarithm in base e � Defined only for x>0

...5432

)1(5432

++−+−=+yyyyyyLn

• The function LN (Neperian logarithm):

Page 38: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 37

Mathematical reminder� The derivative of a function: slope of a function at 1 point

Numerical approximation:

or∆

−∆+≈

)()()(' ooo

xfxfxf∆

∆ ∆

∆′−∆+′

≈′′ )()()( ooo

xfxfxf

∆∆−−∆+

≈2

)()()(' ooo

xfxfxf

2

)(2)()()(∆

−∆−+∆+≈′′

oooo

xfxfxfxf

• The 2nd derivative: curvature of a function in 1 pointNumerical approximation:

Page 39: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 38

Numerical differentiation� Expand the function around the neighbourhood of x

� Non-central difference derivative has error O(h)

� Central difference derivative has error O(h2)

� Numerical error: central difference < non-central difference

( ) ( ) ( ) ( ) ( ) L+′′′+′′⋅+′⋅+=+ hfhhfhhfhxfhxf 32

!31

21

( ) ( ) ( ) ( ) ( ) L+′′′−′′⋅+′⋅−=− hfhhfhhfhxfhxf 32

!31

21

44 344 21L

error

)(21)()()(

+′′⋅+′=−+ xfhxf

hxfhxf

44 344 21L

error

2 )(!31)(

2)()(

+′′′+′=−−+ xfhxf

hhxfhxf

Page 40: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 39

Some analytical derivatives

Page 41: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 40

Mathematical reminder� Integral of a function

Page 42: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 41

Mathematical reminder� Primitives of some commonly used functions

Page 43: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 42

Mathematical reminder� Numerical integration of a function

Method of lowerrectangles

Method of upperrectangles

Trapezoidal method

Page 44: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 43

Mathematical reminder

� Taylor series: approximating a function around a point x0

� Converts a complex function into a simple power-series

� Examples� exp(x) around x0=0:

� cos(x) around x0=0:

� around x0=0:

( ) ( ) ( ) ( ) ( ) ( ) ( ) ( )0)(00

200000 !

121 xfxx

nxfxxxfxxxfxxf nn−++′′⋅−+′⋅−+=+ L

L+++= 2

211 xxex

L+−= 2

211)cos( xx

x−11

L+++=−

2111 xxx

Page 45: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 44

Taylor-series approximation to ATM options

� Black-Scholes formula for call options at the money (where S=Ke-rT)

� Approximate cumulative normal N(x) for small x=σ√T:

� This gives the approximate call price:

T

TrKSd

σ

σ )221()/ln( 0 ±+

=±)()( −+ ⋅−⋅= dNSdNSC

( ) ( ) ( ) ( )

)(21

21

)(02100

2

32

xOx

xONxNxNxN

++=

+′′⋅+′⋅+=

π

TSC σπ

⋅=21

Page 46: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 45

Root finding: bisection method� Consider portfolio of options

� Find Vol that makes portfolio value equal to 0� Choose two points xmin, xmax� Take the middle point: xmid� If f(xmid)<0

� xmin=xmid� xmax=xmax� Repeat

� If f(xmid)>0� xmax=xmid� xmin=xmin� Repeat

� Here: function increases with variable

� Similar when function is decreasing

Page 47: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 46

Interpolation methods: Linear

� The line connecting two points (x1,y1) and (x2,y2) is

� Check:� If x=x1 then y=y1� If x=x2 then y=y2

( ) 1121

21 yxxxxyyy +−⋅

−−

=

Page 48: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 47

Interpolation methods: Cubic spline (1)

� n data points {(x1,y1),…, ( xn,yn)}

� Fit a piecewise function S(x) of the form

� where si(x) cubic polynomials

[ ][ ]

[ ]

∈∈

=

−− nnn xxxxs

xxxxsxxxxs

xS

,if)(

,if)(,if)(

)(

11

322

211

iiiiiiii dxxcxxbxxaxs +−⋅+−⋅+−⋅= )()()()( 23

Page 49: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 48

Interpolation methods: Cubic spline (2)

� Require:� For i=1,…,n (for all points)

� For i=2,…,n-1 (for all interior points)

� This gives: n+3(n-2) equations, 4(n-1) unknowns� Remaining 2 unknowns fixed by boundary conditions:

� “natural spline”� “clamped spline”� Other choices are possible

ii yxs =)(

)()()()()()(

1

1

1

iiii

iiii

iiii

xsxsxsxsxsxs

′′=′′′=′

=

0)()( 1 =′′=′′ nxSxSvxSuxS n =′=′ )()( 1

Page 50: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 49

Differentiation of an integral

� If the differentiation variable lies in the integration limits then the following formula is useful

� Example: Second derivative of a market-quoted call option gives the market-implied terminal density of the spot

( )( )

( )

( ) ( )( )

( )

∫∫ ⋅∂

∂+

∂∂

⋅−∂∂

⋅=⋅∂∂ xa

xb

xa

xb

dsx

xsFxbxbsF

xaxasFdsxsF

x),()(,)(,,

[ ]

)(DF

)(DF

)()(DF)0,max(EDF

mkt2

mkt2

mktmkt

mktmkt

KPKC

SPdSK

C

KSSPdSKSC

KTT

KTTTT

⋅=∂

⋅⋅−=∂

−⋅⋅⋅=−⋅=

∫∞

Page 51: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 50

Random variables and stochastic processes

Basic notions

Page 52: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 51

Random variables and stochastic processes

� Random variable� a variable whose value is determined by the outcome of an experiment� We don’t know its value only how likely it is

� Discrete random variable: � Can take on only certain separated (discrete) values� Example: the result of throwing a dice.

The probability of every outcome is 1/6

� Continuous random variable: � Can take on any real value from a range� Example: the price of an stock. The probability that the price is within a

certain interval depends on the distribution of the random variable.

� Stochastic process� represents the evolution in time of a random variable

Page 53: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 52

Properties of random variables

� Probability of an event: 0≤Prob(event) ≤1� Prob=0: certainty that event will not happen� Prob=1: certainty that event will happen

� Normalisation: Prob(ev1)+… +Prob(evN) =1

� Prob(ev1 OR ev2) = Prob(ev1) + Prob(ev2) � Example: probability that a dice is either “1” or “2” = 1/6 + 1/6

� If ev1 is independent of ev2 then: Prob(ev1 AND ev2) = Prob(ev1) · Prob(ev2)� Example: Prob that two dice are both “1” = 1/6 · 1/6

Page 54: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 53

Uncorrelated vs independent r.v.

� Two sets of random variables xi, yi are uncorrelated if

� Two random variables x, y are independent if

� If xi, yi are independent then they are uncorrelated (converse not true!)

( )( )[ ] 0E =−− yyxx

( ) ( ) ( )yxx,y ProbProbProb ⋅=

Page 55: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 54

Random variables� Characterised by:

� The probability density distribution function f(x)� Prob that event x will happen

� The cumulative distribution function� Prob that the outcome of the experiment will be less than x

� The mathematical expectation (mean)� The average by repeating the experiment many times

� The moments (order n) :� First moment is the mean� Second moment is related to the variance� Third moment is related to the skewness� ...

∫∞−

⋅=x

dxxfxF )()(

[ ] ∫∞

∞−

⋅⋅== dxxfxx )(Eµ

∫∞

∞−

⋅⋅= dxxfxXM nn )()(

Page 56: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 55

a b

∫ ⋅=∈b

a

dxxfbaXP )(]),[(

Interpretation of distribution function� The surface under the curve between a and b is the probability that the value of the random variable is between aand b :

Page 57: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 56

Central moments

� The central moments (of order n): remove the mean

� The variance (n=2), characterises the amplituded around the mean:

� Standard Deviation = √ variance � In finance, the standard deviation is the volatility

∫∞

∞−

⋅⋅−= dxxfxXCM nn )()()( µ

( )[ ] [ ] 22222 )()()( σµµµ =−=−=−= ∫∞

∞−

xExEdxxfxxV

Page 58: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 57

�Skewness (n=3), describes the asymmetry:

�Kurtosis (n=4), describes the effects of «fat» tails:

<3 : distribution platykurtic>3 : distribution leptokurtic

3

3 )()()(

σ

µγ

∫∞

∞−

−=

dxxfxX

4

4 )()()(

σ

µδ

∫∞

∞−

−=

dxxfxX 3)lawnormal( =δ

Central moments

Page 59: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 58

Skewness & kurtosisAsymmetry: skewness Fat tails: kurtosis

Page 60: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 59

Meaning of “fat tails”� Represents a high probability of extreme events.

� Catastrophic market crashes (1927, 1987)� Money lost is more than ½ of all money lost in the next 20 years

� Catastrophic earthquakes (Chile 1960 9.5R, Sumatra 2004 9.1R)� Energy released is more than ½ of total energy released by crust

� Such events are characterised by � Very low probability � Very high impact

Page 61: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 60

Examples of “fat tails”� Fat tails means that the extreme-event probability is low, but much higher than we expect !

Page 62: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 61

Variance of a distribution

� Controls size of deviations away from the mean

Page 63: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 62

Variance of a distribution

� Small variance = large certainty

� All distributions look the same when variance 0

� Graph opposite:� Lognormal vs Normal� variance=0.01

� Which is which ?

Page 64: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 63

Distribution vs cumulative� Some important properties

� Definition or and

� Distribution function is normalized:

� Cumulative is between 0 and 1, always increasing

dXXdFXf )()( =

0)( =−∞F

1)( =+∞F

∫∞−

=X

dUUfXF )()(

f(x) F(x)

]1,0[)( ∈XF

∫∞

∞−

=⋅ 1)(xfdx

Page 65: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 64

Some important properties� Integral of the distribution: probability that the randomvariable will be less than a certain value

� Probability that the random variable is between two values:

∫∞−

=x

dssfxF )()(

)()()()( BXAPdxxfAFBFB

A

≤≤=⋅=− ∫

Page 66: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 65

Sampling from a distribution

� This is an important application of cumulative functions� Problem: generate random variables from specific distribution� Matlab, Excel,… provide the uniform random number generator� This selects uniformly a number between 0 and 1� We use the inverse cumulative function of the distribution

Pseudo code• Draw a uniform random number Z in [0,1]• Pass it through the InvCum of the required distribution (e.g. normal)•Result is a number sampled from the required distribution•Example: + ·Z ~ N( , 2)

Page 67: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 66

Use of distributions in finance

� Financial derivatives require us to calculate theexpectation of a function of a random variable

� Example: a Call option

where (ST) is the distribution function of the final spot

∫ ⋅⋅== dxxXgXgE )()()]([derivative ϕ

( ) ( )∫+∞

⋅⋅−=−=0

)(0,max]0,[maxCall TTTT dSSKSKSE ϕ

Page 68: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 67

Normal Distribution� Normal Distribution N(µ,σ)

� Special case: µ = 0 and σ = 1 denoted N(0,1)

µ = mean

σ= standard deviation

Page 69: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 68

Normal Distribution

Exercise :

� What are (i) the mean and (ii) the standard deviation of the index EUROSTOXX50, if we suppose that it follows a law a+bX whereX follows a centered normal distribution (a and b are 2 constants) ?

� Calculate the mathematical expectation of eαX where X follows a centered normal distribution

� Calculate the expectation of S=S0e(r-q-σ²/2)T+xσ √T where X follows a centered normal distribution

Page 70: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 69

Log-normal Distribution

� Very important in finance

� If X follows a normal law X~N(µ, σ),

� Then Y=eX is distributed log-normally.

� Relations between the function of X and Y, related by X = f(Y):

YYfYffYf

YXXfYfXXfdYYf

xy

xyxy

∂∂

=

∂∂

=⇔=

)())(()(

)()(d)()(Exercise: recover the Log-Normal distribution law

Page 71: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 70

Log-normal Distribution

e21),;( ²2

)²-(x-σµ

πσσµ =Xf

x

Starting from a normal distribution for X

We find the log-normal law for Y=eX

e21),;( ²2

)²-(ln(Y)-σ

µ

πσσµ

YYf

y=

Exercise: Calculate the mean and variance of a log-normal function with parameters ,

Page 72: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 71

Central Limit Theorem

� This theorem is the reason why normal distributions are present so often!

� The sum of N independent, identically distributed random numbers is normally distributed

� The N numbers do not have to be normally distributed! � N numbers, x1,…, xN each with mean m, variance s� The random variable x1+ x2 …+ xN follows

( )( )

2

2

2N1 2

1xxyProb NsmNy

esN

⋅−−

⋅=++=π

L

Page 73: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 72

Central Limit Theorem at work� For N = 5, 20, 100

� Sample N random variables from some distribution (here lognormal) and sum them: x1+…+ xN

� For each N, repeat many times and plot histogram� Observations:

� For small N, only central region looks normally distributed ! � For large N, the sum resembles the normal distribution very well

Page 74: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 73

Sum of lognormal variables

� Because of the Central Limit Theorem� A sum of normal variables is normal� A sum of lognormal variables is not lognormal

� In finance however we often approximate a sum of lognormal variables by a lognormal

Page 75: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 74

Commutation of integration & differentiation

� The order of integration and differentiation can be interchanged

� Example: the derivative of a call with respect to strike

� since the expectation is simply an integral

( ) ( )∫∫ ∂∂

⋅=⋅∂∂ zxf

xdzzxfdz

x,,

( )[ ] ( )

−∂∂

=−∂∂ 0,maxE0,maxE KS

KKS

K TT

( )[ ] ( )0,max)(0,maxE0

KSSdSKS TTTT −⋅⋅=− ∫∞

ϕ

Page 76: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 75

Commutation of integration & differentiation

� We can use this trick to compute moments of a distribution� Example, 2nd moment of a central normal distribution:

( )

( ) ( )

2

21

1

22

1

2

2

2

1

1

221

1

221

lim22lim-

21

2lim

22

lim2

22

22

22

σ

λλ

σλσ

λ

σλ

λσπλ

σσπλσπ

λλ

λσ

λ

λσ

λ

σ

=

∂∂

−=

∂∂

=

−⋅⋅⋅∂∂

=

−⋅

∂∂

⋅=⋅⋅

→→

∞−

∞−

⋅−

∞−

∫∫

x

xx

edx

edxxedx

Page 77: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 76

Jensen’s inequality (1)� Which is bigger?

� Denote and Taylor expand f(x) around x0

� Apply the expectation

� If then

� If then

[ ]( ) ( )[ ]xfxf EE?<

[ ]xx E0 =

L+′′−+′−+= )()(21)()()()( 0

20000 xfxxxfxxxfxf

[ ][ ]( )

[ ][ ]

[ ] L43421321

+′′−+′−+==−==

)()(E21)()(E)()(E 0

200

0E

0

)E

0

0

xfxxxfxxxfxfxxxf

0)( >′′ xf ( )[ ] [ ]( )xfxf EE >

0)( <′′ xf ( )[ ] [ ]( )xfxf EE <

Page 78: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 77

Jensen’s inequality (2)

� Example: Is an “Asian” option cheaper than Vanilla?� Asian: spot of payoff is average over various spots

� Since f(x)=max(x,0) is a convex function (with f’’(x)>0) then

� Asian < sum of vanillas

[ ]( )0,Emax0,1maxAsian spots1

KSKSN

N

ii −=

−= ∑

=

( ) ( )[ ]0,maxE0,max1 vanillasofsum spots1

KSKSN

N

ii −=−= ∑

=

Page 79: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 78

Jensen’s inequality (3)

� Exercise: Using Jensen’s inequality show that the call price E[max(S-K,0)] cannot be less than S-K

Page 80: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 79

Relation between mean and variance

� Variance in terms of simple expectations Var[x] = E[x2]-E2[x]

� Derivation:

( ) [ ]( )[ ][ ] [ ][ ]

[ ] [ ] [ ] [ ][ ] [ ]XX

XXXXXXXX

XXX

22

22

22

2

EEEEE2E

EE2EEEVar

−=

+⋅⋅−=

+⋅⋅−=

−=

Page 81: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 80

Basic notions of VBA Excel

Page 82: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 81

Basic notions of VBA Excel� Enter the VBA environment : Alt+F11� Write a function in a MODULE

Page 83: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 82

Basic notions of VBA Excel

� HeaderOption ExplicitOption Base 1

� Create a VBA functionFunction GetDelta(ByVal a As Integer, ByVal b As Integer, ByVal c As Integer)Dim delta As Longdelta = b * b - 4 * a * cGetDelta = delta

End Function

� Declare a variable Dim nom_variable As type_variable (double, long, string, Range…)

Page 84: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 83

Basic notions of VBA Excel

� Create a VBA macroSub SommeDeuxValeurs()'declarationDim nb1 As IntegerDim nb2 As IntegerDim somme As Long'Lecturenb1 = InputBox("nbre 1")nb2 = InputBox("nbre 2")'Traitementsomme = nb1 + nb2'AffichageMsgBox "La somme est " & somme

End Sub

Page 85: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 84

Basic notions of VBA Excel

� Loops “For ... To ... Next”Function GetFactoriel(ByVal a As Integer)Dim fact As LongDim i As Integerfact = 1For i = 1 To afact = fact * i

Next iGetFactoriel = fact

End Function

Page 86: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 85

Basic notions of VBA Excel

� Tests “If ... Then ... Else”Function EstPositif(ByVal a As Double)If a > 0 ThenEstPositif = 1

ElseIf a < 0 ThenEstPositif = -1

ElseEstPositif = 0

End IfEnd Function

Page 87: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 86

Basic notions of VBA Excel

� Some useful functions

� Histogram of a distribution:� Function « frequence » in Excel

In Excel

•ALEA()

•LOI.NORMALE.STANDARD( x )

•LOI.NORMALE.INVERSE(x ;0;1)

In VBA Excel

• Rnd

•Application.WorksheetFunction.NormSDist( x )

•Application.WorksheetFunction.NormSInv( x )

Page 88: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 87

Numerical methods in finance:some background history

Page 89: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 88

Brownian Motion

� Robert Brown (botanist)� Observed motion of pollen

particles suspended in water (1827).

Page 90: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 89

Stochastic methods in finance

� Louis Bachelier (1870 – 1946)� Considered as the founding fatherof financial mathematics.

� Was the first to have appliedmathematical models to the analysis of financial markets

� Stock prices evolve according to Brownian motion

Page 91: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 90

Models for Brownian Motion

� Thorvald N. Thiele (1880), was the first to propose a mathematical theory to explainBrownian motion� Danish astronomer� Founder of an insurance company

� Louis Bachelier (1900) used Brownian motion in his thesis « La théorie de la spéculation » to describe stock prices

� Albert Einstein (1905) makes a statisticaltheory that explains Brownian motion and allows predictions

Random Walk

Page 92: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 91

Why Brownian motion in finance?

� Paths resemble stock market indices � Problem: Brownian motion can turn negative !

Page 93: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 92

Brownian motion (Wiener process)

� Brownian motion is stochastic process (=sequence of r.v.)� W(0), W(1), W(2), ...

� Main properties:� W(0) = 0� The increments W(2)-W(1), W(3)-W(2),...

are independent of each other� The increments W(t)-W(s) are normally distributed N(0,√(t-s) )

� Property 3 implies

� Property 2 implies

[ ] [ ] stWWWW stst −=−=− Varand0E

( )( )[ ] 0E =−− uvst WWWW

Page 94: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 93

Useful properties

� A normal random variable X with mean m and variance v can be written as

� If x,y are constants

( )1,0~ with NWWvmX ⋅+=

[ ] [ ][ ] [ ]

[ ] [ ] [ ][ ] [ ] [ ] [ ][ ] [ ] [ ] [ ]ZWWZW,Z

W,ZxyZyWxyZxWWxxWyxW

yWxyxWWxxW

EEECovCov2VarVarVar

VarVarVarEE

EE

22

2

−=⋅++=+

==+

+=+=

Page 95: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 94

Brownian motion: an example� Bob finishes his job at 5pm and before going home he makes a stop at the bar

� There he drinks a bit more than he should

� He leaves the bar at 8pm and usually (after some zig-zags) arrives home at midnight

� His home is just 500m away

� This means he proceeds towards home with an average speed of 0.5/4 = 0.125 km/hr

This is an example of a random walk

Page 96: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 95

Brownian motion: an example

� Notation: Xt position at time tT=24hr t0=21hr Xt0=X0=0

� Random-walk model:� Position at next step Xt+1 given

position at previous step Xt

� Randomness comes through the increment Wt ~N(0,t)

� What is the meaning of and ?

� Bob takes first step:

� in this model is average speed� = 0.125 km/hr

� Small : random walk is confined� Large : random walk can make big jumps

ttt WtXX ∆⋅+∆⋅+=+ σµ1

ttt WtXX ⋅+⋅+= σµ0

[ ] tX t ⋅= µE

[ ] [ ]

[ ] tXtt

WtWtX

t

ttt

⋅+=

⋅+=

⋅++=

22

222

22222

E

2EE

σ

σµ

σµσµ

[ ]tXtVar12 =σ

Page 97: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 96

Brownian motion: an example

� After several steps Bob arrives home

� The model describes his random walk as

� In the limit t 0:

� We are facing a problem:

� What is the meaning of an integral over a stochastic differential ?

� Stochastic calculus

∑∑∑

∑∑∑

=+

==

=+

=+

=

∆⋅+∆⋅+=

−⋅+−⋅+=

N

ii

N

ii

N

it

N

iii

N

iii

N

itT

WtX

WWttXX

i

i

01

00

01

01

0)()(

σµ

σµ

∫∫∑ ⋅+⋅+==

T

tt

T

t

N

itT dWdtXXi

000

σµ

Page 98: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 97

� Kiyoshi Itô (1940s) develops stochastic calculus

� Itô integral :

with stochastic differential dW

� Itô’s lemma: differentiation of stochastic functions

� Robert Merton (1969) introduces stochastic calculusin finance to explain the price of financial products

� S ~ eW(t) >0 : The value of an underlying staysalways positive!

Stochastic calculus in mathematical finance

∫t

sdWsH0

)()(

Page 99: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 98

� Robert Merton, Fisher Black & Myron Scholespublished the famous work on option pricing (1973)

� The model allows to derive analytic expression for the fairprice of call and put options

� A significant contribution to the growth of derivatives� Merton and Scholes receive the Nobel price of economics1997 (F. Black had died in 1995)

Option pricing with stochastic calculus

Page 100: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 99

Stochastic integral (1)

� Definition:

� A useful property: The mean of a stochastic integral is zero

� Derivation

( )∫ ∑=

+∞→−⋅=⋅

b

a

N

itttNtt WWWgdWWg

01)(lim)(

( ) ( )[ ]

00)(Elim

E)(Elim)(limE

0

100

1

=⋅

=

−⋅

=

−⋅

∑∑

=∞→

+=

∞→=

+∞→

N

itN

tt

N

itN

N

itttN

Wg

WWWgWWWg Independents increments

Mean of N(0,1)=0

Page 101: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 100

Stochastic integral (2)

� Property

� Derivation

∫∫ =

T

t

T

tt dtWgdWWg0

2

2

0

)()(E

( ) ( )

( )

=

=

−⋅=

=

−⋅−⋅⋅=

∑∑∫

=+∞→

= =++∞→

T

t

n

iiiin

n

i

n

jjjiijin

T

tt

dtWg

ttWg

WWWWWgWgdWWg

0

2

11

2

1 111

2

0

)(E

)(Elim

)()(Elim)(ETerms with i not equal to j have zero expectation

dW2=dt

Page 102: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 101

Exercises

� Show that E[(Wt-Ws)2] = t-s

� Show that E[Wt·Ws] = min(t,s)

Page 103: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 102

How to model Brownian motion? (1)

� Choose a starting value of the random walk: e.g. at t=0 we have W0

For i=1 To NWt+ t = Wt + n · √∆t

Next i

� N is the number of steps in the random walk� t = Total time of walk / N

� n =normal random variable N(0,1)� VBA: n=Application.NormSInv(rnd), rnd=uniform random variable in [0,1]� n·√ t= normal random variable N(0, t)

Page 104: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 103

How to model Brownian motion? (2)

� What will happen if we modify the previous code to:

For i=1 To N Wt+ t = Wt + v · n · √∆t

Next i

� What is the effect of the variable v?� It multiplies the random variable n

� If v is large, the random walk will show big fluctuations� If v is small, the random walk will show small fluctuations

� For this reason we interpret v as the volatility: it controls the size of fluctuations in the random walk

Page 105: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 104

How to model Brownian motion? (3)

� What will happen if we modify the previous code to:

For i=1 To N Wt+ t = Wt + v · n · √∆t + d · t

Next i

� The new term is independent of the random variables � It always adds d · t to the previous position

� If d>0 the random walk will drift (on average) to positive values� If d<0 the random walk will drift (on average) to negative values

� Therefore we interpret d as the drift of the random walk

Page 106: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 105

Variance of Brownian motion� We defined a Brownian motion as described by Wt which is a random variable normally distributed of zero mean and variance t

� Why is the variance of Wt equal to t ?

� At t=0: W(0)=W0� At t=1: W(1)=W0 + dW1� At t=2: W(2)=W0 + dW1 + dW2� ....� At t=N: W(N)=W0 + dW1 + dW2+…+ dWN

� At time step N, the position of the random walker is a sum of N independent normally distributed random variables

� Central limit theorem: variance of W(N) is proportional to N

Page 107: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 106

The Black & Scholes model

Page 108: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 107

The Black-Scholes model

Cartoon by S Harris

Page 109: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 108

The Black & Scholes model� Simple brownian motion

� dS = · dW

� Black & Scholes model� dS = S · · dt + S · · dW

� S : value of underlying� stock, foreign exchange rate, etc

� µ : drift� the price of risk-free interest rate – annualised dividend: r-q (Equity) � Domestic minus foreign interest risk-free rates: rdom-rfor (Forex)

� : volatility (annualised)

� t : time (expressed in years)

� W: Wiener process (Brownian)

Page 110: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 109

How to model the B&S stochastic eqn?

Black-Scholes model the underlying asdS = S · · dt + S · · dW

This means St+ t - St = S t · · t + St · · n · √∆t

Here is a pseudo-code:

For i=1 To N Si+1 = Si · (1 + · t + ·n·√(ti+1-ti) )

Next i

where n·√ t= normal random variable N(0, t)

Page 111: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 110

What is the difference with Brownian motion?� Brownian motion

� St can be negative

� Geometric Brownian motion (Black & Scholes)

� St is strictly positive

WdSdtSrSd σ+=

WddtrSd σ+=

Page 112: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 111

Exercise

� Can we model:

� Interest rates with Brownian motion?

� Bond prices with Brownian motion?

Page 113: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 112

Itô’s Lemma� Itô’s process:

� x solution of dx=a(x,t) dt + b(x,t) dW� Consider a function G(x,t):

� dx² = [a(x,t) dt + b(x,t) dW]2= ??� Some properties in differential stochastic calculus:

� dt . dt = 0� dW . dt = 0� dW . dW=dt

22

2

21),( dx

xGdt

tGdx

xGtxdG

∂∂

+∂∂

+∂∂

=Additional term fromstochastic calculus

dWbxGdtb

xG

tGa

xGtxdG ⋅

∂∂

+

∂∂

+∂∂

+∂∂

= 22

2

21),(

Page 114: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 113

Itô’s Lemma in two dimensions

dxdyyx

GdyyGdx

xGdy

xGdx

xGdt

tGtyxdG

∂∂∂

+∂∂

+∂∂

+∂∂

+∂∂

+∂∂

=2

22

22

2

2

21

21),,(

� Ito’s lemma in two dimensions (x and y are stochastic)

� Example in finance:� Two coupled stochastic processes used to describe the underlying� Spot and volatility are both stochastic� Spot and interest-rates are both stochastic

� Exercise: Calculate the stochastic differential of Z=X·Y and Z=X/Y

Page 115: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 114

Itô’s Lemma� Exercise:Black-ScholesWhat is the differential of ln(S) ?

What is the value of S(T) ?

WdSdtSSd σµ +=

?)(ln =Sd

Page 116: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 115

Itô’s Lemma

� Exercise:

� If the spot St follows a lognormal process what is the process followed by Xt=1/St ?

� Application: St is the EURUSD exchange rate while Xt is the USDEUR rate.

Page 117: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 116

The Black & Scholes model

WddtSSd σµ +=

dt

µ

SSd

dtµ

dWσ

Differential equation of Black & Scholes

Random variable, distributed according to a normal distribution of 0 mean & variance t

Solution of the differential equation of Black & Scholes

)(2²

)0()(tWt

eStSσσµ +

=

Itô calculus

}}

Page 118: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 117

Numerical solution of BS stoch. eqn.

� Stochastic differential equation

� For i=1… N

� Next i

� normal random variable

� Result: sequence of spots for all times

� Solution of stochastic differential equation

� For i=1…N

� Next i

� normal random variable

� Result: sequence of spot for all times

tttt WdSdtSSd σµ +=

( )iiii tttt xtSSS ⋅+∆⋅⋅+=

+σµ

1

,...,,210 ttt SSS

( ) ( ) iiiii

ii

xtttttt eSS ⋅−+−⋅− ++

+⋅= 11

221

1

σσµ

,...,,210 ttt SSS

ix ix

SAME

Page 119: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 118

Absence of arbitrage� Absence of Arbitrage (AOA)

� Normally there can be no profit without taking a risk. � However, if an opportunity for riskless profit arises, the market reacts immediately, and soon the opportunity disappears.

� It is the basis of the Black-Scholes model � ...and of most other derivative models.

� This condition allows us to determine the expectation of the underlying

� An example …

Page 120: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 119

No-arbitrage (1)� EURUSD = 1.3 = So (1 EUR equals 1.3 USD)

� 1 EUR = underlying, USD payment currency� I start with no money� I borrow 1 EUR from a European bank, with 1 year maturity, interest rate q. In one year I must pay back eqT (=1 + q T + …)

� I convert today my EUR to USD, I receive So USD� I enter into a Forward contract (for free), allowing me to change USD into EUR within a year, at a fixed rate Fo.

� I deposit So USD into an american bank with interest rate r. After 1 year I receive: So erT

� After 1 year, I will have gained (without taking any risk):- eqT (money to pay back in european bank) + So erT / Fo (money I receive from american bank in EUR)

� AOA implies that the forward contract has value Fo = So e(r-q)T

Page 121: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 120

No-arbitrage (2)� This allows us to fix the variable that appeared in

� Since we found that the forward rate F must be

� And because it represents the expected spot

� Therefore

µtttt WdSdtSSd σµ +=

( )TqrT eSF −= 0

[ ] ( ) [ ] TxTTTT eSeeSSF ⋅− ⋅=⋅== µσσµ

00 EE2

21

qr −=µ

Page 122: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 121

Derivation of the Black-Scholes PDE� Composition of portfolio:

� 1 option of value V(S,t)� An amount of the underlying

� We adjust the amount ∆ such that the portfolio is not sensitive to risk (suchas small random movements of the underlying)

� Putting it together, the portfolio P consists of:� P = V + ∆ S

� The variation of the portfolio after an very small amount of time is� dP = dV + ∆ dSWith� dS = (r – q) S dt + σ S dw (differential equation of B&S)

� ( )22

2

21 dS

SVdS

SVdt

tVdV

∂∂

⋅+∂∂

+∂∂

=

Classic differentialcalculus

Additional term in stochasticdifferential calculus

Page 123: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 122

Derivation of the Black-Scholes PDE� Some useful rules of the stochastic differential calculus

� dt · dt = 0� dW · dt = 0� dW · dW=dt

� (dS)² = ?� dS · dS = [µ S dt + σ S dw] · [µ S dt + σ S dw]

= σ² S² dt• We arrive at the variation of our portfolio P:

� dSdtSSVdS

SVdt

tVdP ∆+

∂∂

⋅+∂∂

+∂∂

= 222

2

21 σ

Page 124: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 123

Derivation of the Black-Scholes PDE

• We suppress all sources of risk (risk=randomness) of the underlying (dS):� � « delta » of an option

• We arrive at the variation of the portfolio P� The remaining portfolio contains more sources of risk: it must evolve as money placed into a "safe" savings account with interest rate r

dSdtSSVdS

SVdt

tVdP ∆+

∂∂

⋅+∂∂

+∂∂

= 222

2

21 σ

SV

SV

∂∂

−=∆⇔=∆+∂∂ 0

dtSSVVrdtPrdtS

SVdt

tVdP ⋅

∂∂

−⋅=⋅⋅=∂∂

⋅+∂∂

= )(21 22

2

2

σ

PDE of Black-Scholes

Page 125: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 124

The three forms of the B&S model

� Stochastic differential equation

� Solution of the stochastic differential equation

� Partial differential equation governing the evolution of the price

of a derivative (pricing equation)

WddtrSSd σ+=

)(2²

)0()(tWtr

eStSσσ

+

=

021

2

222 =−

∂∂

+∂∂

+∂∂ rV

SVrS

SVS

tV σ

Page 126: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 125

� Call and Put options

Solution of the Black & Scholes model

TdT

TqrKSd

TTqrKSd

dNeSdNeKpdNeKdNeSc

qTrT

rTqT

σσ

σ

σσ

−=−−+

=

+−+=

−−−=

−=−−

−−

10

2

01

102

210

)2/2()/ln(

)2/2()/ln(where

)()(

)()(

Page 127: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 126

Derivation of the Call price for the Black-Scholes model� At maturity, the call value is g(ST) = max(0,ST-K) (ST-K)+� Call price: expectation of the payoff, discounted to the value of today

� S(ST): Distribution function of the random variable ST� The assumed process for the random variable ST

has solution

� where X a normal random variable (mean 0, variance 1)

[ ] TTTSrT

TrT dSSgSeSgEe ⋅⋅== ∫

+∞

∞−

−− )()()(Call ϕ

WdSdtSSd σµ +=

2

21

21)(

X

XeX

−=

πϕ

[ ] dXXSgXXSgECalleTXT

rT ⋅⋅==⋅ ∫+∞

∞−

))(()())(( ϕ

ST: spot

K: strikee-rT: Discount factor

( ) XTTT eSS σσµ +−⋅=

221

0

Page 128: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 127

[ ] ( )[ ] dXKeSeXSgECalle XTTX

TrT ⋅−⋅⋅==⋅

+

+⋅−+∞

∞−

∫ σσµ

π2

25.0

021

21))((

( )( )

T

TSK

XKeS XTT

σ

σµσσµ

2

05.00

5.0ln

02

⋅−−

>⇔>−⋅ +⋅−

κ( )[ ]

( )dXKedXe

eS

dXKeSeCalle

XXTXT

XTTXrT

.21

2

21

222

22

21

215.0

0

5.00

21

∫∫

∫∞+

−∞+

+−⋅−

+

+⋅−+∞

⋅−⋅⋅⋅

=

⋅−⋅⋅=⋅

κκ

σσµ

σσµ

κ

ππ

π

A B

Derivation of Black-Scholes call price

Page 129: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 128

[ ]

[ ] )()(1

)()(.21 2

21

κκ

κϕπ κκ

−⋅=−⋅=

−+∞⋅=⋅⋅=⋅= ∫∫+∞+∞

NKNK

NNKdXKdXKeBX

X

The easy part:

The more difficult part:( )

∫∞+

+−⋅−

⋅⋅⋅

σσµ

πdXe

eSA

XTXT 2

2

215.0

0

2

We would like to bring this to an integral of the form2

21

dUz

eU−

∞−∫

« Complete the square » TUTTXXTX

U

221

212

212

212

21 2

2

σσσσ +−=+−−=+−

4434421

[ ][ ] [ ])()(1

)()(2

00

021

02

κσσκ

σκπ

µµ

µ

σκ

µ

−⋅⋅=−−⋅⋅=

−−+∞⋅⋅=⋅⋅⋅

= ∫+∞

TNeSTNeS

TNNeSdUeeS

A

TT

T

T

UT

Most common way to do this is:

Page 130: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 129

Finaly the value of the Call:

[ ] )()(0

κκσ −⋅−−⋅⋅=−⋅= ⋅−⋅−− NKeTNeSBAeCall TrTqrT

Equivalently, in the standard notation:

)()(210

dNKedNeSCall TrTq ⋅−⋅⋅= ⋅−⋅−

TdT

TqrKSd

TTqrKSTd

σσ

σκ

σσκσ

−=−−+

=−=

+−+=−=

10

2

01

)2/2()/ln(

)2/2()/ln(where

Exercise: calculate the price of a « digital » option (it pays at maturity 1 unit of underlying if ST>K)

Page 131: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 130

Interpretation of the Black-Scholes formula

� N(d2): probability that spot finishes in the money

� N(d1): measures how far in the money the spot is expected to be if it finishes in the money

� Call price: value of receiving the stock in the event of exerciseminus cost of paying the strike price

)()( 21 dNKedNSeC TrTq ⋅⋅−⋅⋅= ⋅−⋅−

Page 132: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 131

Interpretation of Black-Scholes formula

� What does N(d2) mean?� To answer this: calculate probability that spot finishes in the money:

[ ] ( )

)()()(

Indicator)(

Indicator)(Prob

2

21

0

2

2

2

dNxdxxdx

KeSxdx

KSxdxKS

d

d

xTTr

TT

=⋅=⋅=

>⋅⋅=

>⋅⋅=>

∫∫

∞−

∞−

+

∞−

ϕϕ

ϕ

ϕ

σσ

≤>

=0 xif00 xif1

x)Indicator( on distributiNormal21)(

2

21

==− x

exπ

ϕwhere

Page 133: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 132

Digital: An important market quote

� A digital option pays at maturity

� This means the value today is (see previous computation)

� Digital gives probability spot finishes in the money

≤>

=>KSKS

KST

TT if0

if1)Indicator(

K

1

( )[ ] ( )2IndicatorEDigital dNeKSe rTT

rT −− =>=

Page 134: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 133

Black-Scholes and risk-neutrality

� The Black-Scholes formula

depends on the Spot, Volatility, Interest-rates and time.� None of these parameters involves the risk-preference of the investor.

� Therefore, the B&S formula does not depend on any assumption about the risk-preferences of the investors

)()( 21 dNKedNSeC TrTq ⋅⋅−⋅⋅= ⋅−⋅−

Page 135: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 134

Assumptions of the B&S model

� More Important� Underlying evolves according to a lognormal process� Volatility ( size of fluctuations) is constant and known� No arbitrage opportunities exist

� Less important� No dividends� No transaction costs� Risk-free rates are constant

Page 136: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 135

How realistic are the assumptions of the B&S model ?

� In real markets the size of the fluctuations is not constant� The underlying can make big jumps on some economic news� Calculating the volatility is not trivial� The process of the underlying is typically not lognormal� Interest rates are not constant

� All assumptions are wrong in reality !� They are made only to simplify the calculations

Page 137: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 136

Comparison with a earlier model: Bachelier

� Black-Scholes (1973)� Assumptions

� Result:

ttt WdSSd σ=

� Bachelier (1900)� Assumptions

� Result:

tt WdSSd 0σ=tWTT

t eSS ⋅⋅+−⋅= σσ 221

0( )tt WSS ⋅+⋅= σ10

( )( ) ( )

+⋅−

+⋅=

−⋅⋅= ∫ +−

TTNK

TTNS

KeSxdx

kS

kS

xTT

σσ

σσ

ϕ σσ

2212

21

0

0

00

221

lnln

0,max)(Call ( )

−⋅⋅−

−⋅−=

−⋅+⋅⋅⋅= ∫

TSKSTS

TSKSNKS

KxSxdx

σϕσ

σ

σϕ

0

00

0

00

0

)(

0,)1(max)(Call

N(x): cumulative normal, (x): normal density

Page 138: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 137

Exercise

� Derive the call price for Bachelier’s model:

� Derive the price today of a quadratic call payoff for a lognormal model:

( )

−⋅⋅−

−⋅−=

−⋅+⋅⋅⋅= ∫

TSKSTS

TSKSNKS

KxSxdx

σϕσ

σ

σϕ

0

00

0

00

0

)(

0,)1(max)(Call

( )∫ −⋅⋅= 0,max)(Call 22 KSxdx Tϕ

Page 139: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 138

How wrong was Bachelier?

� Call option with� T=0.75� vol = 0.25� K=90

� In practice, indistinguishable!

Page 140: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 139

Option pricing after the 2008 crisis (1)

� The crisis showed that even top institutions can fail� Merrill Lynch, AIG, Lehman Brothers,…� Northern Rock, Bear Sterns, Fortis

� Even countries are at risk � Greece, Portugal, Hungary, Ireland

� Is there then a truly “risk-free” rate ?� risk-free = guaranteed 100%?� If this doesn’t exist our analysis is not correct !

Page 141: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 140

Option pricing after the 2008 crisis (2)

� The crisis changed completely the way transactions are made in practice

� Because of the fear of a counterparty failure, now both counterparties agree to put into a separate account an amount of money that can be used as a guarantee in the case of failure.

� This amount of money is called collateral

Page 142: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 141

Option pricing after the 2008 crisis (3)

� Standard theory

today maturity

Party A buys

Party B sells

premium

Party A

Party B

Cashflow of option

Page 143: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 142

Option pricing after the 2008 crisis (4)

� How it works in practise

today maturity

Party A buys

Party B sells

Party A

Party B

Cashflow of option

Party A buys

Party B sells

premium

Party A

Party B

collateralInterest on

collateral

Page 144: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 143

Option pricing after the 2008 crisis (3)

� What are the implications of the collateral exchange?� The equation

for the evolution of an amount B in the savings account is not true. It is not guaranteed 100% to grow always.

� The collateral amount of money needs to be funded (obtained from another source). Therefore we need to borrow this collateral by paying a new interest rate.

� Option pricing theory needs to include this adjustment

dtrBdB ⋅⋅=

Page 145: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 144

Call-Put parity relation

� Call-Put = = S·e-qT-K·e-rT =(F-K)·e-rT

� The price of a call is linked to the price of a put through the forward

Page 146: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 145

The Black & Scholes model

� Solution of the Black-Scholes model for the price of a call/put with barrier� Barrier « in » : the option is activated only if the barrier is touched

� Barrier « out » : the option is dead if the barrier istouched

Page 147: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 146

The Black & Scholes model

� Solution of the Black-Scholes model for the price of a call/put with barrier� Barrier « up » : the barrier must be touched while the spot rises

� Barrier « down » : the barrier must be touched whilethe spot declines

Call / Put, in / out, up / down � 8 possible combinations

Page 148: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 147

The Black & Scholes model

� Parity relations:

c = cui + cuoc = cdi + cdop = pui + puop = pdi + pdo

Page 149: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 148

The Black & Scholes model

� Price of barrier options

Page 150: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 149

The Black & Scholes model

� Price of « touch » options

� One-Touch Up with So<H

� One-Touch Down with So>H

( )T

TqrSH

σ )2/(ln 2

1

+−+=

TTqrKSd

σσ )2/2()/ln( 0

2−−+

=

( )

( ))( 22

1

22

1

dNterm

TyNSHterm

o

=

+−⋅

=

σλ

( )

( ))( 22

1

22

1

dNterm

TyNSHterm

o

−=

−⋅

=

σλ

( )21Pr termtermeice rT += −

Page 151: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 150

Important identities in the B&S model (1)

� and

� Derivation:

σσ12 dd

−=∂∂

σσ21 dd

−=∂∂

( )

( )

( )( )

σσ

σ

σ

σ

σσσ

σ

σ

σσ

2

221

2

221

221

1

ln1

ln)()(

ln

dT

TqrKS

T

TqrKSTTT

T

TqrKS

d

−=

−−+

−=

+−+

−⋅

=

+−+

∂∂

=∂∂

Page 152: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 151

Important identities in the B&S model (2)

� and and similarly and

� Derivation

σT

rd

=∂∂ 2

σT

rd

=∂∂ 1

( )

σσ

σ

σ

TT

T

T

TqrKS

rrd

==

+−+

∂∂

=∂∂

ln 221

1

σT

qd

−=∂∂ 1

σT

qd

−=∂∂ 2

Page 153: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 152

Important identities in the B&S model (3)

� where and

� Derivation

� We will show that

� Start from right-hand side

)()( 210 dneKdneS rTqT ⋅⋅=⋅⋅ −−2

21

21)(

dedn

−=

π)()( dNdn ′=

( )2122

0

1

20

21)(ln

)()( ddTqr

KS

dndn

eKeS

rT

qT

−−=−+

⇒=

⋅⋅

( ) ( )( )

( ) ( ) ( ) ( )

( ) ( ) ( ) ( )

( )TqrKS

TTqrTqr

TTqrTqr

dddddd

KS

KS

KS

KS

−+

=

+−−−−−+⋅

+−++−−+−=

−+−=−−

0

2212

21

2212

21

121221

22

ln

lnln

lnln2121

21

00

00

σσσ

σσσ

Page 154: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 153

The Greek Letters

� Delta :

� Gamma :

� Vega :

� Theta :

SP

∂∂

=∆

SSP

∂∆∂

=∂∂

=Γ 2

2

συ

∂∂

=P

tP∂∂

The mostimportant quantity for the dailymanagement of the tradingbooks

Page 155: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 154

The Greek Letters

� They represent sensitivities of the portfolio with respect to market parameters

� They allow us to monitor the risk of the portfolio

� They can be applied to a single derivative or to a portfolio of derivatives

Page 156: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 155

GreeksAnalytic expressions for the Greeks (here for a Call):�

TSedN

o

qT

σ

−′=Γ

)( 1

qTo edNTS −′= )( 1υ

rTqTo

qTo edNrKedNqS

TedNS −−

−+′

−=Θ )()(2)(

211 σ

N’(x) =ϕ(x)

probability density of a normal random variable

)( 1dNe qT−=∆

Page 157: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 156

Demonstration: Delta

� and

� Derivation:

� Now use the fact thatand and

� And also the identity we proved:

� to eliminate the two right-most terms and obtain the result

)(Call1

0

dNeS

qT−=∂

∂=∆ )(Put

10

dNeS

rT −−=∂∂

=∆ −

( ) ( )( )

( ) ( ) ( )0

2

0

101

21000

Call

SdNeK

SdNeSdNe

dNeKdNeSSS

rTqTqT

rTqT

∂∂

⋅−∂

∂⋅−⋅=

⋅⋅−⋅⋅∂∂

=∂∂

−−−

−−

0

2,1

2,1

2,1

0

2,1 )()(Sd

ddN

SdN

∂∂

⋅∂

∂=

∂∂

)()(

2,12,1

2,1 dnddN

=∂

∂ 2

21

21)(

dedn

−=

π0

2

0

1

Sd

Sd

∂∂

=∂∂

)()( 210 dneKdneS rTqT ⋅⋅=⋅⋅ −−

Page 158: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 157

Example� A bank has sold

� European call option for $300,000 � on 100,000 shares � of a non-dividend paying stock

� Market parameters areS0 = 49 σ = 20%, K = 50 T = 20 weeksr = 5%

� The Black-Scholes value of the option is $240,000� How does the bank hedge its risk to lock in a $60,000 profit?

example

Page 159: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 158

Naked & Covered Positions

� Naked positionTake no action

� Covered positionBuy 100,000 shares today

� Both strategies leave the bank exposed to significant risk

Page 160: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 159

Delta� Delta (∆) is the rate of change of the option price with respect to the underlying

� Delta small option price does not move when spot moves� Delta large option price moves when spot moves

Optionprice

A

B Slope = ∆

Stock price

Page 161: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 160

Delta Hedging� This involves maintaining a delta neutral portfolio

� Delta neutral: ∆=0� This means that if the spot makes a small change the value of the portfolio does not change

� Eliminates spot risk

� Delta hedging is done by buying/selling the underlying (e.g. cash or stocks)

� Black-Scholes theory shows� that a Delta-neutral portfolio is possible� what is the correct amount of the underlying to short

Page 162: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 161

Delta: an example

� Call option with: � Premium 400€� Delta 50%� Spot today is at S0=100

� This means that � If spot moves to S0=110� The premium will move to 405€ (=400 + 0.5 * 10) � (with all other market parameters unchanged)

Page 163: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 162

Theta

� Theta (Θ) is the change in value of the derivative with respect to the passage of time

� The theta of a call or put is usually negative. � meaning: as time passes the value of the option decreases

� Practically, change in time is 1 day.

Exemple2

Page 164: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 163

Theta: an example

� Call option which today is worth: � Premium 20€� Theta -0.5

� This means that � tomorrow the premium goes to 19.5€� (with all other market parameters unchanged)

Page 165: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 164

Gamma

� Gamma (Γ) is the rate of change of delta (∆) with respect to the price of the underlying asset� Gamma is small Delta is stable under spot movements� Gamma is large Delta is not stable under spot movements

� Gamma neutral hedge:� portfolio and Delta are stable under spot movements.� better hedge than simple Delta-neutral (but more expensive!)

� Gamma is the second derivative of the derivative value withrespect to the underlying price

Page 166: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 165

Interpretation of Gamma� Gamma Addresses Delta Hedging Errors Caused By Curvature

S

CStock price

S'

Callprice

C''C'

Page 167: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 166

Relationship Between Delta, Gamma, and Theta

For a portfolio of derivatives on a stock paying a continuous dividend yield at rate q

Θ ∆ Γ Π+ − + =( )r q S S r12

2 2σ

Page 168: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 167

Vega

� Vega (ν) represents the change in value of a derivative with if market volatility moves by 1%

� Vega tends to be greatest for options that are close to the at-the-money� Risk that volatility can move the spot out of the money

Page 169: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 168

Vega: an example

� Call option with � Premium 20€� Vega 0.5� Market Vol 20%

� This means that � If market Vol goes to 21%� Premium goes to 20.5€

Page 170: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 169

Managing Delta, Gamma, & Vega

� ∆ can be changed by taking a position in the underlying

� To adjust Γ & ν it is necessary to take a position in an option or other derivative

Page 171: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 170

00.000010.000020.000030.000040.000050.00006

0.8 1 1.2 1.4 1.6 1.8

spot

vega

0.6y1y

� Call option, strike 1.25

Price Delta Gamma

Vega� Option price becomes linear for large spots� Delta ~ cumulative function� Convexity risk (Gamma) highest at-the-money� Vol risk (vega) is highest at-the-money

Spotladders: vanilla

00.51

1.52

2.53

3.5

0.8 1 1.2 1.4 1.6 1.8

spot

gamma

0.6y1y

0

0.1

0.2

0.3

0.4

0.5

0.6

0.8 1 1.2 1.4 1.6 1.8

spot

price

0.6y1y

0

0.2

0.4

0.6

0.8

1

1.2

0.8 1 1.2 1.4 1.6 1.8

spot

delta

0.6y1y

Page 172: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 171

Spotladders: barrier option

� Knock-out option, strike 1.25, barrier 1.35

Price Delta Gamma

Vega� Option price: 0 at barrier and out-of-the-money � Delta, Gamma, Vega can be negative unlike vanilla!

00.00050.0010.00150.0020.00250.0030.00350.0040.0045

0.8 0.9 1 1.1 1.2 1.3 1.4

spot

price

0.6y1y

-0.06-0.05-0.04-0.03-0.02-0.01

00.010.020.03

0.8 0.9 1 1.1 1.2 1.3spot

delta

0.6y1y

-0.6

-0.4

-0.2

0

0.2

0.4

0.8 1 1.2spot

gamma

0.6y1y

-0.000008

-0.000006

-0.000004

-0.000002

0

0.000002

0.000004

0.8 1 1.2

spot

vega 0.6y

1y

Page 173: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 172

Rho

� Rho is the rate of change of the value of a derivative with respect to the interest rate

Page 174: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 173

Example of risk hedging� The forward (=the expected spot) is set by the market� Imagine you are a trader in EURUSD � What are the risks in each of the positions?

-5 mlGAMMA-5 mlGAMMA+5 mlGAMMA+5 mlGAMMA

-1 mlDELTA+1 mlDELTA-1 mlDELTA+1 mlDELTA

1.431M FORWARD1.431M FORWARD1.431M FORWARD1.431M FORWARD

1.41SPOT1.41SPOT1.41SPOT1.41SPOT

EURUSD positionEURUSD positionEURUSD positionEURUSD position

Spot is expected to go up.

Delta is >0, Gamma>0

Probably will make money

If Spot increases (as expected by mkt) Delta<0 will lose money but Gamma>0 will soon turn Delta from <0 to >0.

If Spot increases Delta>0 will make money but Gamma<0 will soon turn Delta from >0 to to <0. Then will lose money.

If Spot increases Delta<0 will lose money while Gamma<0 make Delta even more negative. Losses will mount!

Page 175: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 174

Volatility « smile »

A practitioner’s introduction

Page 176: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 175

Implied volatility

� Traders often quote vols instead of prices

� This means:

� Implied vol: the vol to put in the BS pricer to get the price

� It is not equivalent to historical vol: � measure of historical fluctuations

� It does not give information about the dynamics

BS pricervol price

BS pricervol price

Page 177: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 176

Numerical computation of the implied vol

� Aim: Compute the implied vol corresponding to a call price C� Use the bisection method:

1. Take two extreme points volmin and volmax2. Compute the middle point: volmid=0.5 (volmin+volmax)3. Compute the BS Call price using volmid: BSC4. If the BSC > C then

set volmax=volmidElse set volmin=volmid

5. Repeat 2-5 till BSC comes very close to C

Page 178: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 177

Historical vs implied volatility

� Historical Volatility (Annualised):

� Represents the size of fluctuations in the process S� A measure for the vol of the past

� Implied Volatility:

� Represents the price of a vanilla option today� A measure for the vol of the future

( )11

2hist ln with 11

−=

=

−= ∑

i

ii

N

ii S

SrrrNT

σ

Page 179: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 178

Measuring historical volatility

� EURUSD� 6-month data, closing of day� Historical vol = 5.2%� Implied vol in Apr2010 = 17%

� Measuring historical vol is not easy� Which data set do we take?� min, hourly, daily intervals?� How do we account for low/high?

� Black-Scholes assumption on volis wrong:� Apr-Jun: high volatility� Oct-Nov: low volatility

Page 180: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 179

Interpretation of implied volatility (1)

� If instead of the Black-Scholes assumption

� we consider

� where (t) a deterministic “instantaneous” vol� Then we have a solution for the spot process

� And therefore for the vanilla price and implied vol we can write

tttt dWSdtSdS ⋅⋅+⋅⋅= σµ

tttt dWtSdtSdS ⋅⋅+⋅⋅= )(σµ

⋅+

−⋅= TWTTrSTS σσ 2

21exp)0()( ∫ ⋅=

T

dttT 0

22 )(1 σσ

( ) ( )σσ CallCall impl = → σσ =impl

Page 181: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 180

Exercise (instantaneous vol = no smile)� Show that� leads to with

� Solution:� From Ito’s Lemma we have� with mean and variance:

� This means lnST is normal with mean and variance as above, so:

tttt dWtSdtSdS ⋅⋅+⋅⋅= )(σµ

⋅+

−⋅= TWTTrSTS σσ 2

21exp)0()( ∫ ⋅=

T

dttT 0

22 )(1 σσ

( ) ( )∫+−+=T

tT dWtTSS0

221

0lnln σσµ

[ ] ( )TSST2

21

0lnlnE σµ −+=

( )[ ] [ ] ( ) ( )∫∫ =

=−

TT

tTT dttWdtSS0

2

2

0

22 ElnElnE σσ

( ) ( ) T

T

T WdttTSS ~lnln0

2221

0 ⋅+−+= ∫σσµ

Page 182: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 181

Interpretation of implied volatility (2)

� This relation implies that the implied variance can be seen as an average over instantaneous variances

∫ ⋅=T

dttT 0

22impl )(1 σσ

(1) (2) (3)

Spot

timet1 t2 t3 t4

Page 183: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 182

Black-Scholes vs market� Black&Scholes-price < market-price, for very low / very high strikes� Plug market-price in BS formula to calculate implied volatility� Black-Scholes theory assumes that the spot fluctuations (vol) do not

depend on the strike of the option� Here we observe a parabolic-shape looking like a smile

Call on EURUSD

0

10000

20000

30000

40000

50000

60000

70000

80000

1.2000 1.2500 1.3000 1.3500 1.4000 1.4500 1.5000 1.5500

strike

USD

cas

h

Black-Scholes

Market

Smile

13.00%

13.50%

14.00%

14.50%

15.00%

1.2000 1.2500 1.3000 1.3500 1.4000 1.4500 1.5000 1.5500 1.6000

StrikeVo

latil

ity

Black-Scholes

Market

Page 184: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 183

Reasons for the smile? (1)

Supply and demand:

� Traders buy out-of- the-money puts as protection for market crashes

� As option price rises, so do the implied vols

� Traders look at support/resistance levels which set the strike where they buy

Page 185: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 184

Reasons for the smile? (2)� Black-Scholes assumption for log-normality is wrong� Plotting the market-implied terminal spot density reveals fat tails

( ) 2

mkt2

0Call

2

KeSSP Tr

T ∂∂

⋅= ⋅

Fat tails:

Market implies that the probability that the spot visits low-spot values is higher than what is implied by Black-Scholes

Main causes:

•Spot dynamics is not lognormal

•Spot fluctuations (vol) are not constant

Page 186: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 185

Reasons for the smile? (3)

� In real trading there are jumps in the spot that are not foreseen in the Black-Scholes model

� Extreme events appear more often than predicted by the lognormal distribution

� The volatility we observe is not constant

� Jumps are observed in the evolution of prices

Page 187: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 186

Why use Black-Scholes model

� Despite its shortcomings the Black-Scholes model is accepted due to its simplicity

� Today it is used as a means of communication: to make sure all parties talk about the same option

� Risk-sensitivities (Delta, Vega, etc) are quoted in terms of their implied Black-Scholes value

Page 188: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 187

Vanilla as function of vol

� A simple and useful property of the vanilla price is the monotonicity of the price with respect to the volatility

� This will be used extensively in subsequent proofs

Page 189: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 188

At the money� Various definitions across asset classes

� A common one:

� The at-the-money point is the point where the delta of the call equals the delta of the put (in absolute value)

� Solving this relation for Katm gives

� F: the forward, T: maturity

),(),( atmatmputatmatmcall σσ KK ∆−=∆

TeFK

⋅⋅=

2atm2

1

atm

σ

Page 190: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 189

Smile Stickiness

� Two types of market smiles:

� Sticky-strikeThe smiles changes when the spot changesNatural definition of market smile

� Sticky-deltaThe smiles changes when the “moneyness” changesEfficient when the market spot changes rapidly, e.g. in Forex

� Moneyness: number of standard deviations that strike is away from forward

TFK

σ

ln

Page 191: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 190

Sticky delta

� Market quotes are given in terms of the Black-Scholes Delta

� For example, “vol at 25-Delta-Call =10%”

� This equation provides the strike K25

41)1.0,( 2525call ==∆ ∆∆ σK

Page 192: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 191

Market quotes (1)

� Market quotes the smile in an implicit way� Quotes KATM and two other strikes K1, K2� 3 vol quotes are given

� ATM� Butterfly: implies the smile convexity� Risk-Reversal: implies the smile skew

� If RR<0 2< 1left-side higher than right-side

� If BF is large: the distance between ATMand the average vol at K1 and K2 is large

( )12RR

ATM21BF

ATM

21

σσσ

σσσσ

σ

−=

−+=

1

2ATM

K1 KATM K2

Page 193: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 192

Market quotes (2)

� Special case: RR=0 and BF=0 implies that

� 1= 2= ATM

� The smile is a flat line

� We return to Black-Scholes world

Page 194: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 193

Market quotes (3)

� RR: controls skew� BF: controls convexity

Page 195: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 194

Stylised facts (1): ATM vs smile-min

� The ATM point of Katm=Fexp(½ atmT) is close to the minimum of the smile curve

Page 196: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 195

Stylised facts (2): convexity vs maturity

� Smiles of short-maturities are more pronounced

Page 197: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 196

Stylised facts (3): spot vs vol� F. Black: “I have noticed that when spot increases voldecreases and when spot decreases vol increases”

� Similarly for spot vs realised vols

Page 198: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 197

Contruction of the implied vol surface

� Market quotes few points on along the strike axis� 3 points in illiquid underlyings� 5 points in liquid underlyings

� Practitioners use interpolation/extrapolation methods to obtain the non-quoted part of the curve

� In general:� Time-interpolation: linear-in-variance� Strike-interpolation: natural cubic spline

� Caution to no-arbitrage conditions!

Page 199: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 198

No-arbitrage conditions: spot PDF� The market quoted smile must lead to a non-negative spot PDF

( ) 2

mkt2

0Call

2

KeSSP Tr

T ∂∂

⋅= ⋅

Page 200: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 199

Market data: vols, BFs, RRs, spread

Page 201: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 200

Market data interpolation: rates� The market is quoting the rates

� r1 between t0 (today) and t1� r2 between t0 (today) and t2

� What is the rate between t1 and t2 ?

� The interpolation is linear due to the continuity required by discounting:

� DF(t0, t2) = DF(t0, t1) · DF(t1, t2)

� This implies:

t0 t1 t2

Mkt: r1 Mkt: r2

interpolation: r

12

011022)()()( )()(12011022

ttttrttrreee ttrttrttr

−−⋅−−⋅

=⇒⋅= −⋅−−⋅−−⋅−

Page 202: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 201

Market data interpolation: vol (in time)

� The market is quoting the implied vols� 1 between t0 (today) and t1� 2 between t0 (today) and t2

� What is the vol between t1 and t2 ?� The interpolation is “linear-in-variance”:

� This implies

t0 t1 t2

Mkt: 1Mkt: 2

interpolation:

( ) ( )( )12

012102

222

tttttt

−−⋅−−⋅

=σσσ

( ) ( ) ( )

( ) ( ) ( ) ( )[ ]01121022

22

12

22

12

2

12

2

1

11 1

0

2

0

2

1

tttttttt

dssdsstt

dsstt

t

tinst

t

tinst

t

tinst

−⋅−−⋅−

=

−=

−= ∫∫∫

σσ

σσσσ

Page 203: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 202

Other possibilities to get to the smile� If Black-Scholes assumption is wrong then let us consider that vol is not constant

� Calculations are not as elegant and simple anymore� Two of the mainstream models:

WdStSdtSSd ),(σµ +=

[ ]

=+−=

+=

dtWdWdEWdVdtVVdV

WdSVdtSSd

ρεκ

µ

21

2

1

)(

� Local Volatility model

� Volatility is deterministic: depends on the time and spot

� This model can reproduce the smile

� Stochastic Volatility model

� Spot: Geometric Brownian motion� Variance is stochastic:by design returns to a long-term mean value V∞

Page 204: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 203

Local-vol vs Stochastic-vol� Local- and Stochastic-vol models can reproduce the vanilla-

smile perfectly � But can differ dramatically when pricing exotics!

Page 205: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 204

Hedging with smile

� Without correct fitting of the true forward smiles, hedging is a problem

Example: Delta hedging

� Price depends on the implied-vol, which is constructed for a given spot

� Bumping the spot, means that the implied-vol surface will change

� “Model Risk”: risk induced by difference in models

� Different models will give a different and

( )( ) ( )( )S

SSSSSSSS∆⋅

∆−∆−−∆+∆+=∆

2;Price;Price implimpl σσ

( )SS ∆+implσ ( )SS ∆−implσ

Page 206: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 205

Mainstream models

Three main categories

� Volatility is local � Non-parametric, e.g. Dupire� Parametric, e.g. Quadratic Local Vol

� Volatility is stochastic� Mean-reverting, e.g. Heston

� Spot process allows for jumps� Merton jump-diffusion

All combinations are possible:

� Stochastic Local Vol model

� Heston + Jumps = Bates model

� …

Page 207: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 206

Mainstream models: Black-Scholes (1973)

� Constant vol (size of spot fluctuations)� Lognormal process for the spot

dWSdtSdS tttt ⋅⋅+⋅⋅= σµ

Page 208: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 207

Mainstream models: Bachelier (1900)

� Simpler than Black-Scholes� Allows for smile (in the Black-Scholes world)

� Can be seen as a primitive “local vol” model

� Has analytic solution

� But can lead to negative values for the underlying

dWS

SdtS

SdSt

tt

tt ⋅

⋅+⋅

⋅=

σµ

dWdtdSt ⋅+⋅= σµ

Page 209: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 208

Mainstream models: Merton (1976)

� Lognormal process for spot � Poisson frequency of jumps

� Jumps is a realistic ingredient� Model allows full analytic solution for vanillas� Improves Black-Scholes in the fat tails

( ) tttttt dqdWSdtSkdS +⋅⋅+⋅⋅−= σλµ

Page 210: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 209

Mainstream models: Dupire (1994)

� Developed by Dupire and Derman & Kani� Reproduces market vanillas� Non-parametric, non-arbitrageable

� But historical data does support the idea that spot-volatility is a deterministic function

� This can lead to wrong hedging

dWStSdtSdS ttttt ⋅⋅+⋅⋅= ),(σµ

Page 211: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 210

Mainstream models: Quadratic Local Vol

� Similar to Dupire’s Local Vol

� But in parametric form

� Proxy parameters: 0~ATM, ~ skew, ~convexity� Allows analytic solution and fits smile dynamics

dWSSdtSdS ttttt ⋅⋅+⋅⋅= )(σµ

( )2

000 11

−⋅+

−⋅+=

FF

FFS tt

t βασσ

Page 212: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 211

Mainstream models: Heston (1993)

� Stochastic Vol model

� Spot: lognormal process� variance: mean-reverting process � Has analytic solution for vanillas

+−=

+=

∞ 2

1

)( WdVdtVVdV

WdSVdtSSd

εκ

µ

Page 213: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 212

Mainstream models: SLV (2007)

� Stochastic Local Vol

� Uses Dupire Local Vol in the calibration process� Fits the smile � Hard to implement

Sttttt dWStZtSdtSqrdS ⋅⋅⋅+⋅⋅−= )(),()( σ

( ) Ztttt dWdtZZd ⋅+⋅−= λθκ lnln

Page 214: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 213

Model selection

� Large number of alternative models:

� Volatility is stochastic� Spot process is not lognormal � Random variables are not Gaussian � Random path has memory (“non-markovian”)� The time increment is a random variable (Levy processes)� Correlation between vol and spot is stochastic� And many many more…

� A successful model must allow quick and exact pricing of vanillas to reproduce smile

� Wilmott: “maths is like the equipment in mountain climbing: too much of it and you will be pulled down by its weight, too few and you won’t make it to the top”

Page 215: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 214

Model selection: Calibration

� Calibrationminimize (model output – market observable)2

Example (model ATM vol – market ATM vol)2

� Parameter space should not be� too small: model cannot reproduce all market-quotes across tenors� too large: more than one solution exists to calibration

Page 216: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 215

How to simulate a stochastic process

� Consider the stochastic differential equation

� With solution

� To solve it numerically:� Euler discretization: freeze integrals at their lower limit value

( ) ( ) tttt dWXbdtXadX ⋅+⋅=

( ) ( )∫∫ ⋅+⋅+=t

uu

t

ut dWXbduXaXXττ

τ

( ) ( ) ( ) ( )ττττ τ WWXbtXaXX tt −⋅+−⋅+=

Page 217: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 216

Model selection: One-touch tables� OT tables measure model success vs market price� OT price ≈ probability of touching barrier (discounted)� Collect mkt prices for TV in the range:

0%-100% (away-close to barrier)� Calculate model price – market price� The better model gives model-mkt≈0

OT table

-7.00%

-6.00%

-5.00%

-4.00%

-3.00%

-2.00%

-1.00%

0.00%

1.00%

2.00%

3.00%

0 0.2 0.4 0.6 0.8 1

TV price

mkt - mod

el

VannaVolgaLocalVolHeston

OT tables depend on

� nbr barriers

� Type of underlying

� Maturity

� mkt conditions

Page 218: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 217

Numerical methods

Page 219: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 218

Models, numerical methods and payouts

� Payout � describes the derivative product, the rights and obligations of the owner and of the issuer (no maths!).

� Model � Assumptions concerning the evolution of the underlying in the market

� Numerical method � The way of calculating the price of the payout, depending on the chosen model

Page 220: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 219

Models, numerical methods and payouts

Models :Black-ScholesStochastic VolLocal Vol

Jump Diffusion…Numerical methods:analytic solutionStatic replicationBinomial treeMonte Carlo

Finite differences…

Payout :Call, Put, barriers, european, americanCallable, touch …

A model associated with a numerical method allows us to give the price of a payout(derivative product)

Page 221: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 220

Numerical methods� Analytic solution:

� Very fast� « Exact » result� Very easy to implement� Exists only for a few payouts , with some models

� Monte Carlo� Relatively easy to implement� Can be applied practically on all payouts, with all models� Can be applied on payouts with several underlyings� Easy to parallelize computations� Slow� More difficult to implement on options with American exercise� Calculation of greeks is not easy

Page 222: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 221

Numerical methods

� Binomial Tree (or trinomial):� Relatively easy to implement� Exists for many payouts (barriers), with only some models

� Partial differential equation (PDE) grid� Can be applied on many payouts, with most models

� limited to 2-3 underlyings� Very stable for the calculation of the greeks� Fast� Difficult to parallelise computations� Relatively difficult to implement

Page 223: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 222

Binomial Trees

� Binomial trees are frequently used to approximate the movements of an underlying

� In each small interval of time the stock price can� move up by a proportional amount u � move down by a proportional amount d

Page 224: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 223

Binomial Trees

� We discretise time in small steps� At each time step the underlying can only have twopossibilities :� Increase by a factor « u » (>1)� Decrease by a factor « d » (<1)

Page 225: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 224

Movements in Time ∆t

Su

SdS

p

1 – p

∆t

p = probability that underlying increases

1-p = probability that underlying decreasesp, u, d ?

uSS

o

=

dSS

o

=

Page 226: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 225

Risk Neutral Pricing

� If we know the value of the underlying today S(t)=So� The expected value at a future time t+∆t is E[S(t+∆t)] = S(t) e(r-q)∆t

� r is the interest rate of the currency of the underlying� q is the divident rate (for stocks), or, the interest rate of currency 1 (for Forex)

� on average an underlying evolves according to the risk-free interest rate (=savings account) of the currency on which it is expressed

Page 227: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 226

Parameters p, u, and d are chosen so that the tree gives correct values for the mean & variance of the stock price changes in a risk-neutral world

Mean: E[St+∆t /St]=e(r-q)∆t = pu + (1– p )d

dudep

tqr

−−

=⇔∆− )(

Eq.1

Tree Parameters (1)

Page 228: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 227

Tree Parameters (2)

Var σ2∆t = pu2 + (1– p )d 2 – e2(r-q)∆t

A further condition often imposed is u = 1/ d

Var[St+∆t /St]=?

)()(.)( tttt

ttt WWtqrS

SSapproxWddtqrSSd

−+∆−=−

+−= ∆+∆+ σσ

)()(1 tttt

tt WWtqrS

S−+∆−+= ∆+

∆+ σ22

var

=

∆+∆+∆+

t

tt

t

tt

t

tt

SSE

SSE

SS

Eq.2

Eq.3

Page 229: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 228

When ∆t is small a solution to the equations is

tqr

t

t

eadudap

ed

eu

∆−

∆σ−

∆σ

=−−

=

=

=

)(

Solution to Binomial Tree

Page 230: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 229

Exercise

� Prove the previous statement� Start with eq.2

� Now try the solution

� For small t it gives (Taylor expansion):

( ) ( )( )( )

( ) uddueddude

ddupdppu

t

t

−−=

=++−=

+−=−+

∆⋅

∆⋅

µ

µ

1

2eq.1

22222

tt edeu ∆−∆ == σσ ,

( ) ( ) ( ) ( )t

ttttteuddue tt

∆=

∆−−∆−⋅∆+−∆−+∆+=−+ ∆∆

2

211111σ

µσσσσµµ

tdtu ∆−≈∆+≈ σσ 1,1

Page 231: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 230

The Complete Tree

S0u 2

S0u 4

S0d 2

S0d 4

S0

S0u

S0d S0 S0

S0u 2

S0d 2

S0u 3

S0u

S0d

S0d 3

Today

Maturity

Page 232: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 231

Backwards Induction

� We know the value of the option at the final nodes

� We work back through the tree using risk-neutral valuation to calculate the value of the option at each node, testing for early exercise when appropriate

Page 233: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 232

Example: Put Option

S0 = 50; K = 50; r =10%; σ = 40%; T = 5 months = 0.4167; ∆t = 1 month = 0.0833

The parameters imply u = 1.1224; d = 0.8909; a = 1.0084; p = 0.5073

Page 234: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 233

Example (continued)89.070.00

79.350.00

70.70 70.700.00 0.00

62.99 62.990.64 0.00

56.12 56.12 56.122.16 1.30 0.00

50.00 50.00 50.004.49 3.77 2.66

44.55 44.55 44.556.96 6.38 5.45

39.69 39.6910.36 10.31

35.36 35.3614.64 14.64

31.5018.50

28.0721.93

So

Stage 1 : complete the values of the underlying(top box)

Put�Max(0,K

-S)

Stage 2 : Determine the value of the option at the end nodes

Page 235: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 234

Example (continued)

� Step 3: Go through the whole tree from right to left by completing the boxes on the bottom of each cell (option value)

2.66=(p x 0 + (1-p) x 5.45 ) x e-r∆t

Page 236: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 235

Calculation of Delta

Delta is calculated from the nodes at time ∆t

Delta =−−

= −2 16 6 965612 44 55

0 41. .. .

.

Page 237: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 236

Calculation of Gamma

Gamma is calculated from the nodes at time 2∆t

03.065.11

=Gamma

64.069.395036.1077.3;24.0

5099.6277.364.0

21

21

=∆−∆

−=−−

=∆−=−

−=∆

11.65=½(62.99-50)+½(50-39.69)

Page 238: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 237

Calculation of Theta

Theta is calculated from the central nodes at times 0 and 2∆t

Theta= per year

or - . per calendar day

377 44901667

43

0012

. ..

.−= −

Page 239: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 238

Calculation of Vega

� We can proceed as follows� Construct a new tree with a volatility of 41% instead of 40%.

� Value of option is 4.62� Vega is

4 62 4 49 013. . .− =per 1% change in volatility

Page 240: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 239

Options on Indices, Currencies, Futures

As with Black-Scholes:� For options on stock indices, q equals the dividend yield on the index

� For options on a foreign currency, q equals the foreign risk-free rate

� For options on futures contracts q = r

Page 241: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 240

Alternative Binomial Tree

Instead of setting u = 1/d we can set each of the 2 probabilities to 0.5 and

ttqr

ttqr

ed

eu∆σ−∆σ−−

∆σ+∆σ−−

=

=)2/(

)2/(

2

2

Page 242: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 241

Trinomial Tree

61

212

32

61

212

/1

2

2

2

2

3

+

σ−

σ∆

−=

=

+

σ−

σ∆

=

== ∆σ

rtp

p

rtp

udeu

d

m

u

t

S S

Sd

Su

pu

pm

pd

Page 243: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 242

Time Dependent Parameters in a Binomial Tree

� Making r or q a function of time does not affect the geometry of the tree. The probabilities on the tree become functions of time.

� We can make σ a function of time by making the lengths of the time steps inversely proportional to the variance rate.

Page 244: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 243

Pricing an american put with a binomial tree

� « American » = the owner of the option has the right to exercise at any moment before expiry (or, atexpiry).

� Begin in the same way as for the european option

Page 245: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 244

Example American Put 89.070.00

79.350.00

70.70 70.700.00 0.00

62.99 62.990.64 0.00

56.12 56.12 56.122.16 1.30 0.00

50.00 50.00 50.004.49 3.77 2.66

44.55 44.55 44.556.96 6.38 5.45

39.69 39.6910.36 10.31

35.36 35.3614.64 14.64

31.5018.50

28.0721.93

So

Stage 1 : complete the values of the underlying(top box)

Put�Max(0,K

-S)

Stage 2 : Determine the value of the option at the end nodesassuming that the option was not exercised before

Page 246: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 245

Example American Call

If immediate exercise:

If no immediate exerciseValue =(p x 0.69 + (1-p) x 0.43 ) x e-r∆t =0.55

Call : Max(0,(2.06-1.5)) = 0.56

2,19

0,69

1,930,43

2,060,55

S 1,5call Put cstrike 1,5volatility 20%r1 5%r2 3%T 1

American n

Nsteps 10

dt 0,1u 1,06528839d 0,93871294a 0,998002p 0,46840882phi 1

0.56

Page 247: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 246

Example American CallS 1,5 dt 0,1 2,823340166

call Put c u 1,06528839 1,323340166strike 1,5 d 0,93871294 2,65030595volatility 20% a 0,998002 1,15030595r1 5% p 0,46840882 2,4878765 2,487876496r2 3% phi 1 0,9878765 0,987876496T 1 2,33540186 2,33540186

American y 0,83540186 0,83540186

Nsteps 10 2,19227195 2,19227195 2,19227195

0,69227195 0,69227195 0,692271952,05791405 2,05791405 2,05791410,55791405 0,55791405 0,5579141

1,93179055 1,93179055 1,93179055 1,93179060,43179055 0,43179055 0,43179055 0,4317906

1,81339679 1,81339679 1,81339679 1,810,31660783 0,31339679 0,31339679 0,31

1,70225904 1,70225904 1,70225904 1,70225904 1,7022590370,2244334 0,21690461 0,20926664 0,20225904 0,202259037

1,59793259 1,59793259 1,59793259 1,59793259 1,597932590,1541648 0,14448285 0,13310696 0,11869566 0,09793259

1,5 1,5 1,5 1,5 1,5 1,50,10291859 0,09311931 0,08148539 0,06675155 0,04573508 0

1,40806941 1,40806941 1,40806941 1,40806941 1,408069410,05834495 0,04838689 0,03645986 0,02135854 0

1,32177298 1,32177298 1,32177298 1,32177298 1,321772980,02803347 0,01949579 0,00997456 0 0

1,2407654 1,2407654 1,2407654 1,24076540,0102576 0,00465818 0 0

1,16472254 1,16472254 1,16472254 1,164722540,0021754 0 0 0

1,09334012 1,09334012 1,093340120 0 0

1,02633252 1,02633252 1,0263325210 0 0

0,96343162 0,963431620 0

0,90438573 0,904385730 0

0,8489585900,796928414

0

Cells in red:

Immediate exercise more interestingthan keeping the option

Can occur for a call if r1 (q) >0

Can occur for a put if r2 (r) >0

Page 248: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 247

Demo binomial tree (american)

American Exercise

Page 249: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 248

Pricing of a KO put with binomial tree

KO Barrierlevel = 1.5

Page 250: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 249

Demo binomial tree (Barrier)

Tree Barrier

Page 251: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 250

Monte Carlo Method

Page 252: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 251

Monte Carlo method

Cartoon by S Harris

Page 253: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 252

Monte Carlo� In most cases analytic formula is too hard to find� An practical alternative is pricing via simulations

� We simulate the evolution of the underlying a large number of times (~10000).

� For every simulation we calculate the expected gain for the owner of the option

� Option price = (average of gains) x (disc-fact)

e-rT

Page 254: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 253

Monte Carlo

� Each simulation describes a randomly chosen path of the underlying

� The name “Monte Carlo” comes from the resemblance to casino games

Page 255: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 254

Random numbers

� Simulations require sampling random numbers� Typical simulation: 105 paths & 102 steps� Deviations away from required statistics produce unwanted bias� Main problem: Random numbers are not truly random

� there is a formula behind taking as input the computer clock

� After a while “random numbers” will repeat themselves� Good random numbers have a long period before repetition occurs� This effect is more pronounced as the number of dimensions (=number of steps * number of paths) increases

Page 256: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 255

Mersenne uniform random numbers

� Have a period that is a Mersenne number, i.e. can be written as 2n-1, for example n=19937

� Mersenne numbers are popular due to � They are quickly generated� Sequences are uncorrelated � Eventually (after many draws) they fill the space uniformly

Page 257: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 256

Box-Muller normal random numbers

� Transform a pair of uniform random numbers u,v into normal random numbers x,y

� Transformation

� with

� x,y: Normally-distributed � Advantages: One transformation, two random numbers N(0,1)� Disadvantages: ln(…), cos(…), sin(…) are CPU-consuming

)2sin(ln2

)2cos(ln2

vuy

vux

π

π

⋅⋅−=

⋅⋅−=

( )( )

22

21

21

21

21

,,Jacobian

yxee

yxvu −−

⋅=∂∂

=ππ

Page 258: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 257

Sobol’ numbers

� Sobol’ numbers are not random: � They are “low-discrepancy”: meant to split equidistantly the space� Quality depends on nbr of dimensions = nbr Paths x nbr Steps� Uniformity is good in low dimensions� Uniformity is bad in high dimensions� Are convenient because … they are not random !

� Calculating the Greeks with finite difference requires the same sequence of random numbers, for example the Delta

� The calculation of the Greeks should differ only in the “bumped” parameter (e.g. the spot) not the path of the spot process

( ) ( )S

SSSS∆⋅

∆−−∆+=∆

2PricePrice

Page 259: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 258

Random numbers comparison (1)

Dimension:

65532 x 2

Page 260: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 259

Random number comparison (2)� Mersenne vs Sobol’ (uniform)� Box-Muller vs inverse cumulative method (generate normal variates)� Check convergence to N(0,1)

Page 261: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 260

Sobol’ number quality

1 2 3 4 5 6 70 0 0 0 0 0 0

0.5 0.5 0.5 0.5 0.5 0.5 0.50.25 0.75 0.25 0.75 0.25 0.75 0.250.75 0.25 0.75 0.25 0.75 0.25 0.750.875 0.875 0.125 0.625 0.375 0.375 0.6250.375 0.375 0.625 0.125 0.875 0.875 0.1250.125 0.625 0.875 0.875 0.625 0.125 0.3750.625 0.125 0.375 0.375 0.125 0.625 0.8750.6875 0.8125 0.8125 0.1875 0.0625 0.6875 0.56250.1875 0.3125 0.3125 0.6875 0.5625 0.1875 0.06250.4375 0.5625 0.0625 0.4375 0.8125 0.9375 0.31250.9375 0.0625 0.5625 0.9375 0.3125 0.4375 0.81250.8125 0.6875 0.4375 0.0625 0.9375 0.3125 0.68750.3125 0.1875 0.9375 0.5625 0.4375 0.8125 0.18750.0625 0.9375 0.6875 0.3125 0.1875 0.0625 0.43750.5625 0.4375 0.1875 0.8125 0.6875 0.5625 0.93750.59375 0.96875 0.34375 0.90625 0.78125 0.84375 0.031250.09375 0.46875 0.84375 0.40625 0.28125 0.34375 0.531250.34375 0.71875 0.59375 0.65625 0.03125 0.59375 0.781250.84375 0.21875 0.09375 0.15625 0.53125 0.09375 0.281250.96875 0.59375 0.96875 0.78125 0.15625 0.21875 0.156250.46875 0.09375 0.46875 0.28125 0.65625 0.71875 0.656250.21875 0.84375 0.21875 0.53125 0.90625 0.46875 0.906250.71875 0.34375 0.71875 0.03125 0.40625 0.96875 0.406250.65625 0.65625 0.03125 0.34375 0.34375 0.90625 0.093750.15625 0.15625 0.53125 0.84375 0.84375 0.40625 0.593750.40625 0.90625 0.78125 0.09375 0.59375 0.65625 0.843750.90625 0.40625 0.28125 0.59375 0.09375 0.15625 0.34375

Draw (n x m) table of Sobol’ numbers

0.000

0.100

0.200

0.300

0.400

0.500

0.600

0.700

0.800

0.900

1.000

0.000 0.200 0.400 0.600 0.800 1.000

, 2 )

0.000

0.100

0.200

0.300

0.400

0.500

0.600

0.700

0.800

0.900

1.000

0.000 0.200 0.400 0.600 0.800 1.000

Pair( 10 , 20 )

0.000

0.100

0.200

0.300

0.400

0.500

0.600

0.700

0.800

0.900

1.000

0.000 0.200 0.400 0.600 0.800 1.000

Pair( 13 , 40 )

0.000

0.100

0.200

0.300

0.400

0.500

0.600

0.700

0.800

0.900

1.000

0.000 0.200 0.400 0.600 0.800 1.000

Pair( 20 , 881 )

Plot pairs of columns(1,2) (10,20)

Non-uniform filling for large dimensions!

(13,40) (20,881)

Nbr Steps Nbr Paths

Page 262: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 261

Sobol’ in high dimensions� 8191x32 dimensions� Convert Sobol’ to normal variates� Patterns form. Non-uniform filling of the space!

Page 263: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 262

Monte Carlo method� It is a method for finding the average of a functiong of a random variable X:� We are interested in calculating integrals of the form:

� where f(x) is the probability density of x in the interval [a,b]

� Example

� where (ST) is the spot terminal density in the interval [0,∞]� call(ST) = max(ST-K,0)

[ ] ( ) dxxfxgxgGb

a

⋅⋅== ∫ )()(E

[ ] ( ) TTTT dSSSSG ⋅⋅== ∫∞

0

)(call)(callE ϕ

Page 264: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 263

Monte Carlo method� Obtain estimator of G� by producing large number of realisations of x: (x1,x2…,xN).

� Estimator

� Theoretical mean

� The larger the N, the more accurate the estimator

[ ] ( ) dxxfxgxgb

a

⋅⋅= ∫ )()(E

∑=

=N

iiN xg

Ng

1

)(1~

Page 265: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 264

Monte Carlo method: an example� Calculate the mean of N lognormal

variables� Sample N lognormal variables� Sum them up� Repeat for various values of N� Small N: fluctuations� Large N: convergence to mean

� How to sample at random a lognormally-distributed variable in Excel:� X = RAND()� Y = LOGINV(X,mean,std)

� where mean=mean of Lognormal distrib.where std=standard dev of Lognormal distrib.

Page 266: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 265

Monte Carlo Simulation and π

� Calculate π by randomly sampling points in the square?

Exercice

Page 267: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 266

Monte Carlo Simulation and Options

When used to value European stock options, Monte Carlo simulation involves the following steps:

1. Simulate one path for the stock price in a risk neutral world2. Calculate the payoff from the stock option3. Repeat steps 1 and 2 many times to get many sample payoffs

4. Calculate mean payoff5. Discount mean payoff at risk free rate to get an estimate of the value of the option

Page 268: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 267

Sampling Stock Price Movements

� In a risk neutral world the process for a stock price is

� We can simulate a path by choosing time steps of length ∆t and using the discrete version of this

where ε is a random sample from Ν(0,1)tStSS ∆εσ+∆µ=∆ ˆ

dS S dt S dz= +$µ σ

=LOI.NORMALE.INVERSE(ALEA();0;1)

Page 269: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 268

An alternative approach

( ) ttetSttS ∆+∆−=∆+ 2/2)()( εσσµ

•More accurate in most cases

•The options with a european payout require only one time step

=LOI.NORMALE.INVERSE(ALEA();0;1)

Often instead of using the BS stochastic differential equation, we use its solution:

Page 270: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 269

Extensions to several underlyings

When a derivative depends on several underlying variables we can simulate paths for each of them in a risk-neutral world to

calculate the values for the derivative

Page 271: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 270

Sampling from Normal Distribution

� The simplest way to sample from N(0,1) :

� Generate 12 random numbers between 0.0 & 1.0� use the Excel function alea() (=random())

� Sum them up and subtract 6.0

� Exercise: calculate the mean and the variance of V=U1 + U2 … +U12 - 6

� In Excel =LOI.NORMALE.INVERSE(ALEA();0;1)gives a random sample from N(0,1)

Page 272: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 271

Example: pricing a call option

� for i=1…N� Generate standard normal variable Ui� Set Si(T) = S(0) exp[ (r-½σ2)T+ √T Ui]� Set Calli = e-rT max(Si(T)-K,0)

� Call = (Call1+…+ CallN)/N

� Exercise: show that this converges to the result given by the Black-Scholes formula

Page 273: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 272

Confidence interval

� Calculate the standard deviation of the Monte Carlo result

� For a 95% confidence interval find z /2=Ninv(1- /2) with =5%� Ninv is the inverse cumulative normal function� 95% confidence interval means =5% and z /2=1.96

� The confidence interval is within the values� Average - zδ/2 · SD/√n� Average + z /2 · SD/√n

( )∑=

=N

iiN 1

2Average-Result1SD

Page 274: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 273

Obtain two correlated Normal Samples

� Obtain independent normal samples x1 and x2 and set

� A procedure known as Cholesky’s decomposition� =[-1…1] measures correlation:

� =1 then 1= 2 : perfect correlation� =0 then 1= x1 and 2 =x1 : no correlation� =-1 then 1=-ε2 : perfect anti-correlation

� Used when samples are required from two (or more) normal variables

� Exercise: show that the correlation between 1 and 2 is

2212

11

1 ρ−+ρ=ε=ε

xxx

Page 275: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 274

Cholesky exercise

� x,y,z are three correlated random variables. Find the correct coefficients in

� so that

� Considering that are uncorrelated

321

21

1

εεεεε

ε

⋅+⋅+⋅=⋅+⋅=

=

fdczbay

x

[ ] [ ] [ ][ ] [ ] [ ] 1E1E1E

EEE222 ===

=⋅=⋅=⋅

zyx

zyzxyx yzxzxy ρρρ

( )1,0~,, 321 Nεεε

Page 276: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 275

Application of Monte Carlo Simulation

� Monte Carlo simulation can deal with � path dependent options (e.g. Asians, barriers,…)� options dependent on several underlying state variables (e.g. Forex & interest rates)

� options with complex payoffs

� It cannot easily deal with American-style options

Page 277: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 276

Example: pricing an Asian call option

� An Asian option averages the payoff spot over several intermediate dates T1,… ,TN

� This is a path-dependent option

� for i=1… nbrPaths� for j=1… N

� Generate standard normal variable Ui,j� Set Si(Tj) = S(Tj-1) exp[(r-½σ2)(Tj-Tj-1)+ √(Tj-Tj-1) Ui,j]

� Set meanSpoti =(Si(T1)+…+Si(TN))/N� Set Calli = e-rT max(meanSpoti-K,0)

� Call = (Call1+…+ CallN)/N

−= ∑

=

N

iT KS

N i1

0,1maxAsian

Page 278: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 277

Monte Carlo and barrier options� If the barrier monitored continuously, it requires a simulation withmany points:

� What happens between ti and ti+1 is unknown. Was the barriertouched ?� Put more points (CPU time increases!), or � Smarter : Compute the pobability of touching the barrier between ti and ti+1

( ) )t-t()t-t(2/ˆ i1ii1i2

)()1( ++ +−=+ ieiSiS εσσµ

Page 279: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 278

Monte Carlo and barrier options� Estimating probability of not touching barrier:

� Total survival probability:

� Knock-out option = DF · Payoff(S) · Psurv

NN ttsurv

ttsurv

ttsurv PPPP →→→ −⋅⋅⋅= 13221

surv L

Page 280: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 279

Monte Carlo and barrier options

� For knock-in options we use the decomposition

� KI = Vanilla – KO

� and we price the two right-hand side instruments based again on the survival probability formula

Page 281: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 280

Determining Greek Letters

� For ∆� Make a small change to asset price� Carry out the simulation again using the same random numbers

� Estimate ∆ as the change in the option price divided by the change in the asset price

� Proceed in a similar manner for other Greek lettersdS

dSSdSS⋅

−−+=∆

2)(Price)(Price 00

2000

)()(Price)(Price2)(Price

dSdSSSdSS −+⋅−+

=Γ( ) ( )

σσσσ

∆−∆+

=PricePriceVega

Page 282: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 281

Demonstration XL

Monte-Carlo

Page 283: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 282

Finite Difference Methods

� Finite difference methods represent the differential equation as a difference equation

� Practically speaking, we transform

� into

� and we solve for P(t): the price at the previous time step� is the risk-neutral drift

PrSPS

SPS

tP

⋅=∂∂

⋅⋅⋅+∂∂

⋅⋅+∂∂

2

222

21 σµ

PrS

SSPSPSSPSS

SSPSSPSt

tPttP⋅=

∆∆−+−∆+

⋅⋅+∆⋅

∆−−∆+⋅⋅+

∆−∆+

222 )()(2)(

21

2)()()()( σµ

Page 284: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 283

Finite Difference Methods: the main idea

� We form a grid with equally spaced time-values and stock-price values

� Define ƒi,j as the value of ƒ at time i∆t when the stock price is j∆S� Knowing the payoff at maturity we solve PDE backwards till T=today

time

Spot

today maturity

strike

Call payoff: f

fi,j

i

j

Page 285: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 284

Finite Difference Methods: an example (1)

� Consider the simplified equation

� It implies that

� Isolate C(S,t) on the left-hand side:

2

222

21

SCS

tC

∂∂

⋅⋅⋅−=∂∂ σ

⇒∆

∆+∆−+∆+−∆+∆+⋅⋅−=

∆−∆+

222 ),(),(2),(

21),(),(

SttSSCttSCttSSCS

ttSCttSC σ

∆+∆−+∆+⋅

∆∆

⋅−−∆+∆+⋅

∆∆

⋅⋅⋅= ),(),(22),(21),(

2

22222 ttSSCttSC

tS

SttSSC

StStSC

σσ

Black-Scholes equation for r=q=0

Page 286: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 285

Finite Difference Methods: an example (2)

� This means that if we know the value of P at time t+ t and for spot values S-∆ S, S, S+ S we can immediately obtain P(S,t)

� Example: Call option with maturity 1y, strike 95, vol 10%� We solve backwards starting from the (known) payoff at maturity

Spot 80 90 100 110 120

+⋅

∆∆

⋅−−⋅

∆∆

⋅⋅⋅= ∆−∆+∆+

∆+∆+

SStt

Stt

SStt

St CC

tS

SC

StSC

2

22222 22

21

σσ

Value 0 0 5 15 25

Page 287: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 286

Finite Difference Methods� Explicit method� Spot derivatives are calculated at t=(i+1)· t

� Implicit method� Spot derivatives are calculated at t=i· t

21,1,11,1

2

2

1,11,1

,,1

)(2

2

Sfff

Sf

Sff

Sf

tff

tf

jijiji

jiji

jiji

+−=

∂∂

∆⋅

−=

∂∂

−=

∂∂

−++++

−+++

+

21,,1,

2

2

1,1,

,,1

)(2

2

Sfff

Sf

Sff

Sf

tff

tf

jijiji

jiji

jiji

+−=

∂∂

∆⋅

−=

∂∂

−=

∂∂

−+

−+

+

Page 288: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 287

Explicit method

� The difference equation becomes

� and after some re-arrangement:

� more compactly:

� For i+1 =Tmat the function fi+1,j is fully known� Solve above equation iteratively for fi,j in every (i,j) until i=today

jijijijijijijiji fr

Sfff

SjSff

Sjt

ff,12

1,1,11,1221,11,1,,1

)(2

)(21

2 +−++++−++++ ⋅=

+⋅−∆⋅+

∆⋅

−⋅∆⋅+

−σµ

( )

∆+∆+∆−∆−+

∆−∆= +++−+ tjtjftrtjftjtjff jijijiji µσσµσ

21

211

21

21 22

1,122

,122

1,1,

jjijjijjiji CfBfAff ⋅+⋅+⋅= +++−+ 1,1,11,1,

Page 289: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 288

Explicit method schematically � To calculate the option value at

the boundary spots � Smin (with j=1)� Smax (with j=nbrSpots)we need extra equations, the boundary conditions

� We obtain these by requiring that at very low and very high spots the option has no convexity:

� This implies:

time=i t time=(i+1) t

Spot = (j+1) S

Spot = j S

Spot = (j-1) S

0)1()(2)1(02

2

=−+−+⇒=∂∂ jCjCjCSC

)2()1(2)()3()2(2)1(−−−=

−=NCNCNC

CCC

Page 290: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 289

Explicit method at work

� PDE solution with� 100 time steps� 100 spots � t = 0.005� S = 0.025

� converges to the correct Black-Scholes solution

Page 291: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 290

Explicit method (not) at work

� Unstable if number of time-steps is not big enough

� Oscillations are produced and propagate to all spots

Page 292: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 291

Implicit method� More complex but avoids instabilities of explicit method

� The difference equation becomes

� and after some re-arrangement:

� more compactly:

� For i+1 =Tmat the function fi+1,j is fully known� Solve above equation iteratively for fi,j in every (i,j) until i=today

jijijijijijijiji fr

Sfff

SjSff

Sjt

ff,2

1,,1,221,1,,,1

)(2

)(21

2⋅=

+⋅−∆⋅+

∆⋅

−⋅∆⋅+

− −+−++ σµ

( ) jijijiji ftjtjftrtjftjtjf ,122

1,22

,22

1, 21

211

21

21

++− =

∆−∆−+∆+∆++

∆+∆− µσσµσ

jijjijjijji fCfBfAf ,11,,1, ++− =⋅−⋅+⋅

Page 293: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 292

Implicit method schematically

� 1 equation, 3 unknowns !� We have to solve the entire system of equations for each time step

� Linear algebra methods� LU decomposition

� Boundary conditions remain as before

time=i t time=(i+1) t

Spot = (j+1) S

Spot = j S

Spot = (j-1) S

Page 294: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 293

Explicit vs Implicit methods

� In practise we use a combination of the two methods� Crank-Nicolson method� Combines efficiency and stability

Page 295: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 294

Risk management and calculation of VAR

Page 296: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 295

VAR (Value At Risk)� VAR is a measure of market risk on a group of assets.

� Def: Maximum loss that can be reached in x days such thatthere is a small probability p that the realised loss is bigger.

� It can be calculated at different levels: single portfolios, smallgroup of portfolios, bank portfolios,…

� It is not additive (diversification effect)

� It computes the amount of capital the bank must hold to cover its risks� Bassel accord: p=1%, x=10 days.

Page 297: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 296

VAR: historical approach

� identify the parameters of the market that influence the value of the portfolio:� V=f(S1, S2, …..)� Si: Forex spots, swap rates, market vols, etc

� on a large sample of historical data (two or more years), calculate the daily returns of these market parameters:

( ) ( )( )1

1)(−

−−=

tStStSt

i

iiiα

Page 298: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 297

� Apply these returns from the past to today’smarket data and recalculate the value of the portfolio� Vj=f(S1·α1(t0-j), S2·α2(t0-j), …..)� j=1→N (number of daily observations)

� For each scenario replayed, calculate the profit or loss:� PLj= Vj- V0

� Order the PnL from the smaller (great loss) to the larger (great gain)

VAR: historical approach

Page 299: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 298

p=5%

Var is the largest value such that at least (1-p) of observations are above it

Page 300: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 299

Temporal extrapolation

� The VAR obtained in this way corresponds to a horizon of « 1-day »

� Assuming the daily increments are i.i.d.� Independent� Identically distributed

nVARnVAR )day 1()days( =

Page 301: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 300

Quantile extrapolation

� The VAR previously obtained are for p=5%� Assuming the observations of PnL are normallydistributed

� N-1(p): inverse cumulative normal function

)()(

)()(1

12

1

12 pNpN

pVARpVAR −

⋅=

Page 302: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 301

Example

� The 5% VAR of 1-day is 42,000$, what is the value of 10-day 1% VAR?

Page 303: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 302

Disadvantages of historical VAR� It is based on historical data. Implicitly assumes that the markets will behave in the

future as they behaved in the past.

� It reduces the measure of risk to a single digit. This does not necessarily representthe potential damage

The two distributions have the same VAR!

Page 304: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 303

Conditional VAR (CVAR)� Measurement of the average loss exceeding VAR

The two distributions do not have the same CVAR !

Page 305: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 304

VAR: different possible implementations� Historical simulation

� Advantages� Easy to calculate� Matches data distributions

� Disadvantages� Depends on limited experience (past data)� not enough extreme events

� Monte-Carlo simulation: daily returns are randomly sampled based on a model� Advantages

� Can generate lots of data & scenarios� Disadvantages

� Introduces «model risk»: dependence on the assumed distibution of daily returns

Page 306: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 305

� VAR for a continuous distribution

∞−

∞−

+∞

=

=

VAR

VARVAR

dxxf

dxxxfCVAR

dxxfp

)(

)(

)(

VAR: some useful identities

Page 307: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 306

Introduction to Credit Risk

Page 308: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 307

Merton’s « Default Risk Model » (1)

� A company has asset value At

� This company has debt D� The company has equity value Et

� The company� Can pay its debt if At>D. Then Et=At-D� Cannot pay its debt if At<D . Then Et=0

� The company’s equity value is Et=max(At-D,0)

� This is equivalent to the payoff of a call !

Page 309: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 308

Merton’s « Default Risk Model » (2)

� Similar analysis to Black-Scholes model� Interested in: asset value and the probability of default

� Assume that assets follow geometric brownian motion:

� Equivalent analysis as in Black-Scholes gives the equity value today:

dWAdtArdA A ⋅⋅+⋅⋅= σ

( ) ( )2100 dNeDdNAE rT−⋅−⋅= TddTT

DeA

d AAA

rT

σσσ

−=+

= 12

0

1 21ln

Risk-free rate

Asset volatility

Page 310: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 309

Merton’s « Default Risk Model » (3)

� The amount of debt D today is worth D*=De-rT. Define L=D*/A as a measure of leverage. Then from the previous equation

� This equation gives us the value of the company’s assets today A0� But how do we calculate the volatility of the assets?� (assets = value of company’s buildings, of people working there, etc) � This is not directly observable !

( ) ( )( )2100 dNLdNAE ⋅−=

TddTTLd AA

A

σσσ

−=+−

= 121 21ln

Page 311: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 310

Merton’s « Default Risk Model » (4)

� Since the equity value is a function of the asset value E=E(A), we use Ito’s Lemma:

� With

� Equalising the left- and right-hand side (the dW terms) gives

� We have expressed in terms of which is observable !

( )22

2

21 dA

AEdA

AEdt

tEdE

∂∂

+∂∂

+∂∂

=

dWAdtArdA A ⋅⋅+⋅⋅= σ dWEdtErdE E ⋅⋅+⋅⋅= σ

AAEE AE ⋅

∂∂

=⋅ σσ

Aσ Eσ

Vol of equity

Page 312: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 311

Merton’s « Default Risk Model » (5)

� From this equation and the Black-Scholes equity price formula

� we obtain

� From these equations we know and we solve them to obtain

� Then the probability of default can be computed: it is the probability that the “call” will be out of the money, i.e.

( )( ) ( )21

1

dNLdNdNA

E ⋅−⋅

=σσ

AA σ,0

( ) ( )( )2100 dNLdNAE ⋅−=

TLE E ,,,0 σ

( )2PD dN −=

Page 313: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 312

Two possible measures of the default probability:

� Actuarial: we measure the credit risk on statisticalbasis of default of payment. Data produced by rating agencies.

� Implicit: deducing the default risk of certain marketprices.

Page 314: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 313

Actuarial measure of the default risk (1)

Page 315: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 314

Actuarial measure of the default risk (2)

Page 316: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 315

Actuarial measure of the default risk (3)

� Marginal default rate during a period T: Probability of default during the year T, given that no default has occurred inprevious years dT

� Cumulative rate of default between 0 and T:probability that at least one default occurs between 0 and T: CT� Link between CT and dT……

� Survival rate between 0 and T :� St=(1-d1)⋅(1-d2)…⋅(1-dT)

Page 317: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 316

Actuarial measure of the default risk (4)

� The measurement of default rates over a long period of time may be problematic (small sample)

� A more robust approach: Transition probabilityfrom one state to another:

Example : a company with a rating « B » has a probability of

12% to be upgraded to « A » within a year.

Page 318: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 317

� What is the cumulative probability that a companycurrently rated as « A » faces default in the next 3 years?

Exercise

Page 319: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 318

Trading in the real world

Page 320: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 319

Classical theory of financial markets

� Efficient market hypothesis� Assumes: All information concerning a financial asset is already incorporated into the current price

� Implies: risk-free profit is impossible, traders are completely rational

� Asset increments are

� Independent from one tick to the next

� Identically distributed

� Normally distributed

( ) ( )( ) )1(

)(log11)(

−≈

−−−

=∆tStS

tStStStS

Page 321: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 320

Market empirical (stylized) facts

� Fat tails� The market-realised distribution of log-returns is not Normal

� Opposite graph� S&P500 density of log-returns� Normal density with same mean and variance

� Y-axis in log-scale

� Example: � Probability of a daily move of -6%� Market: 0.02%� Normal: 0.000005%

Page 322: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 321

Market empirical (stylized) facts

� Volatility clustering� Periods of high volatility� Periods of low volatility

� Not reproduced by a time series of normal N(0,1) increments

Page 323: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 322

Market empirical (stylized) facts

� Decaying autocorrelations

� Dependence of market-returns between different times

� Graph opposite

as function of

where1

1

−−=

t

ttt S

SSx

[ ]τ+⋅ tt xxE

Page 324: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 323

A simple trading strategy: Pairs trading

� Find two stocks that are consistently correlated

� Wait till one of them breaks the pattern

� Then buy the cheap one, sell the expensive one

� Wait till the trend reverses to the normal pattern

� Then close the position

Page 325: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 324

Pairs trading at work� Several implementations exist. A possible one:

� Measure distances between stocks, Sa and S b, across timeseries

� When the distance is too far away from the mean: trade

� Backtest the algorithm and optimise through modifying� Distance threshold (based on e.g. multiple of the standard deviation)� Size of data� Asset classes of stocks� The measure of distance (alternative to above can be correlation)� …

( )∑=

−=N

iibiaba tStSd

0

2, )()(

Page 326: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 325

Pairs trading at work: an example

� Algorithm gives signals for distances higher than 1.5·standard deviation of the mean

Page 327: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 326

Kelly’s criterion

� You are a gambler

� You know your game and you win with probability 55%

� How much of your capital should you bet each time ?

Historical background� J L Kelly (1956)� Bells’ labs USA� Develops analysis for maximizing expected capital

� Mathematician Ed Thorp uses the analysis at Las Vegas casinos

� Reportedly made fortune� Author of best-seller book “Beat the Dealer” 1962700,000 copies sold

� Founder of hedge fund

Page 328: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 327

Kelly’s criterion for coin-tossing

Notation� You played N times

� Number of times you won: W� Number of times you lost: L

� Win probability p=W/N� Lose probability q=1-p

� Initial capital X0

Strategy� Each time you bet a fraction of your

remaining capital fExample:

� 1st time:� Capital to bet: f ·X0� Capital that remains: (1- f) ·X0� This time you lose

� 2nd time: � Capital to bet: f ·(1- f )·X0� Capital that remains: (1- f) ·(1- f) ·X0� …

� After n rounds� Capital that remains: (1- f)L ·(1+ f)W ·X0

Page 329: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 328

Kelly’s criterion for coin-tossing

� Remaining capital after n rounds Xn=(1- f)L ·(1+ f)W ·X0

� Ratio (in logarithm):

� Take expectations:

)1log()1log(log)(

1

0

fnLf

nW

XXfG

nn

n −++=

=

)1log()1log(

)1log()1log(E)(

fqfp

fnLf

nWfg

−⋅++⋅=

−++=

Page 330: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 329

Kelly’s criterion for coin-tossing

Choose� fopt maximizes the Kelly function� This is the optimal fraction that leads to the maximal expected capital

Avoid� “Ruin” fraction fruin that leads to a negative capital: you lose all your money

� fopt =p-q

Page 331: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 330

References

� Options, futures and otherderivativesJ. Hull (2008) Prentice Hall

� Monte Carlo Methods in FinanceP. Jäckel (2003) Wiley

� Stochastic Calculus for Finance II: Continuous-Time ModelsS. Shreve (2004) Springer Finance

� Pricing Financial Instruments: The finite-difference methodD. Tavella and C. Randal (2000) Wiley

� Monte Carlo methods in financialengineeringP. Glasserman (2000) Springer

� Paul Wilmott on Quantitative Finance 3 Vol SetPaul Wilmott (2000) Wiley

� The Concepts and Practice of Mathematical FinanceM. Joshi (2003) Cambridge Univ Press

� Financial Risk Manager HandbookP. Jorion (2009) Wiley Finance

Page 332: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 331

Exercises:1. Decompose the following strategies into simple Call and Put positions (short or long).

Discuss advantages and disadvantages of each of the strategies

2. Integrate numerically the function exp(-x²/2) between –4 and +4, using an interval of dx=0.01. The answer must be close to √2π due to the normalisation property of the normal distribution function. Also integrate the function exp(-(x-1)²/2). The answershould be the same as before (explain why).

3. Differentiate numerically and analytically the function exp(-x²/2).

4. Write a program in VBA that calculates the functions min(a,b) and max(a,b) using the min / max of two numbers.

5. Write a program in VBA to generate a brownian motion W(t). The input parametersare: the number of time steps, the final time. As an output, the function should return the simulated trajectory.

Page 333: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 332

Exercices:6. Use the function of exercise 4 to calculate the variance of the final value

of a brownian trajectory (10 time steps spaced by 3 sec), on the basis of 1000 realisations.

7. Using Excel or VBA show that the variance of random variable is givenby a difference in means: V(X) = E(X²)-(E(X))²

8. What are (i) the mean (ii) the standard deviation of returns of the index EUROSTOXX50, if we consider that it follows the law a+bX where X isa normal gaussian variable (a and b are 2 constants) ?

9. Using Excel or VBA calculate the mean and the variance of eaX where X is a guassian normal random variable. Compare against the exact analytic result.

10. Using Excel or VBA calculate the expectation of S=e(r-q-σ²/2)T+Xσ√T where X is a guassian normal random variable . Compare against the exact analytic result.

11. Write a programe in VBA to compute a Black-Scholes pricer (analyticformula) for a Call option: Call(S, K, σ, r, q, T).

Page 334: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 333

Exercises:12. Compare the price of a simple call option to the price call with a barrier

where the barrier level H increases .

13. What is the value of a 3m call on EUR/USD, rEUR = 4%, rUSD = 5% vol=25%, K=1.3 for different values of the spot. For each point of the curvecalculate the Delta using finite differences and the analytic formula. If S=1.27, what is the cost of an option on 1,000,000 EUR notional? And on an option on 1,000,000 USD notional?

14. Show that for small ∆t, the relations

15. Derive the density function of a logNormal random variable.

16. Calculate the mean and the variance of a log-normal density withparameters µ, σ .

tqr

t

t

eadudap

ed

eu

∆−

∆σ−

∆σ

=−−

=

=

=

)(

are solutions of dudep

tqr

−−

=∆− )(

σ2∆t = pu2 + (1– p )d 2 – e2(r-q)∆t

u = 1/ d

Page 335: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 334

Exercises:17. Calculate with Monte Carlo the value of an Asian put option and compare

with the value of the corresponding vanilla put. How do you explain the difference in the prices?

18. Calculate the number π using a Monte-Carlo method

19. Programm a VBA function allowing the pricing of a Call with Monte-Carlo: Call(S, K, s, r, q, T, Nsimu). Compare with the exact solution from Black-Scholes formula

20. Show that the variables 1, 2 obtained from Cholesky’s decomposition have a correlation equal to

21. Compute analytically the Delta, Gamma and Vega of a Put option

2212

11

1 ρρε

ε

−+=

=

xx

x

Page 336: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 335

Exercises:22. Using Itô’s lemma, and starting from the differential equation of Black-Scholes

dS=µSdt+σSdW, calculate the differential of ln(S). Derive an expression for S(t).

23. Using Itô’s lemma compute the stochastic differential of the variable Z=X·Y where X and Y are stochastic variables. Repeat the same for the variable Z=X/Y.

24. Calculate the price of a digital option (at maturity it pays 1 unit of underlying if ST>K). Write a VBA program that calculates with Monte Carlo simulations.

25. Calculate the price of a knock-out option using Monte Carlo and the formula for the surviving probabilities

26. Price a put option using the explicit PDE method and compare the result to the Black-Scholes formula.

27. Bachelier vs Black-Scholes: Price a call option with the monte carlo methodusing (i) brownian motion (Bachelier model) and (ii) geometric brownianmotion (Black-Scholes model).

Page 337: Computational methods in finance - KU Leuvennikos/papers/methodsinfinance.pdf · 2012-01-01 · v9va ?9gg 9pp / . ! ˘ #$

Nikos Skantzos IAE Toulouse 2011-12 336

Exercises:28. Find the stochastic derivatives of the process: Xt=Wt

2-t and Xt=Wt2-Wt ·t

29. Write a Monte Carlo program in VBA that simulates a coin-tossing game and verify that the optimal fraction of capital fopt proven by Kelly leads to the maximum expected capital

30. Demonstrate that if Wt is a brownian motion then E[(Wt-Ws)2]=t-s

31. Write a VBA program that generates variables of a normal distribution of mean and variance using the VBA uniform random number generator. Calculate the mean and the variance of the samples.

32. Write an Excel method that calculates the cumulative function of a normal density function e-x*x/2/√(2 )

33. Using Excel calculate Black-Scholes spotladder (price of a call option for various spot levels) for different values of (i) volatility, (ii) maturity, (iii) rates. What is the impact of each of these on the price of the option?

34. Write a VBA function that calculates the root of f(x)=(x-2)2-1 from x=2 to x=4 using the bisection method