/QuantLib-1.2/ql/legacy/libormarketmodels/liborforwardmodel.hpp

# · C++ Header · 86 lines · 32 code · 17 blank · 37 comment · 0 complexity · d1f4c5cedd572024a6695084558b4497 MD5 · raw file

  1. /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /*
  3. Copyright (C) 2005, 2006 Klaus Spanderen
  4. This file is part of QuantLib, a free-software/open-source library
  5. for financial quantitative analysts and developers - http://quantlib.org/
  6. QuantLib is free software: you can redistribute it and/or modify it
  7. under the terms of the QuantLib license. You should have received a
  8. copy of the license along with this program; if not, please email
  9. <quantlib-dev@lists.sf.net>. The license is also available online at
  10. <http://quantlib.org/license.shtml>.
  11. This program is distributed in the hope that it will be useful, but WITHOUT
  12. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  13. FOR A PARTICULAR PURPOSE. See the license for more details.
  14. */
  15. /*! \file liborforwardmodel.hpp
  16. \brief libor forward model incl. exact cap pricing
  17. Rebonato formula to approximate swaption prices.
  18. */
  19. #ifndef quantlib_libor_forward_model_hpp
  20. #define quantlib_libor_forward_model_hpp
  21. #include <ql/legacy/libormarketmodels/lfmprocess.hpp>
  22. #include <ql/termstructures/volatility/swaption/swaptionvolmatrix.hpp>
  23. #include <ql/termstructures/volatility/optionlet/capletvariancecurve.hpp>
  24. #include <ql/models/model.hpp>
  25. #include <ql/legacy/libormarketmodels/lfmcovarproxy.hpp>
  26. namespace QuantLib {
  27. //! %Libor forward model
  28. /*! References:
  29. Stefan Weber, 2005, Efficient Calibration for Libor Market Models,
  30. (<http://workshop.mathfinance.de/2005/papers/weber/slides.pdf>)
  31. Damiano Brigo, Fabio Mercurio, Massimo Morini, 2003,
  32. Different Covariance Parameterizations of Libor Market Model and Joint
  33. Caps/Swaptions Calibration,
  34. (<http://www.business.uts.edu.au/qfrc/conferences/qmf2001/Brigo_D.pdf>
  35. \test the correctness is tested using Monte-Carlo Simulation to
  36. reproduce swaption npvs, model calibration and exact cap pricing
  37. */
  38. class LiborForwardModel : public CalibratedModel, public AffineModel {
  39. public:
  40. LiborForwardModel(
  41. const boost::shared_ptr<LiborForwardModelProcess> & process,
  42. const boost::shared_ptr<LmVolatilityModel> & volaModel,
  43. const boost::shared_ptr<LmCorrelationModel> & corrModel);
  44. Rate S_0(Size alpha, Size beta) const;
  45. // approx. swaption matrix using Rebonato's approx.
  46. // fix and floating leg have the same frequency
  47. virtual boost::shared_ptr<SwaptionVolatilityMatrix>
  48. getSwaptionVolatilityMatrix() const;
  49. DiscountFactor discount(Time t) const;
  50. Real discountBond(Time now, Time maturity, Array factors) const;
  51. Real discountBondOption(Option::Type type, Real strike,
  52. Time maturity, Time bondMaturity) const;
  53. void setParams(const Array& params);
  54. protected:
  55. Disposable<Array> w_0(Size alpha, Size beta) const;
  56. std::vector<Real> f_;
  57. std::vector<Time> accrualPeriod_;
  58. const boost::shared_ptr<LfmCovarianceProxy> covarProxy_;
  59. const boost::shared_ptr<LiborForwardModelProcess> process_;
  60. mutable boost::shared_ptr<SwaptionVolatilityMatrix> swaptionVola;
  61. };
  62. }
  63. #endif