Update of /cvsroot/quantlibaddin/QuantLibAddin/qlo
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv367/qlo
Modified Files:
smilesection.cpp smilesection.hpp swaptionvolstructure.cpp
swaptionvolstructure.hpp
Log Message:
SmileSection refactoring
Index: smilesection.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/smilesection.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** smilesection.cpp 1 Dec 2006 18:48:38 -0000 1.1
--- smilesection.cpp 1 Dec 2006 19:34:23 -0000 1.2
***************
*** 28,53 ****
InterpolatedSmileSection::InterpolatedSmileSection(
const QuantLib::Date& optionDate,
- const QuantLib::DayCounter& dc,
const std::vector<QuantLib::Rate>& s,
! const std::vector<QuantLib::Volatility>& v) {
! if (s.size()==1 && v.size()==1) {
! std::vector<QuantLib::Rate> strikes(2, 0.0);
! strikes[1]=1.0;
! std::vector<QuantLib::Volatility> vols(2, v[0]);
! libraryObject_ = boost::shared_ptr<
! QuantLib::SmileSectionInterface>(new
! QuantLib::InterpolatedSmileSection(optionDate,
! dc,
! strikes,
! vols));
! } else {
! libraryObject_ = boost::shared_ptr<
! QuantLib::SmileSectionInterface>(new
! QuantLib::InterpolatedSmileSection(optionDate,
! dc,
! s,
! v));
! }
}
--- 28,37 ----
InterpolatedSmileSection::InterpolatedSmileSection(
const QuantLib::Date& optionDate,
const std::vector<QuantLib::Rate>& s,
! const std::vector<QuantLib::Volatility>& v,
! const QuantLib::DayCounter& dc) {
! libraryObject_ = boost::shared_ptr<QuantLib::SmileSectionInterface>(
! new QuantLib::InterpolatedSmileSection<>(optionDate, s, v, dc));
}
***************
*** 74,84 ****
isRhoFixed, vegaWeighted, method);
! QuantLib::GenericInterpolatedSmileSection<QuantLib::SABR>*
genericInterpolatedSmileSection =
! new QuantLib::GenericInterpolatedSmileSection<QuantLib::SABR>(
expiry, strikes, volatilitiesHandles, sabrInterpolationFactory);
libraryObject_ = boost::shared_ptr<
! QuantLib::GenericInterpolatedSmileSection<QuantLib::SABR> >
(genericInterpolatedSmileSection);
}
--- 58,68 ----
isRhoFixed, vegaWeighted, method);
! QuantLib::InterpolatedSmileSection<QuantLib::SABR>*
genericInterpolatedSmileSection =
! new QuantLib::InterpolatedSmileSection<QuantLib::SABR>(
expiry, strikes, volatilitiesHandles, sabrInterpolationFactory);
libraryObject_ = boost::shared_ptr<
! QuantLib::InterpolatedSmileSection<QuantLib::SABR> >
(genericInterpolatedSmileSection);
}
Index: smilesection.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/smilesection.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** smilesection.hpp 1 Dec 2006 18:48:38 -0000 1.1
--- smilesection.hpp 1 Dec 2006 19:34:23 -0000 1.2
***************
*** 31,40 ****
};
class InterpolatedSmileSection : public SmileSectionInterface {
! public:
InterpolatedSmileSection(const QuantLib::Date& optionDate,
- const QuantLib::DayCounter& dc,
const std::vector<QuantLib::Rate>& strikes,
! const std::vector<QuantLib::Volatility>& v);
};
--- 31,56 ----
};
+ // class FlatSmileSection : public SmileSectionInterface {
+ // public:
+ // FlatSmileSection(const QuantLib::Date& optionDate,
+ // const QuantLib::DayCounter& dc,
+ // const QuantLib::Volatility>& v
+ // const QuantLib::Date& refDate);
+ // };
+
+ // class InterpolatedSmileSection : public SmileSectionInterface {
+ //public:
+ // InterpolatedSmileSection(const QuantLib::Date& optionDate,
+ // const QuantLib::DayCounter& dc,
+ // const std::vector<QuantLib::Rate>& strikes,
+ // const std::vector<QuantLib::Volatility>& v);
+ // };
+
class InterpolatedSmileSection : public SmileSectionInterface {
! public:
InterpolatedSmileSection(const QuantLib::Date& optionDate,
const std::vector<QuantLib::Rate>& strikes,
! const std::vector<QuantLib::Volatility>& v,
! const QuantLib::DayCounter& dc);
};
Index: swaptionvolstructure.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/swaptionvolstructure.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** swaptionvolstructure.cpp 1 Dec 2006 18:48:38 -0000 1.46
--- swaptionvolstructure.cpp 1 Dec 2006 19:34:23 -0000 1.47
***************
*** 27,32 ****
#include <ql/Volatilities/swaptionvolcubebylinear.hpp>
#include <ql/Volatilities/swaptionvolcubebysabr.hpp>
! #include <ql/Volatilities/smilesection.hpp>
! #include <ql/Optimization/criteria.hpp>
--- 27,35 ----
#include <ql/Volatilities/swaptionvolcubebylinear.hpp>
#include <ql/Volatilities/swaptionvolcubebysabr.hpp>
! //#include <ql/Volatilities/smilesection.hpp>
! //#include <ql/Optimization/criteria.hpp>
! //#include <ql/Volatilities/smilesection.hpp>
! //#include <ql/Volatilities/swaptionvolcubebysabr.hpp>
! #include <ql/Volatilities/swaptionvolmatrix.hpp>
***************
*** 72,76 ****
}
! SwaptionVolatilityCubeByLinear::SwaptionVolatilityCubeByLinear(
const QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>& atmVol,
const std::vector<QuantLib::Period>& optionTenors,
--- 75,79 ----
}
! SwaptionVolCube2::SwaptionVolCube2(
const QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>& atmVol,
const std::vector<QuantLib::Period>& optionTenors,
***************
*** 83,87 ****
QL_REQUIRE(!atmVol.empty(), "atm vol handle not linked to anything");
libraryObject_ = boost::shared_ptr<QuantLib::Extrapolator>(new
! QuantLib::SwaptionVolatilityCubeByLinear(atmVol,
optionTenors,
swapTenors,
--- 86,90 ----
QL_REQUIRE(!atmVol.empty(), "atm vol handle not linked to anything");
libraryObject_ = boost::shared_ptr<QuantLib::Extrapolator>(new
! QuantLib::SwaptionVolCube2(atmVol,
optionTenors,
swapTenors,
Index: swaptionvolstructure.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/swaptionvolstructure.hpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** swaptionvolstructure.hpp 1 Dec 2006 18:48:38 -0000 1.43
--- swaptionvolstructure.hpp 1 Dec 2006 19:34:23 -0000 1.44
***************
*** 23,36 ****
#include <oh/objhandler.hpp>
- #include <ql/swaptionvolstructure.hpp>
#include <qlo/termstructures.hpp>
- #include <ql/Volatilities/swaptionvolcubebysabr.hpp>
- #include <ql/Volatilities/swaptionvolmatrix.hpp>
- #include <ql/Volatilities/smilesection.hpp>
#include <qlo/smilesection.hpp>
! #include <qlo/index.hpp>
namespace QuantLibAddin {
!
class SwaptionVolatilityStructure : public TermStructure {};
--- 23,36 ----
#include <oh/objhandler.hpp>
#include <qlo/termstructures.hpp>
#include <qlo/smilesection.hpp>
!
! #include <ql/swaptionvolstructure.hpp>
! #include <ql/Indexes/swapindex.hpp>
! #include <ql/Volatilities/swaptionvolcube.hpp>
namespace QuantLibAddin {
!
!
class SwaptionVolatilityStructure : public TermStructure {};
***************
*** 60,66 ****
};
! class SwaptionVolatilityCubeByLinear : public SwaptionVolatilityCube {
public:
! SwaptionVolatilityCubeByLinear(
const QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>& atmVol,
const std::vector<QuantLib::Period>& optionTenors,
--- 60,66 ----
};
! class SwaptionVolCube2 : public SwaptionVolatilityCube {
public:
! SwaptionVolCube2(
const QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>& atmVol,
const std::vector<QuantLib::Period>& optionTenors,
***************
*** 94,99 ****
};
-
-
class SmileSectionByCube : public SmileSectionInterface {
public:
--- 94,97 ----
|