Hi,
I noticed that the following paper is listed as a reference in the analytichestonengine.cpp file. I also noticed that the same paper is mentioned in the test-suite/hestonmodel.cpp file under testDAXCalibration method. A. Sepp, Pricing European-Style Options under Jump Diffusion Processes with Stochastic Volatility: Applications of Fourier Transform (<http://math.ut.ee/~spartak/papers/stochjumpvols.pdf>) I had previously thought that the analytichestonengine.cpp implements heston Stochastic Volatility (SV) model without jumps, but having seen the above reference, I'd like to double check if SV with Jumps is available in QuantLib. Also, secondarily, I'd like to clarify which model, ie, SV with Jumps or SV (without jumps) used in the testDAXCalibration ? Thank you very much. C |
Hi
the AnalyticHestonEngine implements the "simple" Heston SV model. If you want to use Heston SV plus jumps please use the AnalyticBatesEngine, which implements different jump processes on top of the Heston SV process. Examples can be found in test-suite/bastesmodel.cpp. The implementation follows the A. Sepp paper. regards Klaus ----- original message -------- Subject: [Quantlib-users] AnaliticHestonEngine -- SV or SVJ Sent: Tue, 19 Aug 2008 From: nabbleuser2008<[hidden email]> > > Hi, > > I noticed that the following paper is listed as a reference in the > analytichestonengine.cpp file. I also noticed that the same paper is > mentioned in the test-suite/hestonmodel.cpp file under testDAXCalibration > method. > > A. Sepp, Pricing European-Style Options under Jump Diffusion Processes with > Stochastic Volatility: Applications of Fourier Transform > (<http://math.ut.ee/~spartak/papers/stochjumpvols.pdf>) > > I had previously thought that the analytichestonengine.cpp implements > heston Stochastic Volatility (SV) model without jumps, but having seen the > above reference, I'd like to double check if SV with Jumps is available in > QuantLib. Also, secondarily, I'd like to clarify which model, ie, SV with > Jumps or SV (without jumps) used in the testDAXCalibration ? > > Thank you very much. > > C > -- > View this message in context: > http://www.nabble.com/AnaliticHestonEngine----SV-or-SVJ-tp19056242p19056242. > html > Sent from the quantlib-users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > QuantLib-users mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-users > --- original message end ---- ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
In reply to this post by nabbleuser2008
Hi
The AnalyticHestonEngine implements the "simple" Heston SV model. The AnalyticBatesEngine implements the Heston SV model plus jumps as outlined in the A. Sepp paper. Examples can be found in test-sutie/batesmodel.cpp. regards ----- original message -------- Subject: [Quantlib-users] AnaliticHestonEngine -- SV or SVJ Sent: Tue, 19 Aug 2008 From: nabbleuser2008<[hidden email]> > > Hi, > > I noticed that the following paper is listed as a reference in the > analytichestonengine.cpp file. I also noticed that the same paper is > mentioned in the test-suite/hestonmodel.cpp file under testDAXCalibration > method. > > A. Sepp, Pricing European-Style Options under Jump Diffusion Processes with > Stochastic Volatility: Applications of Fourier Transform > (<http://math.ut.ee/~spartak/papers/stochjumpvols.pdf>) > > I had previously thought that the analytichestonengine.cpp implements > heston Stochastic Volatility (SV) model without jumps, but having seen the > above reference, I'd like to double check if SV with Jumps is available in > QuantLib. Also, secondarily, I'd like to clarify which model, ie, SV with > Jumps or SV (without jumps) used in the testDAXCalibration ? > > Thank you very much. > > C > -- > View this message in context: > http://www.nabble.com/AnaliticHestonEngine----SV-or-SVJ-tp19056242p19056242. > html > Sent from the quantlib-users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > QuantLib-users mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-users > --- original message end ---- ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
In reply to this post by nabbleuser2008
Hi
The AnalyticHestonEngine implements the "simple" Heston SV model. The AnalyticBatesEngine implements the Heston SV model plus jumps as outlined in the A. Sepp paper. Examples can be found in test-sutie/batesmodel.cpp. regards ----- original message -------- Subject: [Quantlib-users] AnaliticHestonEngine -- SV or SVJ Sent: Tue, 19 Aug 2008 From: nabbleuser2008<[hidden email]> > > Hi, > > I noticed that the following paper is listed as a reference in the > analytichestonengine.cpp file. I also noticed that the same paper is > mentioned in the test-suite/hestonmodel.cpp file under testDAXCalibration > method. > > A. Sepp, Pricing European-Style Options under Jump Diffusion Processes with > Stochastic Volatility: Applications of Fourier Transform > (<http://math.ut.ee/~spartak/papers/stochjumpvols.pdf>) > > I had previously thought that the analytichestonengine.cpp implements > heston Stochastic Volatility (SV) model without jumps, but having seen the > above reference, I'd like to double check if SV with Jumps is available in > QuantLib. Also, secondarily, I'd like to clarify which model, ie, SV with > Jumps or SV (without jumps) used in the testDAXCalibration ? > > Thank you very much. > > C > -- > View this message in context: > http://www.nabble.com/AnaliticHestonEngine----SV-or-SVJ-tp19056242p19056242. > html > Sent from the quantlib-users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > QuantLib-users mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/quantlib-users > --- original message end ---- ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hi Klaus,
Thank you very much for your reply. I'm just looking at the bates model, and trying to understand how much it is different from Heston-Nandi model discussed in Gatheral's book. In case they are different, was there a reason to use Bates model, (vs Heston-Nandi) in QL ? Thanks again. Really appreciate your insights. C
|
Hi
The Bates model is a Heston model plus a (stochastic) jump processes for the equity underlying. E. g. Gatheral is discussing the Bates model with log-normal jump diffusion process at page 65 ff. IMO Bates is used more often in real life than the Heston-Nandi model. regards Klaus On Wednesday 20 August 2008 16:24:24 nabbleuser2008 wrote: > Hi Klaus, > Thank you very much for your reply. I'm just looking at the bates model, > and trying to understand how much it is different from Heston-Nandi model > discussed in Gatheral's book. In case they are different, was there a > reason to use Bates model, (vs Heston-Nandi) in QL ? > > Thanks again. Really appreciate your insights. > > C > > Klaus Spanderen-2 wrote: > > Hi > > > > The AnalyticHestonEngine implements the "simple" Heston SV model. The > > AnalyticBatesEngine implements the Heston SV model plus jumps as outlined > > in the A. Sepp paper. Examples can be found in test-sutie/batesmodel.cpp. > > > > regards > > > > > > ----- original message -------- > > > > Subject: [Quantlib-users] AnaliticHestonEngine -- SV or SVJ > > Sent: Tue, 19 Aug 2008 > > From: nabbleuser2008<[hidden email]> > > > >> Hi, > >> > >> I noticed that the following paper is listed as a reference in the > >> analytichestonengine.cpp file. I also noticed that the same paper is > >> mentioned in the test-suite/hestonmodel.cpp file under > >> testDAXCalibration method. > >> > >> A. Sepp, Pricing European-Style Options under Jump Diffusion Processes > >> with > >> Stochastic Volatility: Applications of Fourier Transform > >> (<http://math.ut.ee/~spartak/papers/stochjumpvols.pdf>) > >> > >> I had previously thought that the analytichestonengine.cpp implements > >> heston Stochastic Volatility (SV) model without jumps, but having seen > >> the > >> above reference, I'd like to double check if SV with Jumps is available > >> in > >> QuantLib. Also, secondarily, I'd like to clarify which model, ie, SV > >> with > >> Jumps or SV (without jumps) used in the testDAXCalibration ? > >> > >> Thank you very much. > >> > >> C > >> -- > >> View this message in context: > >> http://www.nabble.com/AnaliticHestonEngine----SV-or-SVJ-tp19056242p19056 > >>242. html > >> Sent from the quantlib-users mailing list archive at Nabble.com. > >> > >> > >> ------------------------------------------------------------------------ > >>- This SF.Net email is sponsored by the Moblin Your Move Developer's > >> challenge > >> Build the coolest Linux based applications with Moblin SDK & win great > >> prizes > >> Grand prize is a trip for two to an Open Source event anywhere in the > >> world > >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ > >> _______________________________________________ > >> QuantLib-users mailing list > >> [hidden email] > >> https://lists.sourceforge.net/lists/listinfo/quantlib-users > > > > --- original message end ---- > > > > > > ------------------------------------------------------------------------- > > This SF.Net email is sponsored by the Moblin Your Move Developer's > > challenge > > Build the coolest Linux based applications with Moblin SDK & win great > > prizes > > Grand prize is a trip for two to an Open Source event anywhere in the > > world > > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > > _______________________________________________ > > QuantLib-users mailing list > > [hidden email] > > https://lists.sourceforge.net/lists/listinfo/quantlib-users ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Dear Klaus,
Thanks much for the information. It was really helpful. I'm using the same thread to ask a related question, since it is kind of directed at you ... I am wondering why the HestonModelHelper does not allow puts be used in the calibration -- since Heston pricing engine can price the puts, I felt that only change required is allowing Option::Type be specified as a parameter in the constructor. Do you agree with my thinking ? if not, is there a reason for not using the puts for calibration ? I am asking this question because I am experimenting ways to achieve a good calibration, and I'd like to see if I can get a better calibration by using puts. Mainly I'm interested in out of the money puts and calls and I'm trying out ways to improve my model prices. As an additional piece of info, I'm using the american prices as input, but I use the BaroneAdesyWhaley approximation to find the value of the correspoinding european which I use in the calibration. I'm planning to use the Bates model next, but I would like to use the puts for the Heston calibration unless it doesn't make sense. Thanks much for your help. C <quote author="Klaus Spanderen-2"> Hi The Bates model is a Heston model plus a (stochastic) jump processes for the equity underlying. E. g. Gatheral is discussing the Bates model with log-normal jump diffusion process at page 65 ff. IMO Bates is used more often in real life than the Heston-Nandi model. regards Klaus |
Dear nabbleuser,
I recently calibrated Bates model by using Quantlib. I see no computational reason why you can't calibrate to put options. I used volatility surface to calibrate the model. It is upto you how to build the volatility surface. Use calls, puts, swaptions etc. Good luck, Cavit (Javit) Hafizoglu <quote author="nabbleuser2008"> Dear Klaus, Thanks much for the information. It was really helpful. I'm using the same thread to ask a related question, since it is kind of directed at you ... I am wondering why the HestonModelHelper does not allow puts be used in the calibration -- since Heston pricing engine can price the puts, I felt that only change required is allowing Option::Type be specified as a parameter in the constructor. Do you agree with my thinking ? if not, is there a reason for not using the puts for calibration ? I am asking this question because I am experimenting ways to achieve a good calibration, and I'd like to see if I can get a better calibration by using puts. Mainly I'm interested in out of the money puts and calls and I'm trying out ways to improve my model prices. As an additional piece of info, I'm using the american prices as input, but I use the BaroneAdesyWhaley approximation to find the value of the correspoinding european which I use in the calibration. I'm planning to use the Bates model next, but I would like to use the puts for the Heston calibration unless it doesn't make sense. Thanks much for your help. C
|
Hi Javit,
Thanks much for your reply. I posted the question since, in the HestonCalibrationHelper constructor, the payoff is used as follows: boost::shared_ptr<StrikedTypePayoff> payoff( new PlainVanillaPayoff(Option::Call, strikePrice_)); Are you saying if I get the implied vol of puts it should work because impvol of a call and the put are the same (in theory, not sure if that holds in practice, anyone ? ) with the same strike and maturity due to put call parity ? I'm using americans, so I didn't think I can use this equality assumption. Or, are you saying it should work for a different reason ? Also, I very much like to know your calibration results. Would you be able to share your findings of the calibration, pls ? I really like to know how accurate your model prices are wrt market prices. Thank you very much. C <quote author="javit"> Dear nabbleuser, I recently calibrated Bates model by using Quantlib. I see no computational reason why you can't calibrate to put options. I used volatility surface to calibrate the model. It is upto you how to build the volatility surface. Use calls, puts, swaptions etc. Good luck, Cavit (Javit) Hafizoglu
|
I manipulated the test suite to calibrate the model. Here are the steps.
Define: - Riskfree rates - Dividends - Volatility vector - Heston Process - Bates Model - Its engine - A calibration helper - Use marketvalue method to get the price Use the method calibrate as: batesModel->BatesModel::calibrate(calibHelper, optimMethod,EndCriteria(100, 40, 1.0e-8, 1.0e-8, 1.0e-8)); Here are the lines from the test-suite to define the calibration helper: calibHelper.push_back(boost::shared_ptr<CalibrationHelper>( new HestonModelHelper(maturity, calendar, s0->value(), strike[s], vol, riskFreeTS, dividendTS, true))); options.back()->setPricingEngine(batesEngine); } You can get as accurate results as you like if you have time to wait. Thank you, Javit <quote author="nabbleuser2008"> Hi Javit, Thanks much for your reply. I posted the question since, in the HestonCalibrationHelper constructor, the payoff is used as follows: boost::shared_ptr<StrikedTypePayoff> payoff( new PlainVanillaPayoff(Option::Call, strikePrice_)); Are you saying if I get the implied vol of puts it should work because impvol of a call and the put are the same (in theory, not sure if that holds in practice, anyone ? ) with the same strike and maturity due to put call parity ? I'm using americans, so I didn't think I can use this equality assumption. Or, are you saying it should work for a different reason ? Also, I very much like to know your calibration results. Would you be able to share your findings of the calibration, pls ? I really like to know how accurate your model prices are wrt market prices. Thank you very much. C
|
Hello Javit, Thanks .
Yes, this is kind of very similar to what I did too. But, sorry, I don't see why using vols from puts should work. Cheers, C <quote author="javit"> I manipulated the test suite to calibrate the model. Here are the steps. Define: - Riskfree rates - Dividends - Volatility vector - Heston Process - Bates Model - Its engine - A calibration helper - Use marketvalue method to get the price Use the method calibrate as: batesModel->BatesModel::calibrate(calibHelper, optimMethod,EndCriteria(100, 40, 1.0e-8, 1.0e-8, 1.0e-8)); Here are the lines from the test-suite to define the calibration helper: calibHelper.push_back(boost::shared_ptr<CalibrationHelper>( new HestonModelHelper(maturity, calendar, s0->value(), strike[s], vol, riskFreeTS, dividendTS, true))); options.back()->setPricingEngine(batesEngine); } You can get as accurate results as you like if you have time to wait. Thank you, Javit
|
In reply to this post by nabbleuser2008
Hi
my two cents about it > > I am wondering why the HestonModelHelper does not allow puts be used in > the calibration -- since Heston pricing engine can price the puts, I felt > that only change required is allowing Option::Type be specified as a > parameter in the constructor. Do you agree with my thinking ? yes. > if not, is there a reason for not using the puts for calibration ? The Heston engine can only be used for european options and for these options (within the ideal model world) a call price can always be translated into a put price using the call-put parity and the model-independent forward. Therefore the HestonModelHelper is using the implied volatility as an input parameter instead of the market price. Whether the helper internally uses puts or calls during the calibration doesn't change the calibrated Heston model. > > I am asking this question because I am experimenting ways to achieve a > good calibration, and I'd like to see if I can get a better calibration by > using puts. Mainly I'm interested in out of the money puts and calls and > I'm trying out ways to improve my model prices. > ..entering real world;-). You should use both, calls and puts. For equity index options (european style options) use your favourite analytic or finite difference pricing engine to convert prices to implied vols and start the Heston calibration. As said above it doesn't matter that the calibration itself is only using calls as long as you provide implieds vols from calls and puts. > As an additional piece of info, I'm using the american prices as input, > but I use the BaroneAdesyWhaley approximation to find the value of the > correspoinding european which I use in the calibration A good approximation for american exercise is to use the 1d finite difference pricing engine to convert the american market prices into implied volatilities and then calibrate the standard Heston model (I won't use the BaroneAdesyWhaley approximation). IMO the exact handling of the american exercise feature is a real problem as one needs a Heston finite differences engine to price american options with discrete dividends ...and this pricing method is relatively slow. On single stocks implied vols for calls and puts can differ a lot due to - optimal exercise regions for calls and puts are completely different - discrete dividend payments - single stock repo curve (lending single stocks to hedge puts might be expensive). - ... regards Klaus -- Klaus Spanderen Ludwig Erhard Str. 12 48734 Reken (Germany) EMail: [hidden email] (remove NOSPAM from the address) ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Dear Klaus,
Thank you very very much for taking time to explain it so clearly. Your two cents worth millions to me ;) I just wanted to clarify one point you're making below. If I'm to use both puts and calls, and assuming that the implied vols are different for the two types, how should I select whether to use the implied vol from a put or a call for a given strike, maturity pair for calibration. I'm thinking if I use both the put and the call for a given strike and maturity, it will be a rather weird type vol surface (with spikes) and it might confuse the calibration program ? Would it be reasonable to use the implied vols from out of the money puts and calls, since they are most liquid. Or do you have suggestions ? Thank you very much again. I really appreciate your kind help. C
|
In reply to this post by nabbleuser2008
I believe Klaus Spanderen's answer cleared your confusion. Let me know f you still have questions about it.
Javit <quote author="nabbleuser2008"> Hello Javit, Thanks . Yes, this is kind of very similar to what I did too. But, sorry, I don't see why using vols from puts should work. Cheers, C
|
In reply to this post by nabbleuser2008
Hi
> I just wanted to clarify one point you're making below. If I'm to use > both puts and calls, and assuming that the implied vols are different for > the two types, how should I select whether to use the implied vol from a > put or a call for a given strike, maturity pair for calibration. A step forward for the calibration on american options using the european Heston engine is to "quote" the volatilities in terms of strike and "average time 'til' exercise" instead of the maturity of the options. This should bring call and out vols closer together. But even if you use a finite difference engine to calibrate the Heston model on american options (I've tried it) you find examples where the put and call prices are not "consistent", e.g. due to the repo rate for short selling. > I'm > thinking if I use both the put and the call for a given strike and > maturity, it will be a rather weird type vol surface (with spikes) and it > might confuse the calibration program ? hmm.. in practice the Heston calibration is a good averaging algorithm to get ride of the spikes;-). But remove options that have obviously wrong prices. cheers Klaus -- Klaus Spanderen Ludwig Erhard Str. 12 48734 Reken (Germany) EMail: [hidden email] (remove NOSPAM from the address) ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Dear Klaus,
Thank you very much for your advice kind help. I've tried with both puts and calls with Heston and Bates models (pls see attachment for a bit of the results). I also wanted to try what you're saying below, but I was not able to understand how to do what you were saying "A step forward for the calibration on american options using the european Heston engine is to "quote" the volatilities in terms of strike and "average time 'til' exercise" instead of the maturity of the options. This should bring call and out vols closer together. " It would really help if you could show me what you mean by an example or something. ;) I've used the FDDividendAmericanEngine to calculate the implied volatilities ( Even though I noticed the comment in the source file that impliedVolatility may not be accurate. I still used it as I couldn't find a better alternative in the QL librarary for my needs, as I'm interested in americans with discrete dividend payments.) When I tried fitting americans to Heston, I found that the model under-values the options. So I tried adding the whaley premium to the model price but I was still not able to get prices close to market range for some/most out of the money options. (pls see the attachment for some sample prices). Then I tried the Bates model. Based on what I've read, I expected the prices of the jump model to be higher than Heston model prices. It turned out they are higher, but in some cases they seem to be higher than the market prices for out of the money options. (pls see the attachment for some sample prices). Having seen Gatheral's results, I expected the results of Bates model to be better. However, in my case, it is hard to say which one is better as both models produce some good values and some not so good values. I really appreciate if you could pls take a look at the numbers, and let me know if you have any comments, suggestions to improve my results. For my current project, I'm interested in matching the model generated prices for out of the money short maturities. I saw bigger deviations in the model prices from the market prices for the next shorter maturity, btw. Thank you very much. C > I'm > thinking if I use both the put and the call for a given strike and > maturity, it will be a rather weird type vol surface (with spikes) and it > might confuse the calibration program ? hmm.. in practice the Heston calibration is a good averaging algorithm to get ride of the spikes;-). But remove options that have obviously wrong prices. cheers -- Klaus Spanderen Ludwig Erhard Str. 12 48734 Reken (Germany) EMail: klaus@NOSPAMspanderen.de (remove NOSPAM from the address) ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ QuantLib-users mailing list QuantLib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/quantlib-users someresults.txt |
noticed that the results file I've posted didn't have the calibrated parameter. here's the results with the parameters ...
someresults.txt |
In reply to this post by nabbleuser2008
Hi
sorry for the late answer. On Monday 01 September 2008 17:57:02 nabbleuser2008 wrote: > I also wanted to try what you're saying below, but I was not > able to understand how to do what you were saying I've attached a version of the LongstaffSchwartzPathPricer, which calculates the average life time 'til exercise of an option instead of the price. (There are better ways to do this but this was easy to implement). Just replace the original file by the attached one and ran e.g. eamples like MCLongstaffSchwartzEngineTest::testAmericanOption. The npv is the average life time. Now (hopefully;-) the implied vols of calls and puts quoted in terms of the average life time will be closer together than the implied vols quoted in terms of the option maturity. Calibrate on "synth" european options with maturity = avg. life time of the american options. > I've used the FDDividendAmericanEngine to calculate the implied > volatilities ( Even though I noticed the comment in the source file that > impliedVolatility may not be accurate. I still used it as I couldn't find a > better alternative in the QL librarary for my needs, as I'm interested in > americans with discrete dividend payments.) > Be aware that the Heston model is using a dividend yield and that the volatilities for a discrete dividend Black-Scholes models and dividend yield BS-model aren't the same. See e.g. Bos, R. et al. (2003) Dealing with discrete dividends, Risk Magazine, 16, pp. 109–112. to transfer volatility surfaces between both dividend models. The Heston calibration helper assumes a dividend yield BS volatility. May be for the time being you are better off using the FDAmericanEngine and a dividend yield. cheers Klaus -- Klaus Spanderen Ludwig Erhard Str. 12 48734 Reken (Germany) EMail: [hidden email] (remove NOSPAM from the address) ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users longstaffschwartzpathpricer.hpp (6K) Download Attachment |
Dear Klaus,
Thank you very much for all your help. Took me a little while to compare the prices from all the methods, including the one with adjusted maturity. May be for the reasons you're mentioning below, I'm not getting a perfect fit with any of the models, even though some or most model prices are very good. Thanks again for all your help and advice. Cheers, C <quote author="Klaus Spanderen-2"> Hi sorry for the late answer. On Monday 01 September 2008 17:57:02 nabbleuser2008 wrote: > I also wanted to try what you're saying below, but I was not > able to understand how to do what you were saying I've attached a version of the LongstaffSchwartzPathPricer, which calculates the average life time 'til exercise of an option instead of the price. (There are better ways to do this but this was easy to implement). Just replace the original file by the attached one and ran e.g. eamples like MCLongstaffSchwartzEngineTest::testAmericanOption. The npv is the average life time. Now (hopefully;-) the implied vols of calls and puts quoted in terms of the average life time will be closer together than the implied vols quoted in terms of the option maturity. Calibrate on "synth" european options with maturity = avg. life time of the american options. > I've used the FDDividendAmericanEngine to calculate the implied > volatilities ( Even though I noticed the comment in the source file that > impliedVolatility may not be accurate. I still used it as I couldn't find a > better alternative in the QL librarary for my needs, as I'm interested in > americans with discrete dividend payments.) > Be aware that the Heston model is using a dividend yield and that the volatilities for a discrete dividend Black-Scholes models and dividend yield BS-model aren't the same. See e.g. Bos, R. et al. (2003) Dealing with discrete dividends, Risk Magazine, 16, pp. 109–112. to transfer volatility surfaces between both dividend models. The Heston calibration helper assumes a dividend yield BS volatility. May be for the time being you are better off using the FDAmericanEngine and a dividend yield. cheers Klaus -- Klaus Spanderen Ludwig Erhard Str. 12 48734 Reken (Germany) EMail: klaus@NOSPAMspanderen.de (remove NOSPAM from the address) /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* Copyright (C) 2006 Klaus Spanderen This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ QuantLib is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email <quantlib-dev@lists.sf.net>. The license is also available online at <http://quantlib.org/license.shtml>. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ /*! \file longstaffschwartzpathpricer.hpp \brief Longstaff-Schwarz path pricer for early exercise options */ #ifndef quantlib_longstaff_schwartz_path_pricer_hpp #define quantlib_longstaff_schwartz_path_pricer_hpp #include <ql/termstructures/yieldtermstructure.hpp> #include <ql/math/functional.hpp> #include <ql/math/linearleastsquaresregression.hpp> #include <ql/methods/montecarlo/pathpricer.hpp> #include <ql/methods/montecarlo/earlyexercisepathpricer.hpp> #include <boost/bind.hpp> #include <boost/function.hpp> namespace QuantLib { //! Longstaff-Schwarz path pricer for early exercise options /*! References: Francis Longstaff, Eduardo Schwartz, 2001. Valuing American Options by Simulation: A Simple Least-Squares Approach, The Review of Financial Studies, Volume 14, No. 1, 113-147 \ingroup mcarlo \test the correctness of the returned value is tested by reproducing results available in web/literature */ template <class PathType> class LongstaffSchwartzPathPricer : public PathPricer<PathType> { public: typedef typename EarlyExerciseTraits<PathType>::StateType StateType; LongstaffSchwartzPathPricer( const TimeGrid& times, const boost::shared_ptr<EarlyExercisePathPricer<PathType> >& , const boost::shared_ptr<YieldTermStructure>& termStructure); Real operator()(const PathType& path) const; virtual void calibrate(); protected: bool calibrationPhase_; const boost::shared_ptr<EarlyExercisePathPricer<PathType> > pathPricer_; boost::scoped_array<Array> coeff_; boost::scoped_array<DiscountFactor> dF_; mutable std::vector<PathType> paths_; const std::vector<boost::function1<Real, StateType> > v_; const TimeGrid times_; }; template <class PathType> inline LongstaffSchwartzPathPricer<PathType>::LongstaffSchwartzPathPricer( const TimeGrid& times, const boost::shared_ptr<EarlyExercisePathPricer<PathType> >& pathPricer, const boost::shared_ptr<YieldTermStructure>& termStructure) : calibrationPhase_(true), pathPricer_(pathPricer), coeff_ (new Array[times.size()-1]), dF_ (new DiscountFactor[times.size()-1]), v_ (pathPricer_->basisSystem()), times_ (times) { for (Size i=0; i<times.size()-1; ++i) { dF_[i] = termStructure->discount(times[i+1]) / termStructure->discount(times[i]); } } template <class PathType> inline Real LongstaffSchwartzPathPricer<PathType>::operator()( const PathType& path) const { if (calibrationPhase_) { // store paths for the calibration paths_.push_back(path); // result doesn't matter return 0.0; } const Size len = EarlyExerciseTraits<PathType>::pathLength(path); Real price = times_[len-1]; for (Size i=len-2; i>0; --i) { const Real exercise = (*pathPricer_)(path, i); if (exercise > 0.0) { const StateType regValue = pathPricer_->state(path, i); Real continuationValue = 0.0; for (Size l=0; l<v_.size(); ++l) { continuationValue += coeff_[i][l] * v_[l](regValue); } if (continuationValue < exercise) { price = times_[i]; } } } return price; } template <class PathType> inline void LongstaffSchwartzPathPricer<PathType>::calibrate() { const Size n = paths_.size(); Array prices(n), exercise(n); const Size len = EarlyExerciseTraits<PathType>::pathLength(paths_[0]); std::transform(paths_.begin(), paths_.end(), prices.begin(), boost::bind(&EarlyExercisePathPricer<PathType> ::operator(), pathPricer_.get(), _1, len-1)); for (Size i=len-2; i>0; --i) { std::vector<Real> y; std::vector<StateType> x; //roll back step for (Size j=0; j<n; ++j) { exercise[j]=(*pathPricer_)(paths_[j], i); if (exercise[j]>0.0) { x.push_back(pathPricer_->state(paths_[j], i)); y.push_back(dF_[i]*prices[j]); } } if (v_.size() <= x.size()) { coeff_[i] = LinearLeastSquaresRegression<StateType>(x, y, v_).a(); } else { // if number of itm paths is smaller then the number of // calibration functions -> no early exercise coeff_[i] = Array(v_.size(), 0.0); } for (Size j=0, k=0; j<n; ++j) { prices[j]*=dF_[i]; if (exercise[j]>0.0) { Real continuationValue = 0.0; for (Size l=0; l<v_.size(); ++l) { continuationValue += coeff_[i][l] * v_[l](x[k]); } if (continuationValue < exercise[j]) { prices[j] = exercise[j]; } ++k; } } } // remove calibration paths paths_.clear(); // entering the calculation phase calibrationPhase_ = false; } } #endif ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ QuantLib-users mailing list QuantLib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/quantlib-users </quote> |
Free forum by Nabble | Edit this page |