QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
digitalcmsspreadcoupon.hpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2015 Peter Caspers
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/*! \file digitalcmsspreadcoupon.hpp
21 \brief Cms-spread-rate coupon with digital call/put option
22*/
23
24#ifndef quantlib_digital_cmsspread_coupon_hpp
25#define quantlib_digital_cmsspread_coupon_hpp
26
29#include <ql/time/schedule.hpp>
30
31namespace QuantLib {
32
33 //! Cms-spread-rate coupon with digital digital call/put option
35 public:
37 const ext::shared_ptr<CmsSpreadCoupon> &underlying,
39 Position::Type callPosition = Position::Long,
40 bool isCallATMIncluded = false,
43 Position::Type putPosition = Position::Long,
44 bool isPutATMIncluded = false,
46 const ext::shared_ptr<DigitalReplication> &replication = {},
47 bool nakedOption = false);
48
49 //! \name Visitability
50 //@{
51 void accept(AcyclicVisitor&) override;
52 //@}
53 };
54
55
56 //! helper class building a sequence of digital ibor-rate coupons
58 public:
59 DigitalCmsSpreadLeg(Schedule schedule, ext::shared_ptr<SwapSpreadIndex> index);
61 DigitalCmsSpreadLeg& withNotionals(const std::vector<Real>& notionals);
65 DigitalCmsSpreadLeg& withFixingDays(const std::vector<Natural>& fixingDays);
67 DigitalCmsSpreadLeg& withGearings(const std::vector<Real>& gearings);
69 DigitalCmsSpreadLeg& withSpreads(const std::vector<Spread>& spreads);
70 DigitalCmsSpreadLeg& inArrears(bool flag = true);
72 DigitalCmsSpreadLeg& withCallStrikes(const std::vector<Rate>& strikes);
74 DigitalCmsSpreadLeg& withCallATM(bool flag = true);
76 DigitalCmsSpreadLeg& withCallPayoffs(const std::vector<Rate>& payoffs);
78 DigitalCmsSpreadLeg& withPutStrikes(const std::vector<Rate>& strikes);
80 DigitalCmsSpreadLeg& withPutATM(bool flag = true);
82 DigitalCmsSpreadLeg& withPutPayoffs(const std::vector<Rate>& payoffs);
83 DigitalCmsSpreadLeg& withReplication(const ext::shared_ptr<DigitalReplication>&);
84 /*! \deprecated Use the overload that passes a replication instead.
85 Deprecated in version 1.32.
86 */
87 [[deprecated("Use the overload that passes a replication instead")]]
89 DigitalCmsSpreadLeg& withNakedOption(bool nakedOption = true);
90
91 operator Leg() const;
92 private:
94 ext::shared_ptr<SwapSpreadIndex> index_;
95 std::vector<Real> notionals_;
98 std::vector<Natural> fixingDays_;
99 std::vector<Real> gearings_;
100 std::vector<Spread> spreads_;
101 bool inArrears_ = false;
102 std::vector<Rate> callStrikes_, callPayoffs_;
104 bool callATM_ = false;
105 std::vector<Rate> putStrikes_, putPayoffs_;
107 bool putATM_ = false;
108 ext::shared_ptr<DigitalReplication> replication_;
110 };
111
112}
113
114
115#endif
degenerate base class for the Acyclic Visitor pattern
Definition: visitor.hpp:33
day counter class
Definition: daycounter.hpp:44
Cms-spread-rate coupon with digital digital call/put option.
void accept(AcyclicVisitor &) override
helper class building a sequence of digital ibor-rate coupons
DigitalCmsSpreadLeg & inArrears(bool flag=true)
DigitalCmsSpreadLeg & withPutATM(bool flag=true)
DigitalCmsSpreadLeg & withCallATM(bool flag=true)
BusinessDayConvention paymentAdjustment_
DigitalCmsSpreadLeg & withNakedOption(bool nakedOption=true)
DigitalCmsSpreadLeg & withCallStrikes(Rate strike)
DigitalCmsSpreadLeg & withPutPayoffs(Rate payoff)
DigitalCmsSpreadLeg & withPutStrikes(Rate strike)
DigitalCmsSpreadLeg & withGearings(Real gearing)
DigitalCmsSpreadLeg & withSpreads(Spread spread)
DigitalCmsSpreadLeg & withCallPayoffs(Rate payoff)
DigitalCmsSpreadLeg & withLongPutOption(Position::Type)
DigitalCmsSpreadLeg & withNotionals(Real notional)
DigitalCmsSpreadLeg & withFixingDays(Natural fixingDays)
DigitalCmsSpreadLeg & withLongCallOption(Position::Type)
DigitalCmsSpreadLeg & withPaymentAdjustment(BusinessDayConvention)
ext::shared_ptr< DigitalReplication > replication_
ext::shared_ptr< SwapSpreadIndex > index_
DigitalCmsSpreadLeg & withReplication()
DigitalCmsSpreadLeg & withPaymentDayCounter(const DayCounter &)
Digital-payoff coupon.
ext::shared_ptr< FloatingRateCoupon > underlying() const
Rate callDigitalPayoff() const
template class providing a null value for a given type.
Definition: null.hpp:76
Payment schedule.
Definition: schedule.hpp:40
CMS spread coupon.
Floating-rate coupon with digital call/put option.
BusinessDayConvention
Business Day conventions.
QL_REAL Real
real number
Definition: types.hpp:50
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
Real Spread
spreads on interest rates
Definition: types.hpp:74
Real Rate
interest rates
Definition: types.hpp:70
ext::shared_ptr< QuantLib::Payoff > payoff
Definition: any.hpp:35
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
Definition: cashflow.hpp:78
date schedule