Library: | finance |
See also: | HestonVanilla HestonVanillaSSE GarmanKohlhagen GaussLegendre |
Quantlet: | HestonVanillaFitSmile | |
Description: | fits the Heston model to the FX market implied volatility smile. |
Usage: | {v0,vv,kappa,theta,rho,IV,SSE} = HestonVanillaFitSmile(delta,marketvols,spot,rd,rf,tau,phi) | |
Input: | ||
delta | n x 1 vector, delta pillars | |
marketvols | n x 1 vector, market implied volatilities | |
spot | scalar, spot price | |
rd | scalar, domestic interest rate | |
rf | scalar, foreign interest rate | |
tau | scalar, maturity (in years) | |
phi | scalar, phi = 1 - call option, phi = -1 - put option | |
Output: | ||
v0 | scalar, initial volatility | |
vv | scalar, vol of vol | |
kappa | scalar, mean reversion | |
theta | scalar, long-run mean | |
rho | scalar, correlation | |
IV | n x 1 vector, implied volatilities assuming the Garman-Kohlhagen model | |
SSE | scalar, sum of squared errors |
library("finance") ;Marketvols July 1, 2004 delta = #(0.1, 0.25, 0.5, 0.75, 0.9) Marketvols = #(0.106, 0.1015, 0.1005, 0.1025, 0.107) ;interest rates July 1, 2004 Rd = 0.02055 Rf = 0.01305 Tau = 7/365 Spot = 1.215 ; spot on July 1, 2004 Phi = 1 ; call option fit = HestonVanillaFitSmile(delta,Marketvols,Spot,Rd,Rf,Tau,Phi) fit
Contents of fit.v0 [1,] 0.0101 Contents of fit.vv [1,] 0.0087383 Contents of fit.kappa [1,] 1.5 Contents of fit.theta [1,] 0.14094 Contents of fit.rho [1,] -0.025377 Contents of fit.IV [1,] 0.11621 [2,] 0.098227 [3,] 0.095177 [4,] 0.098164 [5,] 0.11617 Contents of fit.SSE [1,] 0.00024612