QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
digitaliborcoupon.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) 2007 Cristina Duminuco
5 Copyright (C) 2007 Giorgio Facchinetti
6 Copyright (C) 2007 StatPro Italia srl
7
8 This file is part of QuantLib, a free-software/open-source library
9 for financial quantitative analysts and developers - http://quantlib.org/
10
11 QuantLib is free software: you can redistribute it and/or modify it
12 under the terms of the QuantLib license. You should have received a
13 copy of the license along with this program; if not, please email
14 <quantlib-dev@lists.sf.net>. The license is also available online at
15 <http://quantlib.org/license.shtml>.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the license for more details.
20*/
21
22/*! \file digitaliborcoupon.hpp
23 \brief Ibor-rate coupon with digital call/put option
24*/
25
26#ifndef quantlib_digital_ibor_coupon_hpp
27#define quantlib_digital_ibor_coupon_hpp
28
31#include <ql/time/schedule.hpp>
32
33namespace QuantLib {
34
35 //! Ibor rate coupon with digital digital call/put option
37 public:
39 const ext::shared_ptr<IborCoupon> &underlying,
41 Position::Type callPosition = Position::Long,
42 bool isCallATMIncluded = false,
45 Position::Type putPosition = Position::Long,
46 bool isPutATMIncluded = false,
48 const ext::shared_ptr<DigitalReplication>& replication = {},
49 bool nakedOption =false);
50
51 //! \name Visitability
52 //@{
53 void accept(AcyclicVisitor&) override;
54 //@}
55 };
56
57
58 //! helper class building a sequence of digital ibor-rate coupons
60 public:
61 DigitalIborLeg(Schedule schedule, ext::shared_ptr<IborIndex> index);
63 DigitalIborLeg& withNotionals(const std::vector<Real>& notionals);
67 DigitalIborLeg& withFixingDays(const std::vector<Natural>& fixingDays);
69 DigitalIborLeg& withGearings(const std::vector<Real>& gearings);
71 DigitalIborLeg& withSpreads(const std::vector<Spread>& spreads);
72 DigitalIborLeg& inArrears(bool flag = true);
74 DigitalIborLeg& withCallStrikes(const std::vector<Rate>& strikes);
76 DigitalIborLeg& withCallATM(bool flag = true);
78 DigitalIborLeg& withCallPayoffs(const std::vector<Rate>& payoffs);
80 DigitalIborLeg& withPutStrikes(const std::vector<Rate>& strikes);
82 DigitalIborLeg& withPutATM(bool flag = true);
84 DigitalIborLeg& withPutPayoffs(const std::vector<Rate>& payoffs);
85 DigitalIborLeg& withReplication(const ext::shared_ptr<DigitalReplication>&);
86 /*! \deprecated Use the overload that passes a replication instead.
87 Deprecated in version 1.32.
88 */
89 [[deprecated("Use the overload that passes a replication instead")]]
91 DigitalIborLeg& withNakedOption(bool nakedOption = true);
92
93 operator Leg() const;
94 private:
96 ext::shared_ptr<IborIndex> index_;
97 std::vector<Real> notionals_;
100 std::vector<Natural> fixingDays_;
101 std::vector<Real> gearings_;
102 std::vector<Spread> spreads_;
103 bool inArrears_ = false;
104 std::vector<Rate> callStrikes_, callPayoffs_;
106 bool callATM_ = false;
107 std::vector<Rate> putStrikes_, putPayoffs_;
109 bool putATM_ = false;
110 ext::shared_ptr<DigitalReplication> replication_;
112 };
113
114}
115
116
117#endif
degenerate base class for the Acyclic Visitor pattern
Definition: visitor.hpp:33
day counter class
Definition: daycounter.hpp:44
Digital-payoff coupon.
ext::shared_ptr< FloatingRateCoupon > underlying() const
Rate callDigitalPayoff() const
Ibor rate coupon with digital digital call/put option.
void accept(AcyclicVisitor &) override
helper class building a sequence of digital ibor-rate coupons
BusinessDayConvention paymentAdjustment_
DigitalIborLeg & withNakedOption(bool nakedOption=true)
std::vector< Rate > putStrikes_
DigitalIborLeg & withPaymentDayCounter(const DayCounter &)
DigitalIborLeg & withGearings(Real gearing)
DigitalIborLeg & withPutStrikes(Rate strike)
std::vector< Rate > callStrikes_
DigitalIborLeg & withSpreads(Spread spread)
std::vector< Real > notionals_
std::vector< Spread > spreads_
std::vector< Rate > callPayoffs_
DigitalIborLeg & withFixingDays(Natural fixingDays)
DigitalIborLeg & withReplication()
DigitalIborLeg & inArrears(bool flag=true)
DigitalIborLeg & withCallATM(bool flag=true)
DigitalIborLeg & withLongPutOption(Position::Type)
DigitalIborLeg & withCallStrikes(Rate strike)
DigitalIborLeg & withPutATM(bool flag=true)
std::vector< Natural > fixingDays_
DigitalIborLeg & withPutPayoffs(Rate payoff)
ext::shared_ptr< DigitalReplication > replication_
std::vector< Rate > putPayoffs_
DigitalIborLeg & withCallPayoffs(Rate payoff)
DigitalIborLeg & withNotionals(Real notional)
std::vector< Real > gearings_
DigitalIborLeg & withLongCallOption(Position::Type)
DigitalIborLeg & withPaymentAdjustment(BusinessDayConvention)
ext::shared_ptr< IborIndex > index_
template class providing a null value for a given type.
Definition: null.hpp:76
Payment schedule.
Definition: schedule.hpp:40
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
Coupon paying a Libor-type index.
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