Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
makeoiscapfloor.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2022 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file makeoiscapfloor.hpp
20 \brief helper class to instantiate standard market OIS cap / floors
21*/
22
23#pragma once
24
26
27#include <ql/instruments/capfloor.hpp>
28
29namespace QuantExt {
30
32public:
33 // optional discount curve is used to determine ATM level (and only that)
34 MakeOISCapFloor(CapFloor::Type type, const Period& tenor, const ext::shared_ptr<OvernightIndex>& index,
35 const Period& rateComputationPeriod, Rate strike,
36 const QuantLib::Handle<QuantLib::YieldTermStructure>& discountCurve = Handle<YieldTermStructure>());
37
38 operator Leg() const;
39
41 MakeOISCapFloor& withEffectiveDate(const Date& effectiveDate);
42 MakeOISCapFloor& withSettlementDays(Natural settlementDays);
43 MakeOISCapFloor& withCalendar(const Calendar& cal);
44 MakeOISCapFloor& withConvention(BusinessDayConvention bdc);
45 MakeOISCapFloor& withRule(DateGeneration::Rule r);
46 MakeOISCapFloor& withDayCount(const DayCounter& dc);
47 MakeOISCapFloor& withTelescopicValueDates(bool telescopicValueDates);
48
49 MakeOISCapFloor& withCouponPricer(const ext::shared_ptr<CappedFlooredOvernightIndexedCouponPricer>& pricer);
51
52private:
53 CapFloor::Type type_;
54 Period tenor_;
55 QuantLib::ext::shared_ptr<OvernightIndex> index_;
57 Rate strike_;
58
62 Calendar calendar_;
63 BusinessDayConvention convention_;
64 DateGeneration::Rule rule_;
65 DayCounter dayCounter_;
67
68 ext::shared_ptr<CappedFlooredOvernightIndexedCouponPricer> pricer_;
69 QuantLib::Handle<QuantLib::YieldTermStructure> discountCurve_;
70};
71
72//! get the underlying ON coupons from an OIS cf
73Leg getOisCapFloorUnderlying(const Leg& oisCapFloor);
74
75//! get the (cap, floor) - strikes from an OIS cf
76std::vector<std::pair<Real, Real>> getOisCapFloorStrikes(const Leg& oisCapFloor);
77
78} // namespace QuantExt
ext::shared_ptr< CappedFlooredOvernightIndexedCouponPricer > pricer_
MakeOISCapFloor & withEffectiveDate(const Date &effectiveDate)
QuantLib::ext::shared_ptr< OvernightIndex > index_
MakeOISCapFloor & withSettlementDays(Natural settlementDays)
MakeOISCapFloor & withDayCount(const DayCounter &dc)
MakeOISCapFloor & withCouponPricer(const ext::shared_ptr< CappedFlooredOvernightIndexedCouponPricer > &pricer)
MakeOISCapFloor & withRule(DateGeneration::Rule r)
QuantLib::Handle< QuantLib::YieldTermStructure > discountCurve_
MakeOISCapFloor & withTelescopicValueDates(bool telescopicValueDates)
BusinessDayConvention convention_
DateGeneration::Rule rule_
MakeOISCapFloor & withCalendar(const Calendar &cal)
MakeOISCapFloor & withDiscountCurve()
MakeOISCapFloor & withConvention(BusinessDayConvention bdc)
MakeOISCapFloor & withNominal(Real n)
Leg getOisCapFloorUnderlying(const Leg &oisCapFloor)
get the underlying ON coupons from an OIS cf
std::vector< std::pair< Real, Real > > getOisCapFloorStrikes(const Leg &oisCapFloor)
get the (cap, floor) - strikes from an OIS cf
coupon paying the compounded daily overnight rate, copy of QL class, added includeSpread flag