Skip to content

Commit 04059e4

Browse files
committed
QPR-13251 add results to swaption helper
1 parent 60b74ea commit 04059e4

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

ql/models/shortrate/calibrationhelpers/swaptionhelper.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ namespace QuantLib {
146146
}
147147
swaption_->setPricingEngine(engine);
148148
Real value = swaption_->NPV();
149+
150+
timeToExpiry_ = swaption_->result<Real>("timeToExpiry");
151+
swapLength_ = swaption_->result<Real>("swapLength");
152+
atmForward_ = swaption_->result<Real>("atmForward");
153+
annuity_ = swaption_->result<Real>("annuity");
154+
vega_ = swaption_->result<Real>("vega");
155+
stdDev_ = swaption_->result<Real>("stdDev");
156+
149157
swaption_->setPricingEngine(engine_);
150158
return value;
151159
}

ql/models/shortrate/calibrationhelpers/swaptionhelper.hpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ namespace QuantLib {
9393
Real modelValue() const override;
9494
Real blackPrice(Volatility volatility) const override;
9595

96+
// populated in call to blackPrice():
97+
Real timeToExpiry() const { return timeToExpiry_; }
98+
Real swapLength() const { return swapLength_; }
99+
Real strike() const { return strike_; }
100+
Real atmForward() const { return atmForward_; }
101+
Real annuity() const { return annuity_; };
102+
Real vega() const { return vega_; }
103+
Real stdDev() const { return stdDev_; }
104+
96105
const ext::shared_ptr<FixedVsFloatingSwap>& underlying() const {
97106
calculate();
98107
return swap_;
@@ -126,8 +135,13 @@ namespace QuantLib {
126135
mutable Rate exerciseRate_;
127136
mutable ext::shared_ptr<FixedVsFloatingSwap> swap_;
128137
mutable ext::shared_ptr<Swaption> swaption_;
138+
mutable Real timeToExpiry_ = Null<Real>();
139+
mutable Real swapLength_ = Null<Real>();
140+
mutable Real atmForward_ = Null<Real>();
141+
mutable Real annuity_ = Null<Real>();
142+
mutable Real vega_ = Null<Real>();
143+
mutable Real stdDev_ = Null<Real>();
129144
};
130-
131145
}
132146

133147
#endif

0 commit comments

Comments
 (0)