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 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
|
/*
Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl
Copyright (C) 2003, 2004 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.
*/
#ifndef quantlib_term_structures_i
#define quantlib_term_structures_i
%include common.i
%include types.i
%include interestrate.i
%include date.i
%include calendars.i
%include daycounters.i
%include currencies.i
%include observer.i
%include marketelements.i
%include interpolation.i
%{
using QuantLib::YieldTermStructure;
%}
%ignore YieldTermStructure;
class YieldTermStructure : public Extrapolator {
#if defined(SWIGMZSCHEME) || defined(SWIGGUILE)
%rename("day-counter") dayCounter;
%rename("reference-date") referenceDate;
%rename("max-date") maxDate;
%rename("max-time") maxTime;
%rename("zero-rate") zeroRate;
%rename("forward-rate") forwardRate;
#endif
public:
DayCounter dayCounter() const;
Calendar calendar() const;
Date referenceDate() const;
Date maxDate() const;
Time maxTime() const;
DiscountFactor discount(const Date&, bool extrapolate = false);
DiscountFactor discount(Time, bool extrapolate = false);
InterestRate zeroRate(const Date& d,
const DayCounter&, Compounding, Frequency f = Annual,
bool extrapolate = false) const;
InterestRate zeroRate(Time t,
Compounding, Frequency f = Annual,
bool extrapolate = false) const;
InterestRate forwardRate(const Date& d1, const Date& d2,
const DayCounter&, Compounding,
Frequency f = Annual,
bool extrapolate = false) const;
InterestRate forwardRate(Time t1, Time t2,
Compounding, Frequency f = Annual,
bool extrapolate = false) const;
};
%template(YieldTermStructure) boost::shared_ptr<YieldTermStructure>;
IsObservable(boost::shared_ptr<YieldTermStructure>);
%template(YieldTermStructureHandle) Handle<YieldTermStructure>;
IsObservable(Handle<YieldTermStructure>);
%template(RelinkableYieldTermStructureHandle)
RelinkableHandle<YieldTermStructure>;
// implied term structure
%{
using QuantLib::ImpliedTermStructure;
typedef boost::shared_ptr<YieldTermStructure> ImpliedTermStructurePtr;
%}
%rename(ImpliedTermStructure) ImpliedTermStructurePtr;
class ImpliedTermStructurePtr: public boost::shared_ptr<YieldTermStructure> {
public:
%extend {
ImpliedTermStructurePtr(const Handle<YieldTermStructure>& curveHandle,
const Date& referenceDate) {
return new ImpliedTermStructurePtr(
new ImpliedTermStructure(curveHandle, referenceDate));
}
}
};
// spreaded term structures
%{
using QuantLib::ZeroSpreadedTermStructure;
using QuantLib::ForwardSpreadedTermStructure;
typedef boost::shared_ptr<YieldTermStructure> ZeroSpreadedTermStructurePtr;
typedef boost::shared_ptr<YieldTermStructure> ForwardSpreadedTermStructurePtr;
%}
%rename(ZeroSpreadedTermStructure) ZeroSpreadedTermStructurePtr;
class ZeroSpreadedTermStructurePtr
: public boost::shared_ptr<YieldTermStructure> {
public:
%extend {
ZeroSpreadedTermStructurePtr(
const Handle<YieldTermStructure>& curveHandle,
const Handle<Quote>& spreadHandle) {
return new ZeroSpreadedTermStructurePtr(
new ZeroSpreadedTermStructure(curveHandle,spreadHandle));
}
}
};
%rename(ForwardSpreadedTermStructure) ForwardSpreadedTermStructurePtr;
class ForwardSpreadedTermStructurePtr
: public boost::shared_ptr<YieldTermStructure> {
public:
%extend {
ForwardSpreadedTermStructurePtr(
const Handle<YieldTermStructure>& curveHandle,
const Handle<Quote>& spreadHandle) {
return new ForwardSpreadedTermStructurePtr(
new ForwardSpreadedTermStructure(curveHandle,spreadHandle));
}
}
};
// flat forward curve
%{
using QuantLib::FlatForward;
typedef boost::shared_ptr<YieldTermStructure> FlatForwardPtr;
%}
%rename(FlatForward) FlatForwardPtr;
class FlatForwardPtr : public boost::shared_ptr<YieldTermStructure> {
public:
%extend {
FlatForwardPtr(const Date& referenceDate,
const Handle<Quote>& forward,
const DayCounter& dayCounter,
Compounding compounding = QuantLib::Continuous,
Frequency frequency = QuantLib::Annual) {
return new FlatForwardPtr(
new FlatForward(referenceDate,forward,dayCounter,
compounding,frequency));
}
FlatForwardPtr(const Date& referenceDate,
Rate forward,
const DayCounter& dayCounter,
Compounding compounding = QuantLib::Continuous,
Frequency frequency = QuantLib::Annual) {
return new FlatForwardPtr(
new FlatForward(referenceDate,forward,dayCounter,
compounding,frequency));
}
FlatForwardPtr(Integer settlementDays, const Calendar& calendar,
const Handle<Quote>& forward,
const DayCounter& dayCounter,
Compounding compounding = QuantLib::Continuous,
Frequency frequency = QuantLib::Annual) {
return new FlatForwardPtr(
new FlatForward(settlementDays,calendar,forward,dayCounter,
compounding,frequency));
}
FlatForwardPtr(Integer settlementDays, const Calendar& calendar,
Rate forward,
const DayCounter& dayCounter,
Compounding compounding = QuantLib::Continuous,
Frequency frequency = QuantLib::Annual) {
return new FlatForwardPtr(
new FlatForward(settlementDays,calendar,forward,dayCounter,
compounding,frequency));
}
}
};
#endif
|