stochastic local volatility in quantlib
play

Stochastic Local Volatility in QuantLib J. Gttker-Schnetmann, K. - PowerPoint PPT Presentation

Stochastic Local Volatility in QuantLib J. Gttker-Schnetmann, K. Spanderen QuantLib User Meeting 2014 Dsseldorf 2014-12-06 Gttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 1 / 41 Heston Stochastic Local


  1. Stochastic Local Volatility in QuantLib J. Göttker-Schnetmann, K. Spanderen QuantLib User Meeting 2014 Düsseldorf 2014-12-06 Göttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 1 / 41

  2. Heston Stochastic Local Volatility Fokker-Planck Equations Square Root Process Boundary Conditions Coordinate and Density Transformations Calibration Göttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 2 / 41

  3. Local Volatility [Dupire 1994] Local Volatility σ LV ( S , t ) as function of spot level S t and time t : � r t − q t − 1 � 2 σ 2 = LV ( S , t ) dt + σ LV ( S , t ) dW t d ln S t � ∂ C ∂ T + ( r t − q t ) K ∂ C ∂ K + q t C � σ 2 LV ( S , t ) = � K 2 ∂ 2 C � ∂ K 2 � 2 K = S , T = t Consistent with option market prices. Model is often criticized for its unrealistic volatility dynamics. Dupire formula is mathematically appealing but also unstable. Göttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 3 / 41

  4. Stochastic Volatility [Heston 1993] Stochastic volatility given by a square-root process: � r t − q t − 1 � dt + √ ν t dW S d ln S t = 2 ν t t κ ( θ − ν t ) dt + σ √ ν t dW ν d ν t = t dW ν t dW S ρ dt = t Semi-analytical solution for European call option prices: SP 1 − Ke − ( r t − q t ) T P 2 C ( S 0 , K , ν 0 , T ) = � ∞ � � e − iu ln K φ j ( S 0 , K , ν 0 , T , u ) 1 2 + 1 P j = ℜ du iu π 0 More realistic volatility dynamics. Does often not exhibit enough skew for short dated expiries. Göttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 4 / 41

  5. Example: Differences in δ and γ The implied and local volatility surface is derived from the Heston model and therefore the option prices between all models match. S 0 = 5000 , κ = 5 . 66 , θ = 0 . 075 , σ = 1 . 16 , ρ = − 0 . 51 , ν 0 = 0 . 19 , T = 1 . 7 4 1.0 3*10 − Black-Scholes Heston Heston Mean Variance 0.8 Local Volatility 4 2*10 − 0.6 δ γ 4 0.4 1*10 − Black-Scholes Heston 0.2 Heston Mean Variance Local Volatility 0 2000 3000 4000 5000 6000 7000 8000 2000 3000 4000 5000 6000 7000 8000 Strike Strike Göttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 5 / 41

  6. Heston Stochastic Local Volatility Add leverage function L ( S t , t ) and mixing factor η : � r t − q t − 1 � dt + L ( S t , t ) √ ν t dW S 2 L ( S t , t ) 2 ν t d ln S t = t κ ( θ − ν t ) dt + ησ √ ν t dW ν = d ν t t dW ν t dW S ρ dt = t Leverage L ( x t , t ) is given by probability density p ( S t , ν, t ) and � � σ LV ( S t , t ) R + p ( S t , ν, t ) d ν L ( S t , t ) = = σ LV ( S t , t ) � � R + ν p ( S t , ν, t ) d ν E [ ν t | S = S t ] Mixing factor η tunes between stochastic and local volatility. Göttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 6 / 41

  7. Cheat Sheet: Link between SDE and PDE Starting point is a multidimensional SDE of the form: d x t = µ ( x t , t ) dt + σ ( x t , t ) d W t Feynman-Kac: price of a derivative u ( x t , t ) with boundary condition u ( x T , T ) at maturity T is given by: n n µ i ∂ x k u + 1 � σσ T � � � ∂ t u + kl ∂ x k ∂ x l u − ru = 0 2 k = 1 k , l = 1 Fokker-Planck: time evolution of the probability density function p ( x t , t ) with the initial condition p ( x , t = 0 ) = δ ( x − x 0 ) is given by: n n ∂ x k [ µ i p ] + 1 �� σσ T � � � � ∂ t p = − ∂ x k ∂ x l kl p 2 k = 1 k , l = 1 Göttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 7 / 41

  8. Backward Feynman-Kac Equation The SLV model leads to following Feynman-Kac equation for a function u : R × R ≥ 0 × R ≥ 0 → R , ( x , ν, t ) �→ u ( x , ν, t ) : ∂ t u + 1 x u + 1 2 L 2 ν∂ 2 2 η 2 σ 2 ν∂ 2 0 = ν u + ησνρ L ∂ x ∂ ν u � r − q − 1 � 2 L 2 ν + ∂ x u + κ ( θ − ν ) ∂ ν u − ru PDE can be solved using either Implict scheme (slow) or more advanced operator splitting schemes like modified Craig-Sneyd or Hundsdorfer-Verwer in conjunction with damping steps (fast). Implementation is mostly harmless, extend FdmHestonOp . Göttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 8 / 41

  9. Forward Fokker-Planck Equation The corresponding Fokker-Planck equation for the probability density p : R × R ≥ 0 × R ≥ 0 → R ≥ 0 , ( x , ν, t ) �→ p ( x , ν, t ) is: 1 + 1 � � 2 ∂ 2 L 2 ν p 2 η 2 σ 2 ∂ 2 ∂ t p = ν [ ν p ] + ησρ∂ x ∂ ν [ L ν p ] x �� � � r − q − 1 2 L 2 ν − ∂ x p − ∂ ν [ κ ( θ − ν ) p ] Numerical solution of the PDE is cumbersome due to difficult boundary conditions and the Dirac delta distribution as the initial condition. PDE can be efficiently solved using operator splitting schemes, preferable the modified Craig-Sneyd scheme Göttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 9 / 41

  10. Square Root Process Main issues of the implementation are caused by the square root process: d ν t = κ ( θ − ν t ) dt + σ √ ν t dW It has the following Fokker-Planck equation for the probability density p : R ≥ 0 × R ≥ 0 → R ≥ 0 , ( ν, t ) �→ p ( ν, t ) : ∂ t p = σ 2 2 ∂ 2 ν [ ν p ] − ∂ ν [ κ ( θ − ν ) p ] The stationary probability density ˆ p ( ν ) with ∂ t ˆ p ( ν ) = 0 is: p ( ν ) = β α ν α − 1 exp ( − βν )Γ( α ) − 1 , α = 2 κθ σ 2 , β = α ˆ θ Göttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 10 / 41

  11. Stationary Probability Density Stationary Distribution with θ =0.25 6  ∞ if α < 1  α =2.0 ν → 0 ˆ θ − 1 lim p ( ν ) = if α = 1 α =1.2 5 α =1.0 0 if α > 1  α =0.5 4 The square root process ν t ^( ν ) 3 p is strictly positive if the 2 Feller Condition α > 1 is met. 1 0 0.0 0.2 0.4 0.6 0.8 ν Göttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 11 / 41

  12. Boundary Condition The probability weight within [ ν min , ν max ] of p ( ν, t ) is evolving by: � ν max � ν max � σ 2 � 2 ∂ 2 ∂ t d ν p = d ν ν [ ν p ] − ∂ ν [ κ ( θ − ν ) p ] ν min ν min In order to avoid leaking of probability we enforce: � ν max ν max � σ 2 �� � ∂ t d ν p = 0 ⇒ 2 ∂ ν [ ν p ] − [ κ ( θ − ν ) p ] = 0 � � ν min ν min � σ 2 �� � ⇒ 2 ∂ ν [ ν p ] − [ κ ( θ − ν ) p ] = 0 � � ν = ν min ,ν max Zero Flux Boundary Condition Göttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 12 / 41

  13. Discretization On a non-uniform grid { z 1 , . . . , z n } the two-sided approximation of ∂ z f is: h 2 i − i f i + 1 + ( h 2 i − h 2 i − 1 ) f i − h 2 i f i − 1 ∂ z f ( z i ) ≈ h i − 1 h i ( h i − 1 + h i ) h i − 1 f i + 1 − f i h i f i − f i − 1 = + h i − 1 + h i h i h i − 1 + h i h i − 1 With h i := z i + 1 − z i and f i := f ( z i ) . The second order derivative is approximated by: h i − i f i + 1 − ( h i − 1 + h i ) f i + h i f i − 1 ∂ 2 z f ( z i ) ≈ 1 2 h i − 1 h i ( h i − 1 + h i ) Göttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 13 / 41

  14. Discretization Sort by factors of f i , set ζ i := h i h i − 1 ζ p := h i ( h i − 1 + h i ) i ζ m := h i − 1 ( h i − 1 + h i ) i then: h i − i f i + 1 + ( h i − h i − 1 ) f i − h i ∂ z f ( z i ) ≈ f i − 1 ζ p ζ m ζ i i i 2 f i + 1 − 2 f i + 2 ∂ 2 z f ( z i ) ≈ f i − 1 ζ p ζ m ζ i i i Göttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 14 / 41

  15. Discretization A general partial differential equation of the form ∂ t f = A ( z ) ∂ 2 z f + B ( z ) ∂ z f + C ( z ) f has therefore the spacial discretization: � − 2 A i + B i ( h i − h i − 1 ) � 2 A i + B i h i − i ∂ t f ( z i ) = f i + 1 + + C i f i ζ p ζ i i + 2 A i − B i h i f i − 1 ζ m i =: γ i f i + 1 + β i f i + α i f i − 1 Göttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 15 / 41

  16. Discretization This is interpreted as a tridiagonal transfer matrix T with diagonal β i , upper diagonal γ i , and lower diagonal α i :   β 1 γ 1 0 . . . 0 α 2 β 2 γ 2 . . .     0 α 3 β 3 γ 3 0 . . .     . T := ... ... ... .   . 0 0    .  .   . α n − 1 β n − 1 γ n − 1   α n β n Then     f 1 f 1 . . . .  = T ∂ t     . .    f n f n Göttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 16 / 41

  17. Boundary Condition Add z 0 below the lower boundary and z n + 1 above the upper boundary to the grid. The zero flux condition takes the general form � ! [ ∂ z A ( z , t ) f + B ( z , t ) f ] = 0 � � z = z 0 , z n + 1 Lower Boundary: The partial derivative is discretized by a second order forward differentiation, so that all terms are given by grid points 0 f 2 + ( h 1 + h 0 ) 2 f 1 − (( h 1 + h 0 ) 2 − h 2 − h 2 0 ) f 0 ∂ z f ( z 0 ) ≈ h 0 h 1 ( h 1 + h 0 ) f 2 + ( h 0 + h 1 ) f 1 − ( 2 h 0 + h 1 ) − h 0 = f 0 ζ p ζ m ζ 1 1 1 Göttker-Schnetmann, Spanderen Towards SLV in QuantLib QuantLib User Meeting 17 / 41

Recommend


More recommend