Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | List of all members
NonStandardYoYInflationCouponPricer Class Reference

base pricer for capped/floored YoY inflation coupons More...

#include <qle/cashflows/nonstandardinflationcouponpricer.hpp>

+ Inheritance diagram for NonStandardYoYInflationCouponPricer:
+ Collaboration diagram for NonStandardYoYInflationCouponPricer:

Public Member Functions

 NonStandardYoYInflationCouponPricer (const Handle< YieldTermStructure > &nominalTermStructure)
 
 NonStandardYoYInflationCouponPricer (const Handle< YoYOptionletVolatilitySurface > &capletVol, const Handle< YieldTermStructure > &nominalTermStructure)
 
virtual Handle< YoYOptionletVolatilitySurfacecapletVolatility () const
 
virtual Handle< YieldTermStructure > nominalTermStructure () const
 
virtual void setCapletVolatility (const Handle< YoYOptionletVolatilitySurface > &capletVol)
 

InflationCouponPricer interface

Handle< YoYOptionletVolatilitySurfacecapletVol_
 data More...
 
Handle< YieldTermStructure > nominalTermStructure_
 
const NonStandardYoYInflationCouponcoupon_
 
Real gearing_
 
Spread spread_
 
Real discount_
 
virtual Real swapletPrice () const override
 
virtual Rate swapletRate () const override
 
virtual Real capletPrice (Rate effectiveCap) const override
 
virtual Rate capletRate (Rate effectiveCap) const override
 
virtual Real floorletPrice (Rate effectiveFloor) const override
 
virtual Rate floorletRate (Rate effectiveFloor) const override
 
virtual void initialize (const InflationCoupon &) override
 
virtual Real optionletPrice (Option::Type optionType, Real effStrike) const
 
virtual Real optionletRate (Option::Type optionType, Real effStrike) const
 
virtual Real optionletPriceImp (Option::Type, Real strike, Real forward, Real stdDev) const
 
virtual Rate adjustedFixing (Rate fixing=Null< Rate >()) const
 

Detailed Description

base pricer for capped/floored YoY inflation coupons

Note
this pricer can already do swaplets but to get volatility-dependent coupons you need the descendents.

Definition at line 46 of file nonstandardinflationcouponpricer.hpp.

Constructor & Destructor Documentation

◆ NonStandardYoYInflationCouponPricer() [1/2]

NonStandardYoYInflationCouponPricer ( const Handle< YieldTermStructure > &  nominalTermStructure)

Definition at line 41 of file nonstandardinflationcouponpricer.cpp.

44 registerWith(nominalTermStructure_);
45}
virtual Handle< YieldTermStructure > nominalTermStructure() const

◆ NonStandardYoYInflationCouponPricer() [2/2]

NonStandardYoYInflationCouponPricer ( const Handle< YoYOptionletVolatilitySurface > &  capletVol,
const Handle< YieldTermStructure > &  nominalTermStructure 
)

Definition at line 47 of file nonstandardinflationcouponpricer.cpp.

50 registerWith(capletVol_);
51 registerWith(nominalTermStructure_);
52}
Handle< YoYOptionletVolatilitySurface > capletVol_
data

Member Function Documentation

◆ capletVolatility()

virtual Handle< YoYOptionletVolatilitySurface > capletVolatility ( ) const
virtual

Definition at line 52 of file nonstandardinflationcouponpricer.hpp.

52{ return capletVol_; }
+ Here is the caller graph for this function:

◆ nominalTermStructure()

virtual Handle< YieldTermStructure > nominalTermStructure ( ) const
virtual

Definition at line 54 of file nonstandardinflationcouponpricer.hpp.

54{ return nominalTermStructure_; }

◆ setCapletVolatility()

void setCapletVolatility ( const Handle< YoYOptionletVolatilitySurface > &  capletVol)
virtual

Definition at line 54 of file nonstandardinflationcouponpricer.cpp.

54 {
55 QL_REQUIRE(!capletVol.empty(), "empty capletVol handle");
56 capletVol_ = capletVol;
57 registerWith(capletVol_);
58}

◆ swapletPrice()

Real swapletPrice ( ) const
overridevirtual

Definition at line 138 of file nonstandardinflationcouponpricer.cpp.

138 {
139 QL_REQUIRE(discount_ != Null<Real>(), "no nominal term structure provided");
140 return swapletRate() * coupon_->accrualPeriod() * discount_;
141}
+ Here is the call graph for this function:

◆ swapletRate()

Rate swapletRate ( ) const
overridevirtual

Definition at line 143 of file nonstandardinflationcouponpricer.cpp.

143 {
144 // This way we do not require the index to have
145 // a yield curve, i.e. we do not get the problem
146 // that a discounting-instrument-pricer is used
147 // with a different yield curve
148 return gearing_ * adjustedFixing() + spread_;
149}
virtual Rate adjustedFixing(Rate fixing=Null< Rate >()) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ capletPrice()

Real capletPrice ( Rate  effectiveCap) const
overridevirtual

Definition at line 65 of file nonstandardinflationcouponpricer.cpp.

65 {
66 Real capletPrice = optionletPrice(Option::Call, effectiveCap);
67 return gearing_ * capletPrice;
68}
virtual Real capletPrice(Rate effectiveCap) const override
virtual Real optionletPrice(Option::Type optionType, Real effStrike) const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ capletRate()

Rate capletRate ( Rate  effectiveCap) const
overridevirtual

Definition at line 74 of file nonstandardinflationcouponpricer.cpp.

