From: Michael H. <Mic...@gm...> - 2009-04-17 19:01:13
|
Hello Gaurav, --------- citation -------- Apology if I was not clear. This is what I want to do: (1) calibrate the heston model using market data & historical volatility. When I say, calibration of heston model, I mean to estimate kappa, theta, rho, sigma and v0. I will provide the other parameter like dividend rate, interest rate, strike price, option price, maturity Date. Is it possible? Is there any sample code for the same? ---------------------------- Well, that is the normal approach. You provide the parameters like dividend rate, interest rate, strike prices, option prices and maturities for a set of liquid market instruments. Then you can calibrate (i.e. estimate) the heston parameters. You find a sample code for that in the testsuit. What I don't really understand is why you want to use historical volatility? When calibrating Heston Model to market data, you normally use the implied volatilities. What you really need is a set of option prices for liquid market instruments on your underlying with different strikes and maturities. But those are in general expressed in BlackScholes implied volatilities. I will try to roughly explain how the Heston calibration works: 1) You take a set of liquid market options on your underlying (in general this are plain vanilla call options) 2) You can get the prices from the market and express it in Black Scholes implied volatilities. (you don't really need the black scholes, but it is market convention to express plain vanilla option prices in black scholes implied volatility. Nevertheless, what you need are the option prices) 3) you ably choose a starting set of the Heston parameters. I.e. you set kappa, theta, rho, sigma and v0 to some arbitrary values. But be aware the better you choose the starting parameters the better your calibration success will be. Although the non-linear optimization algorithm used is the Levenberg-Marquardt algorithm and it is known for producing good calibration results independently of how good you chose the starting parameters, I personally figured that the smarter you chose the starting parameters, the better the calibration will be. You can control the calibration success by checking the calibrationErrors provided by Quantlib. (if you wonder how to chose the starting parameters clever, I can write you some extra mails with references etc. but this would be to much for one email ...) 4) In plain terms what happens next when you start the calibration of your heston model is the following. The calibration process tries to reproduce the given option prices of your liquid market instrument with your Heston Model. If it cant reproduce them properly it adjusts the Heston Parameters in the right direction and tries again, till it can reproduce the option prices of your liquid market instruments sufficiently good (or one of the other End-Criterias forced our calibration process to stop). You will end up with a calibrated Heston Model. Once again: where and how are you planning on using the historical volatilities? I still didn't get that part?? --------- citation -------- (2) Once model is calibrated we want to draw the stochastic volatility surface. I will be giving some strike price and would try to get stochastic volatility for some periods like volatility at 15 days, 1 months, 2 months, 3 month (100 points like) so that I can plot that curve on the screen for each strike price. Once plotted for various various strike prices, it will look like surface. Is there any sample for that? I am not sure, how would I get stochastic volatility from calibrated heston model? which function to use? I don't see any function returning "volatility"? ---------------------------- What exactly do you mean by stochastic volatility surface? I have never heard of the term stochastic volatility surface. The volatility in the Heston model is a stochastic process. And since it is stochastic it does not produce one single surface. One could take the risk-neutral conditional expectation of the stochastic volatility process forward ATM (i.e. S(T)=K) and you would end up with the local variance at point (K,T). You could then produce a local variance or a local volatility surface. From there you get to the implied volatility surface. That works some how with path-integral representations (that is a bit tricky and I therefore decide to omit it here). But why do you want to go such a sophisticated approach. You can just extract the implied volatilities from the prices of your liquid market instruments that you were using for the calibration process by numerically solving the Black Scholes closed form solution for the implied volatility. Then you can interpolate (extrapolate) to get a complete surface. This is if the implied volatility surface is what you are looking for?? If not I need some more information what you mean by the "stochastic volatility surface". What you can do easily in quantlib is (once you have a calibrated heston model) use the calibration helpers to get out the implied volatility for a arbitrary plain vanilla European call/put option with any strike or maturity. If you like and you don't get along with the quantlib testsuit, I can quickly create a little program for you that calibrates a heston model to liquid market instruments, controls the calibration error and returns you the Heston Model implied volatility for a arbitrary call option with some random strike and maturity?? Greetings, Michael |