[QuantLibAddin-cvs] QuantLibAddin/qlo date.cpp, NONE, 1.1 date.hpp, 1.2, 1.3
Brought to you by:
ericehlers,
nando
|
From: Ferdinando A. <na...@us...> - 2006-11-28 19:54:31
|
Update of /cvsroot/quantlibaddin/QuantLibAddin/qlo In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv3458/qlo Modified Files: date.hpp Added Files: date.cpp Log Message: added QuantLibAddin::qlNextIMMdates for calculating a strip of IMM dates --- NEW FILE: date.cpp --- /* Copyright (C) 2006 Ferdinando Ametrano 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 qua...@li... The license is also available online at http://quantlib.org/html/license.html 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. */ #include <qlo/date.hpp> namespace QuantLibAddin { std::vector<QuantLib::Date> qlNextIMMdates( const QuantLib::Date& d, const std::vector<bool>& mainCycle) { QuantLib::Size n = mainCycle.size(); std::vector<QuantLib::Date> results(n); results[0] = QuantLib::Date::nextIMMdate(d, mainCycle[0]); for (QuantLib::Size i=1; i<n; ++i) results[i] = QuantLib::Date::nextIMMdate( results[i-1]+1*QuantLib::Days, mainCycle[i]); return results; } } Index: date.hpp =================================================================== RCS file: /cvsroot/quantlibaddin/QuantLibAddin/qlo/date.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** date.hpp 4 Sep 2006 16:06:38 -0000 1.2 --- date.hpp 28 Nov 2006 19:54:22 -0000 1.3 *************** *** 21,24 **** --- 21,25 ---- #include <oh/object.hpp> #include <ql/period.hpp> + #include <ql/date.hpp> namespace QuantLibAddin { *************** *** 31,34 **** --- 32,38 ---- return p.frequency(); } + + std::vector<QuantLib::Date> qlNextIMMdates(const QuantLib::Date& d, + const std::vector<bool>& mainCycle); } |