/usr/include/ql/indexes/swapindex.hpp is in libquantlib0-dev 1.7.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | /*
Copyright (C) 2006, 2009 Ferdinando Ametrano
Copyright (C) 2006, 2007, 2009 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
<http://quantlib.org/license.shtml>.
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 swapindex.hpp
\brief swap-rate indexes
*/
#ifndef quantlib_swapindex_hpp
#define quantlib_swapindex_hpp
#include <ql/indexes/interestrateindex.hpp>
#include <ql/termstructures/yieldtermstructure.hpp>
namespace QuantLib {
class Schedule;
class IborIndex;
class VanillaSwap;
class OvernightIndex;
class OvernightIndexedSwap;
//! base class for swap-rate indexes
class SwapIndex : public InterestRateIndex {
public:
SwapIndex(const std::string& familyName,
const Period& tenor,
Natural settlementDays,
Currency currency,
const Calendar& fixingCalendar,
const Period& fixedLegTenor,
BusinessDayConvention fixedLegConvention,
const DayCounter& fixedLegDayCounter,
const boost::shared_ptr<IborIndex>& iborIndex);
SwapIndex(const std::string& familyName,
const Period& tenor,
Natural settlementDays,
Currency currency,
const Calendar& fixingCalendar,
const Period& fixedLegTenor,
BusinessDayConvention fixedLegConvention,
const DayCounter& fixedLegDayCounter,
const boost::shared_ptr<IborIndex>& iborIndex,
const Handle<YieldTermStructure>& discountingTermStructure);
//! \name InterestRateIndex interface
//@{
Date maturityDate(const Date& valueDate) const;
//@}
//! \name Inspectors
//@{
Period fixedLegTenor() const { return fixedLegTenor_; }
BusinessDayConvention fixedLegConvention() const;
boost::shared_ptr<IborIndex> iborIndex() const { return iborIndex_; }
Handle<YieldTermStructure> forwardingTermStructure() const;
Handle<YieldTermStructure> discountingTermStructure() const;
bool exogenousDiscount() const;
/*! \warning Relinking the term structure underlying the index will
not have effect on the returned swap.
*/
boost::shared_ptr<VanillaSwap> underlyingSwap(
const Date& fixingDate) const;
//@}
//! \name Other methods
//@{
//! returns a copy of itself linked to a different forwarding curve
virtual boost::shared_ptr<SwapIndex> clone(
const Handle<YieldTermStructure>& forwarding) const;
//! returns a copy of itself linked to different curves
virtual boost::shared_ptr<SwapIndex> clone(
const Handle<YieldTermStructure>& forwarding,
const Handle<YieldTermStructure>& discounting) const;
//! returns a copy of itself with different tenor
virtual boost::shared_ptr<SwapIndex> clone(
const Period& tenor) const;
// @}
protected:
Rate forecastFixing(const Date& fixingDate) const;
Period tenor_;
boost::shared_ptr<IborIndex> iborIndex_;
Period fixedLegTenor_;
BusinessDayConvention fixedLegConvention_;
bool exogenousDiscount_;
Handle<YieldTermStructure> discount_;
// cache data to avoid swap recreation when the same fixing date
// is used multiple time to forecast changing fixing
mutable boost::shared_ptr<VanillaSwap> lastSwap_;
mutable Date lastFixingDate_;
};
//! base class for overnight indexed swap indexes
class OvernightIndexedSwapIndex : public SwapIndex {
public:
OvernightIndexedSwapIndex(
const std::string& familyName,
const Period& tenor,
Natural settlementDays,
Currency currency,
const boost::shared_ptr<OvernightIndex>& overnightIndex);
//! \name Inspectors
//@{
boost::shared_ptr<OvernightIndex> overnightIndex() const;
/*! \warning Relinking the term structure underlying the index will
not have effect on the returned swap.
*/
boost::shared_ptr<OvernightIndexedSwap> underlyingSwap(
const Date& fixingDate) const;
//@}
protected:
boost::shared_ptr<OvernightIndex> overnightIndex_;
// cache data to avoid swap recreation when the same fixing date
// is used multiple time to forecast changing fixing
mutable boost::shared_ptr<OvernightIndexedSwap> lastSwap_;
mutable Date lastFixingDate_;
};
// inline definitions
inline BusinessDayConvention SwapIndex::fixedLegConvention() const {
return fixedLegConvention_;
}
inline bool SwapIndex::exogenousDiscount() const {
return exogenousDiscount_;
}
inline boost::shared_ptr<OvernightIndex>
OvernightIndexedSwapIndex::overnightIndex() const {
return overnightIndex_;
}
}
#endif
|