Evaluating the Greeks for the LIBOR Market Model using the ...

26
Evaluating the Greeks for the LIBOR Market Model using the Pathwise Adjoint on GPU Real-time hedging interest rates Grzegorz Kozikowski University of Manchester 17th June, ADWorkshop Sophia Antipolis 2014 1 / 24

Transcript of Evaluating the Greeks for the LIBOR Market Model using the ...

Page 1: Evaluating the Greeks for the LIBOR Market Model using the ...

Evaluating the Greeks for the LIBOR Market Modelusing the Pathwise Adjoint on GPU

Real-time hedging interest rates

Grzegorz Kozikowski

University of Manchester

17th June, ADWorkshopSophia Antipolis 2014

1 / 24

Page 2: Evaluating the Greeks for the LIBOR Market Model using the ...

Agenda

1 Context

2 LIBOR Market model & the Greeks

3 Solution

4 Computational Experiments

5 Conclusion

2 / 24

Page 3: Evaluating the Greeks for the LIBOR Market Model using the ...

A bit of terminology You must understand!

LIBOR – the average interest rate estimated by leading banks thatthey would be charged if borrowing from other banks

Option – a contract that gives an opportunity to buy or sell the assetin the future at a fixed price negotiated ”now”

Hedging - the method to compensate loss (gains) on the market bygains (loss) on the option market

Interest Rate – the rate at which interests are paid a lender by aborrower

Forward Interest Rate - the interest rate specified for a loan thatwill occur in the future

the Greeks – measure how model parameters (observable on themarket) affect the future predicted payoff

Question:

How to model the behaviour of LIBOR and predict Forward Interest Rates?

3 / 24

Page 4: Evaluating the Greeks for the LIBOR Market Model using the ...

How does LMM work? Why important?

4 / 24

Page 5: Evaluating the Greeks for the LIBOR Market Model using the ...

How does LMM work? Why important?

5 / 24

Page 6: Evaluating the Greeks for the LIBOR Market Model using the ...

How does LMM work? Why important?

6 / 24

Page 7: Evaluating the Greeks for the LIBOR Market Model using the ...

How does LMM work? Why important?

7 / 24

Page 8: Evaluating the Greeks for the LIBOR Market Model using the ...

How does LMM work? Why important?

8 / 24

Page 9: Evaluating the Greeks for the LIBOR Market Model using the ...

How does LMM work? Why important?

9 / 24

Page 10: Evaluating the Greeks for the LIBOR Market Model using the ...

How does LMM work? Why important?

10 / 24

Page 11: Evaluating the Greeks for the LIBOR Market Model using the ...

Why important? Contribution

Why important? More?

Many financial models are dependent on the LIBOR market model:

European interest rate products: swaps/swaptions

Bermudan interest rate products: swaps/swaptions

Exotic interest rate products: Snowball swaps

Cross currency exotic interest rate products

LIBOR settled at 1d, 1w, 2w, 1m, 2m ..., 12mTotal OTC interest rate derivatives turnover: 2.3 trillion $ (2013)This work can be applied to hedge and price above options!!!

Contribution

Most commercial products are sequential and use slow pathwise orinaccurate Finite Difference methods

..., but this must be accurate and work as fast as possible. How?

Solution: The LIBOR Market Model + the Adjoint + GPU11 / 24

Page 12: Evaluating the Greeks for the LIBOR Market Model using the ...

The Libor Market Model

Given a set of dates T1,T2, ...,TN−1,TN let:

Li (Tn), i > n, n = 1, 2, ...,N − 1,N (1)

be the forward interest rate at time Tn for the period dti = Ti+1 − Ti

dti T1 T2 T3 ... TN−2 TN−1 TN

dt1 L1(T1)dt2 L2(T1) L2(T2)dt3 L3(T1) L3(T2) L3(T3)

. . . .

. . . .

. . . .dtN−1 LN−1(T1) LN−1(T2) LN−1(T3) ... LN−1(TN−2)LN−1(TN−1)dtN LN(T1) LN(T2) LN(T3) ... LN(TN−2) LN(TN−1) LN(TN)

How to predict forward interest rates for different periods in the future?

12 / 24

Page 13: Evaluating the Greeks for the LIBOR Market Model using the ...

