Update of /cvsroot/quantlibaddin/QuantLibAddin/qlo
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv31111/qlo
Modified Files:
couponvectors.cpp couponvectors.hpp swaptionvolstructure.cpp
swaptionvolstructure.hpp
Log Message:
Index: couponvectors.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/couponvectors.hpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** couponvectors.hpp 21 Nov 2006 08:11:40 -0000 1.30
--- couponvectors.hpp 24 Nov 2006 09:17:24 -0000 1.31
***************
*** 74,86 ****
class VanillaCMSCouponPricer:public ObjHandler::LibraryObject<QuantLib::VanillaCMSCouponPricer> {
! public:
VanillaCMSCouponPricer(const QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>& vol,
! const std::string & typeOfVanillaCMSCouponPricer,
! const QuantLib::GFunctionFactory::ModelOfYieldCurve modelOfYieldCurve,
! QuantLib::Real meanReversion);
! boost::shared_ptr<QuantLib::VanillaCMSCouponPricer> underlyingObject()
! {
! return libraryObject_;
! }
};
--- 74,85 ----
class VanillaCMSCouponPricer:public ObjHandler::LibraryObject<QuantLib::VanillaCMSCouponPricer> {
! public:
VanillaCMSCouponPricer(const QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>& vol,
! const std::string& typeOfVanillaCMSCouponPricer,
! QuantLib::GFunctionFactory::ModelOfYieldCurve modelOfYieldCurve,
! QuantLib::Real meanReversion);
! //boost::shared_ptr<QuantLib::VanillaCMSCouponPricer> underlyingObject() {
! // return libraryObject_;
! //}
};
Index: couponvectors.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/couponvectors.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** couponvectors.cpp 21 Nov 2006 08:11:40 -0000 1.42
--- couponvectors.cpp 24 Nov 2006 09:17:24 -0000 1.43
***************
*** 69,78 ****
FixedRateCouponVector::FixedRateCouponVector(
! const boost::shared_ptr<QuantLib::Schedule>& schedule,
! const QuantLib::BusinessDayConvention& convention,
! const std::vector<double>& nominals,
! const std::vector<double>& couponRates,
! const QuantLib::DayCounter& dayCount)
! {
cashFlowVector_ = QuantLib::FixedRateCouponVector(*schedule,
convention,
--- 69,77 ----
FixedRateCouponVector::FixedRateCouponVector(
! const boost::shared_ptr<QuantLib::Schedule>& schedule,
! const QuantLib::BusinessDayConvention& convention,
! const std::vector<double>& nominals,
! const std::vector<double>& couponRates,
! const QuantLib::DayCounter& dayCount) {
cashFlowVector_ = QuantLib::FixedRateCouponVector(*schedule,
convention,
***************
*** 83,93 ****
FloatingRateCouponVector::FloatingRateCouponVector(
! const boost::shared_ptr<QuantLib::Schedule>& schedule,
! const std::vector<double>& nominals,
! const std::vector<QuantLib::Real>& gearings,
! const boost::shared_ptr<QuantLib::Xibor>& index,
! const std::vector<QuantLib::Spread>& spreads) {
!
! cashFlowVector_ =
QuantLib::FloatingRateCouponVector(*schedule,
index->businessDayConvention(),
--- 82,91 ----
FloatingRateCouponVector::FloatingRateCouponVector(
! const boost::shared_ptr<QuantLib::Schedule>& schedule,
! const std::vector<double>& nominals,
! const std::vector<QuantLib::Real>& gearings,
! const boost::shared_ptr<QuantLib::Xibor>& index,
! const std::vector<QuantLib::Spread>& spreads) {
! cashFlowVector_ =
QuantLib::FloatingRateCouponVector(*schedule,
index->businessDayConvention(),
***************
*** 100,110 ****
VanillaCMSCouponPricer::VanillaCMSCouponPricer(
! const QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>& vol,
! const std::string & typeOfVanillaCMSCouponPricer,
! const QuantLib::GFunctionFactory::ModelOfYieldCurve modelOfYieldCurve,
! QuantLib::Real meanReversion)
! {
libraryObject_ = Create<boost::shared_ptr<QuantLib::VanillaCMSCouponPricer> >()
! (typeOfVanillaCMSCouponPricer,vol,modelOfYieldCurve, meanReversion);
}
--- 98,107 ----
VanillaCMSCouponPricer::VanillaCMSCouponPricer(
! const QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>& v,
! const std::string& typeOfVanillaCMSCouponPricer,
! QuantLib::GFunctionFactory::ModelOfYieldCurve modelOfYieldCurve,
! QuantLib::Real meanReversion) {
libraryObject_ = Create<boost::shared_ptr<QuantLib::VanillaCMSCouponPricer> >()
! (typeOfVanillaCMSCouponPricer, v, modelOfYieldCurve, meanReversion);
}
Index: swaptionvolstructure.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/swaptionvolstructure.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** swaptionvolstructure.cpp 22 Nov 2006 10:58:43 -0000 1.42
--- swaptionvolstructure.cpp 24 Nov 2006 09:17:24 -0000 1.43
***************
*** 35,45 ****
SwaptionConstantVolatility::SwaptionConstantVolatility(
const QuantLib::Date& referenceDate,
! const double volatility,
const QuantLib::DayCounter& dayCounter)
{
! libraryObject_ = boost::shared_ptr<QuantLib::Extrapolator>(
! new QuantLib::SwaptionConstantVolatility(referenceDate,
! volatility,
! dayCounter));
}
--- 35,45 ----
SwaptionConstantVolatility::SwaptionConstantVolatility(
const QuantLib::Date& referenceDate,
! const QuantLib::Handle<QuantLib::Quote>& vol,
const QuantLib::DayCounter& dayCounter)
{
! libraryObject_ = boost::shared_ptr<QuantLib::Extrapolator>(new
! QuantLib::SwaptionConstantVolatility(referenceDate,
! vol,
! dayCounter));
}
***************
*** 51,66 ****
const QuantLib::DayCounter& dayCounter,
const QuantLib::BusinessDayConvention bdc) {
! libraryObject_ = boost::shared_ptr<QuantLib::Extrapolator>(
! new QuantLib::SwaptionVolatilityMatrix(calendar,
! expiries,
! tenors,
! vols,
! dayCounter,
! bdc));
}
std::vector<long> SwaptionVolatilityMatrix::locate(
! const QuantLib::Date& d, const QuantLib::Period& p)
! {
std::pair<QuantLib::Size, QuantLib::Size> indexes =
boost::dynamic_pointer_cast<QuantLib::SwaptionVolatilityMatrix>(
--- 51,66 ----
const QuantLib::DayCounter& dayCounter,
const QuantLib::BusinessDayConvention bdc) {
! libraryObject_ = boost::shared_ptr<QuantLib::Extrapolator>(new
! QuantLib::SwaptionVolatilityMatrix(calendar,
! expiries,
! tenors,
! vols,
! dayCounter,
! bdc));
}
std::vector<long> SwaptionVolatilityMatrix::locate(
! const QuantLib::Date& d,
! const QuantLib::Period& p) {
std::pair<QuantLib::Size, QuantLib::Size> indexes =
boost::dynamic_pointer_cast<QuantLib::SwaptionVolatilityMatrix>(
***************
*** 101,108 ****
bool vegaWeightedSmileFit,
const QuantLib::Matrix& parametersGuess,
! std::vector<bool> isParameterFixed,
bool isAtmCalibrated)
{
!
libraryObject_ = boost::shared_ptr<QuantLib::Extrapolator>(new
QuantLib::SwaptionVolatilityCubeBySabr(atmVol,
--- 101,108 ----
bool vegaWeightedSmileFit,
const QuantLib::Matrix& parametersGuess,
! const std::vector<bool>& isParameterFixed,
bool isAtmCalibrated)
{
! QL_REQUIRE(!atmVol.empty(), "atm vol handle not linked to anything");
libraryObject_ = boost::shared_ptr<QuantLib::Extrapolator>(new
QuantLib::SwaptionVolatilityCubeBySabr(atmVol,
***************
*** 116,127 ****
isParameterFixed,
isAtmCalibrated));
!
! const boost::shared_ptr<QuantLib::SwaptionVolatilityCubeBySabr>
! volCube = boost::dynamic_pointer_cast<QuantLib::SwaptionVolatilityCubeBySabr>(libraryObject_);
! sparseSabrParameters_ = volCube->sparseSabrParameters();
! denseSabrParameters_ = volCube->denseSabrParameters();
! marketVolCube_ = volCube->marketVolCube();
! volCubeAtmCalibrated_ = volCube->volCubeAtmCalibrated();
}
--- 116,152 ----
isParameterFixed,
isAtmCalibrated));
! }
!
! std::vector<std::vector<boost::any> >
! SwaptionVolatilityCubeBySabr::getSparseSabrParameters() {
! const boost::shared_ptr<QuantLib::SwaptionVolatilityCubeBySabr>&
! volCube = boost::dynamic_pointer_cast<
! QuantLib::SwaptionVolatilityCubeBySabr>(libraryObject_);
! return getSabrParameters(volCube->sparseSabrParameters());
! }
!
! std::vector<std::vector<boost::any> >
! SwaptionVolatilityCubeBySabr::getDenseSabrParameters() {
! const boost::shared_ptr<QuantLib::SwaptionVolatilityCubeBySabr>&
! volCube = boost::dynamic_pointer_cast<
! QuantLib::SwaptionVolatilityCubeBySabr>(libraryObject_);
! return getSabrParameters(volCube->denseSabrParameters());
! }
!
! std::vector<std::vector<boost::any> >
! SwaptionVolatilityCubeBySabr::getMarketVolCube() {
! const boost::shared_ptr<QuantLib::SwaptionVolatilityCubeBySabr>&
! volCube = boost::dynamic_pointer_cast<
! QuantLib::SwaptionVolatilityCubeBySabr>(libraryObject_);
! return getVolCube(volCube->marketVolCube());
! }
!
! std::vector<std::vector<boost::any> >
! SwaptionVolatilityCubeBySabr::getVolCubeAtmCalibrated() {
! const boost::shared_ptr<QuantLib::SwaptionVolatilityCubeBySabr>&
! volCube = boost::dynamic_pointer_cast<
! QuantLib::SwaptionVolatilityCubeBySabr>(libraryObject_);
! return getVolCube(volCube->volCubeAtmCalibrated());
}
***************
*** 225,250 ****
InterpolatedSmileSection::InterpolatedSmileSection(
! double expiryTime,
! const std::vector<double>& strikes,
! const std::vector<double>& volatilities){
! libraryObject_ = boost::shared_ptr<QuantLib::SmileSectionInterface>(
! new QuantLib::InterpolatedSmileSection(expiryTime,
! strikes,
! volatilities));
! }
! InterpolatedSmileSection::InterpolatedSmileSection(
! double expiryTime,
! double flatVolatility){
! int n = 5;
! std::vector<double> fictitiousStrikes;
! for(int i=0; i<n; i++){
! fictitiousStrikes.push_back(.01+.001*i);
! }
! const std::vector<double> volatilities = std::vector<double>(n, flatVolatility);
! libraryObject_ = boost::shared_ptr<QuantLib::SmileSectionInterface>(
! new QuantLib::InterpolatedSmileSection(expiryTime,
! fictitiousStrikes,
! volatilities));
}
--- 250,276 ----
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));
! }
}
Index: swaptionvolstructure.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/swaptionvolstructure.hpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** swaptionvolstructure.hpp 22 Nov 2006 10:58:43 -0000 1.37
--- swaptionvolstructure.hpp 24 Nov 2006 09:17:24 -0000 1.38
***************
*** 36,41 ****
public:
SwaptionConstantVolatility(const QuantLib::Date& referenceDate,
! const double volatility,
! const QuantLib::DayCounter& dayCounter);
};
--- 36,41 ----
public:
SwaptionConstantVolatility(const QuantLib::Date& referenceDate,
! const QuantLib::Handle<QuantLib::Quote>&,
! const QuantLib::DayCounter& dayCounter);
};
***************
*** 82,109 ****
bool vegaWeightedSmileFit,
const QuantLib::Matrix& parametersGuess,
! std::vector<bool> isParameterFixed,
bool isAtmCalibrated);
!
! const std::vector<std::vector<boost::any> > getSparseSabrParameters()
! {
! return getSabrParameters(sparseSabrParameters_);
! }
! const std::vector<std::vector<boost::any> > getDenseSabrParameters()
! {
! return getSabrParameters(denseSabrParameters_);
! }
! const std::vector<std::vector<boost::any> > getMarketVolCube()
! {
! return getVolCube(marketVolCube_);
! }
! const std::vector<std::vector<boost::any> > getVolCubeAtmCalibrated()
! {
! return getVolCube(volCubeAtmCalibrated_);
! }
! protected:
! QuantLib::Matrix sparseSabrParameters_;
! QuantLib::Matrix denseSabrParameters_;
! QuantLib::Matrix marketVolCube_;
! QuantLib::Matrix volCubeAtmCalibrated_;
};
--- 82,91 ----
bool vegaWeightedSmileFit,
const QuantLib::Matrix& parametersGuess,
! const std::vector<bool>& isParameterFixed,
bool isAtmCalibrated);
! std::vector<std::vector<boost::any> > getSparseSabrParameters();
! std::vector<std::vector<boost::any> > getDenseSabrParameters();
! std::vector<std::vector<boost::any> > getMarketVolCube();
! std::vector<std::vector<boost::any> > getVolCubeAtmCalibrated();
};
***************
*** 113,123 ****
class InterpolatedSmileSection : public SmileSectionInterface {
public:
! InterpolatedSmileSection(
! double expiryTime,
! const std::vector<double>& strikes,
! const std::vector<double>& volatilities);
! InterpolatedSmileSection(
! double expiryTime,
! double flatVolatility);
};
--- 95,102 ----
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);
};
***************
*** 133,137 ****
const QuantLib::Period& length);
};
-
}
--- 112,115 ----
|