QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
zerocouponswap.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2021 Marcin Rybacki
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
24#ifndef quantlib_zerocouponswap_hpp
25#define quantlib_zerocouponswap_hpp
26
27#include <ql/instruments/swap.hpp>
28#include <ql/time/calendar.hpp>
29#include <ql/time/daycounter.hpp>
30
31namespace QuantLib {
32 class IborIndex;
33
35
71 class ZeroCouponSwap : public Swap {
72 public:
75 const Date& startDate,
76 const Date& maturityDate,
78 ext::shared_ptr<IborIndex> iborIndex,
79 const Calendar& paymentCalendar,
80 BusinessDayConvention paymentConvention = Following,
81 Natural paymentDelay = 0);
82
85 const Date& startDate,
86 const Date& maturityDate,
87 Rate fixedRate,
88 const DayCounter& fixedDayCounter,
89 ext::shared_ptr<IborIndex> iborIndex,
90 const Calendar& paymentCalendar,
91 BusinessDayConvention paymentConvention = Following,
92 Natural paymentDelay = 0);
93
95
96
97 Type type() const { return type_; }
98 Real baseNominal() const { return baseNominal_; }
99 Date startDate() const override { return startDate_; }
100 Date maturityDate() const override { return maturityDate_; }
101 const ext::shared_ptr<IborIndex>& iborIndex() const { return iborIndex_; }
102
104 const Leg& fixedLeg() const;
106 const Leg& floatingLeg() const;
107
108 Real fixedPayment() const;
110
112
113 Real fixedLegNPV() const;
114 Real floatingLegNPV() const;
115 Real fairFixedPayment() const;
116 Rate fairFixedRate(const DayCounter& dayCounter) const;
118
119 private:
122 const Date& startDate,
123 const Date& maturityDate,
124 ext::shared_ptr<IborIndex> iborIndex,
125 const Calendar& paymentCalendar,
126 BusinessDayConvention paymentConvention,
127 Natural paymentDelay);
128
131 ext::shared_ptr<IborIndex> iborIndex_;
135 };
136}
137
138#endif
calendar class
Definition: calendar.hpp:61
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
Interest rate swap.
Definition: swap.hpp:41
Zero-coupon interest rate swap.
Rate fairFixedRate(const DayCounter &dayCounter) const
const Leg & floatingLeg() const
just one cashflow in each leg
Date startDate() const override
ext::shared_ptr< IborIndex > iborIndex_
const ext::shared_ptr< IborIndex > & iborIndex() const
const Leg & fixedLeg() const
just one cashflow in each leg
Date maturityDate() const override
Type type() const
"payer" or "receiver" refer to the fixed leg.
BusinessDayConvention
Business Day conventions.
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
Real Rate
interest rates
Definition: types.hpp:70
Definition: any.hpp:35
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
Definition: cashflow.hpp:78