Update of /cvsroot/quantlibaddin/QuantLibAddin/qlo
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv4792/qlo
Modified Files:
swaptionvolstructure.cpp swaptionvolstructure.hpp
Log Message:
SwaptionVolCube initial implementation
Index: swaptionvolstructure.cpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/swaptionvolstructure.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** swaptionvolstructure.cpp 26 Jun 2006 21:31:03 -0000 1.6
--- swaptionvolstructure.cpp 7 Aug 2006 15:25:32 -0000 1.7
***************
*** 22,27 ****
#include <qlo/swaptionvolstructure.hpp>
- #include <ql/Volatilities/swaptionvolmatrix.hpp>
#include <ql/Volatilities/swaptionconstantvol.hpp>
namespace QuantLibAddin {
--- 22,27 ----
#include <qlo/swaptionvolstructure.hpp>
#include <ql/Volatilities/swaptionconstantvol.hpp>
+ #include <ql/Volatilities/swaptionvolcube.hpp>
namespace QuantLibAddin {
***************
*** 51,54 ****
--- 51,55 ----
}
+
SwaptionVolatilityMatrix::SwaptionVolatilityMatrix(
const std::vector<QuantLib::Period>& expiries,
***************
*** 67,69 ****
--- 68,100 ----
dayCounter));
}
+
+
+ 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>(
+ libraryObject_)->locate(d,p);
+ std::vector<long> result(2);
+ result[0]=indexes.first;
+ result[1]=indexes.second;
+ return result;
+ }
+
+
+ SwaptionVolatilityCube::SwaptionVolatilityCube(
+ const QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>& atmVol,
+ const std::vector<QuantLib::Period>& expiries,
+ const std::vector<QuantLib::Period>& lengths,
+ const std::vector<QuantLib::Spread>& strikeSpreads,
+ const QuantLib::Matrix& volSpreads)
+ {
+ libraryObject_ = boost::shared_ptr<QuantLib::Extrapolator>(
+ new QuantLib::SwaptionVolatilityCube(atmVol,
+ expiries,
+ lengths,
+ strikeSpreads,
+ volSpreads));
+ }
+
}
Index: swaptionvolstructure.hpp
===================================================================
RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/swaptionvolstructure.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** swaptionvolstructure.hpp 23 Jun 2006 17:53:29 -0000 1.6
--- swaptionvolstructure.hpp 7 Aug 2006 15:25:32 -0000 1.7
***************
*** 23,26 ****
--- 23,27 ----
#include <ql/swaptionvolstructure.hpp>
#include <qlo/termstructures.hpp>
+ #include <ql/Volatilities/swaptionvolmatrix.hpp>
namespace QuantLibAddin {
***************
*** 47,50 ****
--- 48,63 ----
const QuantLib::Matrix& volatilities,
const QuantLib::DayCounter& dayCounter);
+ std::vector<long> locate(const QuantLib::Date& d,
+ const QuantLib::Period& p);
+ };
+
+ class SwaptionVolatilityCube : public SwaptionVolatilityStructure {
+ public:
+ SwaptionVolatilityCube(
+ const QuantLib::Handle<QuantLib::SwaptionVolatilityStructure>& atmVol,
+ const std::vector<QuantLib::Period>& expiries,
+ const std::vector<QuantLib::Period>& lengths,
+ const std::vector<QuantLib::Spread>& strikeSpreads,
+ const QuantLib::Matrix& volSpreads);
};
|