Skip to content

Commit 6918535

Browse files
pcaspersjenkins
authored andcommitted
QPR-12111 zero out rate after it is used to calculate forward rate
1 parent cdb321b commit 6918535

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

QuantExt/qle/models/lgmvectorised.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,13 +443,13 @@ RandomVariable LgmVectorised::averagedOnRate(const boost::shared_ptr<OvernightIn
443443
std::swap(cap, floor);
444444
}
445445

446-
if (nakedOption)
447-
rate = RandomVariable(x.size(), 0.0);
448-
449446
RandomVariable forwardRate = (rate - RandomVariable(x.size(), spread)) / RandomVariable(x.size(), gearing);
450447
RandomVariable floorletRate(x.size(), 0.0);
451448
RandomVariable capletRate(x.size(), 0.0);
452449

450+
if (nakedOption)
451+
rate = RandomVariable(x.size(), 0.0);
452+
453453
if (floor != Null<Real>()) {
454454
// ignore localCapFloor, treat as global
455455
RandomVariable effectiveStrike = RandomVariable(x.size(), (floor - spread) / gearing);
@@ -560,13 +560,13 @@ RandomVariable LgmVectorised::averagedBmaRate(const boost::shared_ptr<BMAIndex>&
560560
std::swap(cap, floor);
561561
}
562562

563-
if (nakedOption)
564-
avgBMA = RandomVariable(x.size(), 0.0);
565-
566563
RandomVariable forwardRate = (avgBMA - RandomVariable(x.size(), spread)) / RandomVariable(x.size(), gearing);
567564
RandomVariable floorletRate(x.size(), 0.0);
568565
RandomVariable capletRate(x.size(), 0.0);
569566

567+
if (nakedOption)
568+
avgBMA = RandomVariable(x.size(), 0.0);
569+
570570
if (floor != Null<Real>()) {
571571
// ignore localCapFloor, treat as global
572572
RandomVariable effectiveStrike = RandomVariable(x.size(), (floor - spread) / gearing);

0 commit comments

Comments
 (0)