74 {
75 return gearing_ * optionletRate(Option::Call, effectiveCap);
76}
virtual Real optionletRate(Option::Type optionType, Real effStrike) const
+ Here is the call graph for this function:

◆ floorletPrice()

Real floorletPrice ( Rate  effectiveFloor) const
overridevirtual

Definition at line 60 of file nonstandardinflationcouponpricer.cpp.

60 {
61 Real floorletPrice = optionletPrice(Option::Put, effectiveFloor);
62 return gearing_ * floorletPrice;
63}
virtual Real floorletPrice(Rate effectiveFloor) const override
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ floorletRate()

Rate floorletRate ( Rate  effectiveFloor) const
overridevirtual

Definition at line 70 of file nonstandardinflationcouponpricer.cpp.

70 {
71 return gearing_ * optionletRate(Option::Put, effectiveFloor);
72}
+ Here is the call graph for this function:

◆ initialize()

void initialize ( const InflationCoupon coupon)
overridevirtual

Definition at line 117 of file nonstandardinflationcouponpricer.cpp.

117 {
118 coupon_ = dynamic_cast<const NonStandardYoYInflationCoupon*>(&coupon);
119 QL_REQUIRE(coupon_, "year-on-year inflation coupon needed");
122 paymentDate_ = coupon_->date();
123
124 // past or future fixing is managed in YoYInflationIndex::fixing()
125 // use yield curve from index (which sets discount)
126
127 discount_ = 1.0;
128 if (paymentDate_ > nominalTermStructure_->referenceDate()) {
129 if (nominalTermStructure_.empty()) {
130 // allow to extract rates, but mark the discount as invalid for prices
131 discount_ = Null<Real>();
132 } else {
133 discount_ = nominalTermStructure_->discount(paymentDate_);
134 }
135 }
136}
Real gearing() const
index gearing, i.e. multiplicative coefficient for the index
Spread spread() const
spread paid over the fixing of the underlying index
+ Here is the call graph for this function:

◆ optionletPrice()

Real optionletPrice ( Option::Type  optionType,
Real  effStrike 
) const
protectedvirtual

Definition at line 82 of file nonstandardinflationcouponpricer.cpp.

82 {
83 QL_REQUIRE(discount_ != Null<Real>(), "no nominal term structure provided");
84 return optionletRate(optionType, effStrike) * coupon_->accrualPeriod() * discount_;
85}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ optionletRate()

Real optionletRate ( Option::Type  optionType,
Real  effStrike 
) const
protectedvirtual

Definition at line 87 of file nonstandardinflationcouponpricer.cpp.

87 {
89 if (fixingDate <= Settings::instance().evaluationDate()) {
90 // the amount is determined
91 Real a, b;
92 if (optionType == Option::Call) {
93 a = coupon_->indexFixing();
94 b = effStrike;
95 } else {
96 a = effStrike;
97 b = coupon_->indexFixing();
98 }
99 return std::max(a - b, 0.0);
100 } else {
101 // not yet determined, use Black/DD1/Bachelier/whatever from Impl
102 QL_REQUIRE(!capletVolatility().empty(), "missing optionlet volatility");
103 Real stdDev = std::sqrt(capletVolatility()->totalVariance(fixingDate, effStrike));
104 return optionletPriceImp(optionType, effStrike, adjustedFixing(), stdDev);
105 }
106}
virtual Handle< YoYOptionletVolatilitySurface > capletVolatility() const
virtual Real optionletPriceImp(Option::Type, Real strike, Real forward, Real stdDev) const
QuantLib::Date fixingDate(const QuantLib::Date &d, const QuantLib::Period obsLag, const QuantLib::Frequency freq, bool interpolated)
Definition: inflation.cpp:183
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ optionletPriceImp()

Real optionletPriceImp ( Option::Type  ,
Real  strike,
Real  forward,
Real  stdDev 
) const
protectedvirtual

Derived classes usually only need to implement this.

The name of the method is misleading. This actually returns the rate of the optionlet (so not discounted and not accrued).

Reimplemented in NonStandardBlackYoYInflationCouponPricer, NonStandardUnitDisplacedBlackYoYInflationCouponPricer, and NonStandardBachelierYoYInflationCouponPricer.

Definition at line 78 of file nonstandardinflationcouponpricer.cpp.

78 {
79 QL_FAIL("you must implement this to get a vol-dependent price");
80}
+ Here is the caller graph for this function:

◆ adjustedFixing()

Rate adjustedFixing ( Rate  fixing = Null<Rate>()) const
protectedvirtual

Definition at line 108 of file nonstandardinflationcouponpricer.cpp.

108 {
109
110 if (fixing == Null<Rate>())
111 fixing = coupon_->indexFixing();
112
113 // no adjustment
114 return fixing;
115}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ capletVol_

Handle<YoYOptionletVolatilitySurface> capletVol_
protected

data

Definition at line 83 of file nonstandardinflationcouponpricer.hpp.

◆ nominalTermStructure_

Handle<YieldTermStructure> nominalTermStructure_
protected

Definition at line 84 of file nonstandardinflationcouponpricer.hpp.

◆ coupon_

const NonStandardYoYInflationCoupon* coupon_
protected

Definition at line 85 of file nonstandardinflationcouponpricer.hpp.

◆ gearing_

Real gearing_
protected

Definition at line 86 of file nonstandardinflationcouponpricer.hpp.

◆ spread_

Spread spread_
protected

Definition at line 87 of file nonstandardinflationcouponpricer.hpp.

◆ discount_

Real discount_
protected

Definition at line 88 of file nonstandardinflationcouponpricer.hpp.