QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
amortizingcmsratebond.cpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2008 Simon Ibbotson
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20#include <ql/instruments/bonds/amortizingcmsratebond.hpp>
21#include <ql/cashflows/cmscoupon.hpp>
22#include <ql/cashflows/simplecashflow.hpp>
23#include <ql/indexes/swapindex.hpp>
24#include <ql/time/schedule.hpp>
25
26namespace QuantLib {
27
29 Natural settlementDays,
30 const std::vector<Real>& notionals,
31 const Schedule& schedule,
32 const ext::shared_ptr<SwapIndex>& index,
33 const DayCounter& paymentDayCounter,
34 BusinessDayConvention paymentConvention,
35 Natural fixingDays,
36 const std::vector<Real>& gearings,
37 const std::vector<Spread>& spreads,
38 const std::vector<Rate>& caps,
39 const std::vector<Rate>& floors,
40 bool inArrears,
41 const Date& issueDate,
42 const std::vector<Real>& redemptions)
43 : Bond(settlementDays, schedule.calendar(), issueDate) {
44
45 maturityDate_ = schedule.endDate();
46
47 cashflows_ = CmsLeg(schedule, index)
49 .withPaymentDayCounter(paymentDayCounter)
50 .withPaymentAdjustment(paymentConvention)
51 .withFixingDays(fixingDays)
52 .withGearings(gearings)
53 .withSpreads(spreads)
54 .withCaps(caps)
55 .withFloors(floors)
56 .inArrears(inArrears);
57
59
60 QL_ENSURE(!cashflows().empty(), "bond with no cashflows!");
61
62 registerWith(index);
63 }
64
65}
AmortizingCmsRateBond(Natural settlementDays, const std::vector< Real > &notionals, const Schedule &schedule, const ext::shared_ptr< SwapIndex > &index, const DayCounter &paymentDayCounter, BusinessDayConvention paymentConvention=Following, Natural fixingDays=Null< Natural >(), const std::vector< Real > &gearings={ 1.0 }, const std::vector< Spread > &spreads={ 0.0 }, const std::vector< Rate > &caps={}, const std::vector< Rate > &floors={}, bool inArrears=false, const Date &issueDate=Date(), const std::vector< Real > &redemptions={ 100.0 })
Base bond class.
Definition: bond.hpp:59
const std::vector< Real > & notionals() const
Definition: bond.hpp:326
void addRedemptionsToCashflows(const std::vector< Real > &redemptions=std::vector< Real >())
Definition: bond.cpp:304
const Leg & cashflows() const
Definition: bond.hpp:330
Leg cashflows_
Definition: bond.hpp:288
const Leg & redemptions() const
Definition: bond.hpp:334
Date maturityDate_
Definition: bond.hpp:291
helper class building a sequence of capped/floored cms-rate coupons
Definition: cmscoupon.hpp:70
CmsLeg & withFloors(Rate floor)
Definition: cmscoupon.cpp:122
CmsLeg & withCaps(Rate cap)
Definition: cmscoupon.cpp:112
CmsLeg & withGearings(Real gearing)
Definition: cmscoupon.cpp:92
CmsLeg & withSpreads(Spread spread)
Definition: cmscoupon.cpp:102
CmsLeg & withPaymentDayCounter(const DayCounter &)
Definition: cmscoupon.cpp:72
CmsLeg & inArrears(bool flag=true)
Definition: cmscoupon.cpp:132
CmsLeg & withNotionals(Real notional)
Definition: cmscoupon.cpp:62
CmsLeg & withPaymentAdjustment(BusinessDayConvention)
Definition: cmscoupon.cpp:77
CmsLeg & withFixingDays(Natural fixingDays)
Definition: cmscoupon.cpp:82
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
Definition: observable.hpp:228
Payment schedule.
Definition: schedule.hpp:40
const Date & endDate() const
Definition: schedule.hpp:184
BusinessDayConvention
Business Day conventions.
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
Definition: any.hpp:35