Logo Search packages:      
Sourcecode: quantlib version File versions


 Copyright (C) 2006 Ferdinando Ametrano
 Copyright (C) 2006, 2007 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
 <quantlib-dev@lists.sf.net>. 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. */

#include <ql/indexes/swapindex.hpp>
#include <ql/instruments/makevanillaswap.hpp>
#include <sstream>

namespace QuantLib {

    SwapIndex::SwapIndex(const std::string& familyName,
                         const Period& tenor,
                         Natural settlementDays,
                         Currency currency,
                         const Calendar& calendar,
                         const Period& fixedLegTenor,
                         BusinessDayConvention fixedLegConvention,
                         const DayCounter& fixedLegDayCounter,
                         const boost::shared_ptr<IborIndex>& iborIndex)
    : InterestRateIndex(familyName, tenor, settlementDays,
                        currency, calendar, fixedLegDayCounter),
      tenor_(tenor), iborIndex_(iborIndex),
      fixedLegConvention_(fixedLegConvention) {

    Rate SwapIndex::forecastFixing(const Date& fixingDate) const {
        return underlyingSwap(fixingDate)->fairRate();

00046     boost::shared_ptr<VanillaSwap> SwapIndex::underlyingSwap(
                                               const Date& fixingDate) const {
        QL_REQUIRE(iborIndex_, "no index set");
                   "no forecasting term structure set to " <<
        return MakeVanillaSwap(tenor_, iborIndex_, 0.0)

    Schedule SwapIndex::fixedRateSchedule(const Date& fixingDate) const {

        Date start = fixingCalendar().advance(fixingDate, fixingDays_, Days);
        Date end = fixingCalendar().advance(start, tenor_);

        return Schedule(start, end, fixedLegTenor_, fixingCalendar(),
                        fixedLegConvention_, fixedLegConvention_,
                        false, false);

    Date SwapIndex::maturityDate(const Date& valueDate) const {
        return fixingCalendar().advance(valueDate, tenor_, Unadjusted, false);


Generated by  Doxygen 1.6.0   Back to index