/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* Copyright (C) 2006 Roland Lichters Copyright (C) 2006 StatPro Italia srl 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 . The license is also available online at . 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. */ /*! \file piecewisezerospreadedtermstructure.hpp \brief Piecewise-zero-spreaded term structure */ #ifndef quantlib_piecewise_zero_spreaded_term_structure_hpp #define quantlib_piecewise_zero_spreaded_term_structure_hpp #include #include #include namespace QuantLib { //! Term structure with an added vector of spreads on the zero-yield rate /*! The zero-yield spread at any given date is linearly interpolated between the input data. \note This term structure will remain linked to the original structure, i.e., any changes in the latter will be reflected in this structure as well. \ingroup yieldtermstructures */ class PiecewiseZeroSpreadedTermStructure : public ZeroYieldStructure { public: PiecewiseZeroSpreadedTermStructure( const Handle&, const std::vector >& spreads, const std::vector& dates); //! \name YieldTermStructure interface //@{ DayCounter dayCounter() const; Calendar calendar() const; const Date& referenceDate() const; Date maxDate() const; //@} protected: //! returns the spreaded zero yield rate Rate zeroYieldImpl(Time) const; void update(); private: void updateTimes(); Handle originalCurve_; std::vector > spreads_; std::vector dates_; std::vector