Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
optionletstripper.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 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 qle/termstructures/optionletstripper.hpp
20 \brief optionlet (caplet/floorlet) volatility stripper
21*/
22
23#ifndef quantext_optionletstripper_hpp
24#define quantext_optionletstripper_hpp
25
26#include <ql/termstructures/volatility/optionlet/strippedoptionletbase.hpp>
27#include <ql/termstructures/volatility/volatilitytype.hpp>
28#include <ql/termstructures/yieldtermstructure.hpp>
30
31namespace QuantLib {
32class IborIndex;
33}
34
35namespace QuantExt {
36using namespace QuantLib;
37
38/*! Copy of the QL class that uses an QuantExt::CapFloorTermVolSurface
39 to support BiLinearInterpolation
40*/
42public:
43 //! \name StrippedOptionletBase interface
44 //@{
45 const std::vector<Rate>& optionletStrikes(Size i) const override;
46 const std::vector<Volatility>& optionletVolatilities(Size i) const override;
47
48 const std::vector<Date>& optionletFixingDates() const override;
49 const std::vector<Time>& optionletFixingTimes() const override;
50 Size optionletMaturities() const override;
51
52 const std::vector<Rate>& atmOptionletRates() const override;
53
54 DayCounter dayCounter() const override;
55 Calendar calendar() const override;
56 Natural settlementDays() const override;
57 BusinessDayConvention businessDayConvention() const override;
58 //@}
59
60 const std::vector<Period>& optionletFixingTenors() const;
61 const std::vector<Date>& optionletPaymentDates() const;
62 const std::vector<Time>& optionletAccrualPeriods() const;
63 ext::shared_ptr<CapFloorTermVolSurface> termVolSurface() const;
64 ext::shared_ptr<IborIndex> index() const;
65 Real displacement() const override;
66 VolatilityType volatilityType() const override;
67
68 const Period& rateComputationPeriod() const;
69
70protected:
71 // if index is OIS, rateComputationPeriod must be provided, for Ibor it is derived from the index tenor
72 OptionletStripper(const ext::shared_ptr<QuantExt::CapFloorTermVolSurface>&, const ext::shared_ptr<IborIndex>& index,
73 const Handle<YieldTermStructure>& discount = Handle<YieldTermStructure>(),
74 const VolatilityType type = ShiftedLognormal, const Real displacement = 0.0,
75 const Period& rateComputationPeriod = 0 * Days, const Size onCapSettlementDays = 0);
76
77 //! Method to populate the dates, times and accruals that can be overridden in derived classes
78 virtual void populateDates() const;
79
80 ext::shared_ptr<CapFloorTermVolSurface> termVolSurface_;
81 ext::shared_ptr<IborIndex> index_;
82 Handle<YieldTermStructure> discount_;
85
86 mutable std::vector<std::vector<Rate> > optionletStrikes_;
87 mutable std::vector<std::vector<Volatility>> optionletVolatilities_;
88
89 mutable std::vector<Time> optionletTimes_;
90 mutable std::vector<Date> optionletDates_;
91 std::vector<Period> optionletTenors_;
92 mutable std::vector<Rate> atmOptionletRate_;
93 mutable std::vector<Date> optionletPaymentDates_;
94 mutable std::vector<Time> optionletAccrualPeriods_;
95
96 std::vector<Period> capFloorLengths_;
97 const VolatilityType volatilityType_;
98 const Real displacement_;
101};
102
103} // namespace QuantExt
104
105#endif
Cap/floor smile volatility surface.
Calendar calendar() const override
const Period & rateComputationPeriod() const
std::vector< Rate > atmOptionletRate_
std::vector< std::vector< Volatility > > optionletVolatilities_
const std::vector< Date > & optionletFixingDates() const override
std::vector< Period > capFloorLengths_
ext::shared_ptr< CapFloorTermVolSurface > termVolSurface() const
Handle< YieldTermStructure > discount_
const std::vector< Rate > & optionletStrikes(Size i) const override
std::vector< Date > optionletPaymentDates_
std::vector< Time > optionletAccrualPeriods_
const std::vector< Time > & optionletFixingTimes() const override
const std::vector< Date > & optionletPaymentDates() const
const std::vector< Volatility > & optionletVolatilities(Size i) const override
const std::vector< Rate > & atmOptionletRates() const override
std::vector< Period > optionletTenors_
VolatilityType volatilityType() const override
std::vector< Time > optionletTimes_
std::vector< Date > optionletDates_
Natural settlementDays() const override
DayCounter dayCounter() const override
const std::vector< Period > & optionletFixingTenors() const
const VolatilityType volatilityType_
BusinessDayConvention businessDayConvention() const override
std::vector< std::vector< Rate > > optionletStrikes_
Real displacement() const override
virtual void populateDates() const
Method to populate the dates, times and accruals that can be overridden in derived classes.
ext::shared_ptr< IborIndex > index() const
ext::shared_ptr< CapFloorTermVolSurface > termVolSurface_
const std::vector< Time > & optionletAccrualPeriods() const
Size optionletMaturities() const override
ext::shared_ptr< IborIndex > index_