QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.38
Loading...
Searching...
No Matches
custom.cpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
4
5namespace QuantLib {
6
7 CustomIborIndex::CustomIborIndex(const std::string& familyName,
8 const Period& tenor,
9 Natural settlementDays,
10 const Currency& currency,
11 const Calendar& fixingCalendar,
12 const Calendar& valueCalendar,
13 const Calendar& maturityCalendar,
14 BusinessDayConvention convention,
15 bool endOfMonth,
16 const DayCounter& dayCounter,
18 : IborIndex(familyName, tenor, settlementDays, currency, fixingCalendar,
19 convention, endOfMonth, dayCounter, h),
20 valueCalendar_(valueCalendar), maturityCalendar_(maturityCalendar) {}
21
22 Date CustomIborIndex::fixingDate(const Date& valueDate) const {
24 -static_cast<Integer>(fixingDays_), Days);
26 }
27
28 Date CustomIborIndex::valueDate(const Date& fixingDate) const {
29
31 "Fixing date " << fixingDate << " is not valid");
32
35 }
36
37 Date CustomIborIndex::maturityDate(const Date& valueDate) const {
40 }
41
42 ext::shared_ptr<IborIndex> CustomIborIndex::clone(
43 const Handle<YieldTermStructure>& h) const {
44 return ext::make_shared<CustomIborIndex>(
47 dayCounter_, h);
48 }
49
50}
calendar class
Definition: calendar.hpp:61
Date adjust(const Date &, BusinessDayConvention convention=Following) const
Definition: calendar.cpp:84
Date advance(const Date &, Integer n, TimeUnit unit, BusinessDayConvention convention=Following, bool endOfMonth=false) const
Definition: calendar.cpp:130
Currency specification
Definition: currency.hpp:36
CustomIborIndex(const std::string &familyName, const Period &tenor, Natural settlementDays, const Currency &currency, const Calendar &fixingCalendar, const Calendar &valueCalendar, const Calendar &maturityCalendar, BusinessDayConvention convention, bool endOfMonth, const DayCounter &dayCounter, const Handle< YieldTermStructure > &h={})
Definition: custom.cpp:7
Date valueDate(const Date &fixingDate) const override
Definition: custom.cpp:28
Calendar maturityCalendar_
Definition: custom.hpp:58
Date maturityDate(const Date &valueDate) const override
Definition: custom.cpp:37
ext::shared_ptr< IborIndex > clone(const Handle< YieldTermStructure > &h) const override
returns a copy of itself linked to a different forwarding curve
Definition: custom.cpp:42
Date fixingDate(const Date &valueDate) const override
Definition: custom.cpp:22
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
Shared handle to an observable.
Definition: handle.hpp:41
base class for Inter-Bank-Offered-Rate indexes (e.g. Libor, etc.)
Definition: iborindex.hpp:35
BusinessDayConvention convention_
Definition: iborindex.hpp:65
Calendar fixingCalendar() const override
returns the calendar defining valid fixing dates
bool isValidFixingDate(const Date &fixingDate) const override
returns TRUE if the fixing date is a valid one
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Definition: errors.hpp:117
Date d
BusinessDayConvention
Business Day conventions.
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
QL_INTEGER Integer
integer number
Definition: types.hpp:35
Definition: any.hpp:37