Skip to content

Commit 4fb1058

Browse files
pcaspersjenkins
authored andcommitted
QPR-12192 init members, populate eff vol in local optionlet pricing
1 parent 0cb024d commit 4fb1058

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

QuantExt/qle/cashflows/averageonindexedcoupon.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ class CapFlooredAverageONIndexedCouponPricer : public FloatingRateCouponPricer {
169169
protected:
170170
Handle<OptionletVolatilityStructure> capletVol_;
171171
bool effectiveVolatilityInput_;
172-
mutable Real effectiveCapletVolatility_;
173-
mutable Real effectiveFloorletVolatility_;
172+
mutable Real effectiveCapletVolatility_ = Null<Real>();
173+
mutable Real effectiveFloorletVolatility_ = Null<Real>();
174174
};
175175

176176
//! helper class building a sequence of overnight coupons

QuantExt/qle/cashflows/blackovernightindexedcouponpricer.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ Real BlackOvernightIndexedCouponPricer::optionletRateLocal(Option::Type optionTy
203203
bool shiftedLn = capletVolatility()->volatilityType() == ShiftedLognormal;
204204
Rate cfValue = shiftedLn ? blackFormula(optionType, effStrike, averageRate, stdDev, 1.0, shift)
205205
: bachelierBlackFormula(optionType, effStrike, averageRate, stdDev, 1.0);
206+
Real effectiveTime = capletVolatility()->timeFromReference(fixingDates.back());
207+
if (optionType == Option::Type::Call)
208+
effectiveCapletVolatility_ = stdDev / std::sqrt(effectiveTime);
209+
else
210+
effectiveFloorletVolatility_ = stdDev / std::sqrt(effectiveTime);
206211

207212
// add spread to average rate
208213
if (coupon_->underlying()->includeSpread()) {
@@ -435,6 +440,12 @@ Real BlackAverageONIndexedCouponPricer::optionletRateLocal(Option::Type optionTy
435440
Rate cfValue = shiftedLn ? blackFormula(optionType, effStrike, averageRate, stdDev, 1.0, shift)
436441
: bachelierBlackFormula(optionType, effStrike, averageRate, stdDev, 1.0);
437442

443+
Real effectiveTime = capletVolatility()->timeFromReference(fixingDates.back());
444+
if (optionType == Option::Type::Call)
445+
effectiveCapletVolatility_ = stdDev / std::sqrt(effectiveTime);
446+
else
447+
effectiveFloorletVolatility_ = stdDev / std::sqrt(effectiveTime);
448+
438449
// add spread to average rate
439450
if (coupon_->includeSpread()) {
440451
averageRate += coupon_->underlying()->spread();

QuantExt/qle/cashflows/overnightindexedcoupon.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ class CappedFlooredOvernightIndexedCouponPricer : public FloatingRateCouponPrice
221221
protected:
222222
Handle<OptionletVolatilityStructure> capletVol_;
223223
bool effectiveVolatilityInput_;
224-
mutable Real effectiveCapletVolatility_;
225-
mutable Real effectiveFloorletVolatility_;
224+
mutable Real effectiveCapletVolatility_ = Null<Real>();
225+
mutable Real effectiveFloorletVolatility_ = Null<Real>();
226226
};
227227

228228
//! helper class building a sequence of overnight coupons

0 commit comments

Comments
 (0)