The Libor Market Model – a single scenario

Let Lni denote the forward LIBOR rate for the time dti = Ti+1 − Ti attime n (and i > n) then the evolution of the forward rates Lni forn = 0, ...,Nmat − 1 is expressed as:

Ln+1i = Lni exp((σi−n−1S

ni − 1

2σ2i−n−1)dti + σi−n−1Z

n√

(dti ), i > n (2)

where Zn is the random number with normal distribution, and σi−n−1 isthe interest rate volatility at time i and Sn

i is:

Sni =

i∑j=n+1

σj−n−1dtiLnj

1 + dtiLnj, i > n (3)

13 / 24

Page 14: Evaluating the Greeks for the LIBOR Market Model using the ...

The Libor Market Model – Monte-Carlo simulation

Expected LNi is estimated using the average of independent replications ofLNij with different Zn

LNi = E(LNi ) ≈∑Numpaths

j=0 LNijNumpaths

(4)

j - is the index representing the j-th replication(a scenario of Monte-Carlo simulation)

14 / 24

Page 15: Evaluating the Greeks for the LIBOR Market Model using the ...

Caplets - European options on interest rates

Definition

Caplet is an option in which the buyer receives payment when the interestrate exceeds the agreed strike price. Its payoff is:

pi = Nperiod

1yearmax(Li − Ki , 0) (5)

where N is the notional of money the buyer invests

Example

Suppose You own a caplet on the year US interest rate: 2.5 % that expirestomorrow. If tomorrow’s interest rate is 3 % and You have $ 1 millionthen You will gain:

$ 1 million max(0.03 − 0.025, 0) = $ 2500

15 / 24

Page 16: Evaluating the Greeks for the LIBOR Market Model using the ...

The Greeks for the Libor Market Model

The Greeks (risk sensitivities)

The first-order/second-order derivatives of the payoff with respect tomodel parameters

They measure how model parameters affect the future payoff

Traders hedge their portfolio – compensate loss (gain) on the marketby gain (loss) made on the derivatives market

the Greeks need to be constant over an investment period, butmarket prices fluctuate...

... thus, traders frequently rebalance their portfolio

For example, consider the Greek delta for the i-ith period (with respect tothe initial forward rate Li (T0)):

dpi (TN)

dLi (T0)=∂pi (TN)

∂Li (TN)

∂Li (TN)

∂Li (TN−1)

∂Li (TN−1)

∂Li (TN−2)...∂Li (T2)

∂Li (T1)

∂Li (T1)

∂Li (T0)(6)

16 / 24

Page 17: Evaluating the Greeks for the LIBOR Market Model using the ...

The Greeks for the Libor Market Model

For the LMM model we need to calculate all the Greeks for each period(each predicted forward interest rate)

dpi (TN)

dLi (T0)=∂pi (TN)

∂Li (TN)

∂Li (TN)

∂Li (TN−1)

∂Li (TN−1)

∂Li (TN−2)...∂Li (T2)

∂Li (T1)

∂Li (T1)

∂Li (T0)(7)

T1 T2 T3 ... TN−2 TN−1 TN∂L1(T1)∂L1(T0)

. ∂L2(T2)∂L2(T0)

. ∂L3(TN )∂L3(T0)

. . .

. . . ... . ∂LN−1(TN−1)∂LN−1(T0)

∂LN (T1)∂LN (T0) . . ... . . ∂LN (TN )

∂LN (T0)

The Greeks with respect to all the volatilities σni are also crucial.

All this work must be done for all the paths!!!

17 / 24

Page 18: Evaluating the Greeks for the LIBOR Market Model using the ...

Solution – the LMM Greeks and the Adjoint on a CPU

Remember Lni denotes the forward LIBOR rate for the timedti = Ti+1 − Ti at time n and i > n:

Ln+1i = Lni exp((σi−n−1S

ni − 1

2σ2i−n−1)dti + σi−n−1Z

n√

(dti ), i > n (8)

If Si for the i-th period is:

Sni =

i∑j=n+1

σj−n−1dtiLnj

1 + dtiLnj, i > n (9)

then Si+1 for the (i + 1)-th period is:

Sni+1 = Sn

i +σi−ndtiL

ni+1

1 + dtiLni+1

, i > n (10)

Recursive dependency important in an efficient implementation18 / 24

Page 19: Evaluating the Greeks for the LIBOR Market Model using the ...

Solution – the LMM Greeks and the Adjoint on a CPU

Therefore, to calculate the forward interest rate Li+1(Tk) at time Tk forthe (i + 1)-th period, we should use the previously calculated Sk

i (fromLi (Tk)) and add some additional factor:

σi−ndtiLki+1

1 + dtiLki+1

(11)

Note, this will need synchronization if the forward interest rates at time kfor different periods are calculated in parallel 19 / 24

Page 20: Evaluating the Greeks for the LIBOR Market Model using the ...

Solution – the LMM Greeks and the Adjoint on a CPU

All the partial derivatives: ∂Li (Tk+1)∂Li (Tk ) , ∂Si (Tk )

∂Li (Tk ) , ∂Li (Tk+1)

∂σki

, ∂Si (Tk )

∂σki

are

evaluated by the AdjointThrough the MC evolution the partial results are recursively updatedto produce the final Greeks

20 / 24

Page 21: Evaluating the Greeks for the LIBOR Market Model using the ...

Solution – the LMM Greeks and the Adjoint on a GPU

Each thread calculates the forward interest rate for the i-th period(Each ”row” is processed by a single thread)Each thread block calculates a MC scenario with different tenor dates

21 / 24

Page 22: Evaluating the Greeks for the LIBOR Market Model using the ...

Computational Experiments

CPU execution times & Speedup - The first-order LMM Greeks(N = 1024 different periods, forward interest rates)

Numberof paths

CPU time(seconds)

CUDA(2050)

OpenCL(2050)

CUDA(K40)

OpenCL(K40)

100 27 42x 41x 49x 47x200 54 44x 43x 48x 48x300 82 44x 43x 48x 49x400 109 44x 44x 48x 49x500 136 44x 44x 48x 49x

1000 272 45x 44x 48x 49x

Test Environment:

CPU: an Intel Xeon Sandybridge X5650 2.66 Ghz (16 cores)

CUDA and OpenCL: an NVIDIA Tesla M2070 (448 cores) and anNVIDIA K40c (2880 cores)

Both parallel and sequential libraries were compiled with the optimization commands

--use_fast_math --ptxas-options=-v,-O3

22 / 24

Page 23: Evaluating the Greeks for the LIBOR Market Model using the ...

Computational Experiments

Speedup - The first-order LMM Greeks(N = 1024 different periods, forward interest rates)

40

42

44

46

48

50

52

54

100 200 300 400 500 600 700 800 900 1000

Spe

edup

Number of paths

LegendOpenCL (M2070)

OpenCL (K40)CUDA (M2070)

CUDA (K40)

23 / 24

Page 24: Evaluating the Greeks for the LIBOR Market Model using the ...

Conclusion

Monte Carlo simulation + GPU + Pathwise Adjoint for the LIBOR marketmodel:

increases performance of Monte-Carlo simulaton for the LIBORmarket model

is much faster than any other numerical methods (pathwise, FD,likelihood) – see, the LMM work of Prof. Mike Giles (University ofOxford)

reduces a computational effort of the Greeks′ calculation by threeorders of magnitude

improves accuracy of the Greeks in comparison to pathwise, FD orlikelihood methods(a single Monte-Carlo sweep for the gradient = many fewercalculations)

24 / 24

Page 25: Evaluating the Greeks for the LIBOR Market Model using the ...

Bibliography

Grzegorz Kozikowski, Towards Real-time Risk Management: evaluating first and second-order Greeks using Automatic

Differentiation on HPC, 2014

Grzegorz Kozikowski, Parallel approach to Monte-Carlo simulation for Option Price Sensitivities using the Adjoint and

Interval Analysis, 2014

Dariusz Gatarek, The LIBOR market model in practice, Wiley, 2006

Nick Denson and Mark Joshi, Fast and accurate Greeks for the LIBOR market model

Michael Giles, Monte Carlo evaluation of sensitivities in computational finance, 2012

John Hull, Options, Futures and other derivatives, 2012

24 / 24

Page 26: Evaluating the Greeks for the LIBOR Market Model using the ...

Thank You

Thank You very muchfor Your attention

24 / 24