54 "BachelierCapFloorEngine should only be used for vol "
55 "surfaces stripped with normal model. Options were stripped "
57 <<
vol_->volatilityType());
66 std::vector<Real> values(optionlets, 0.0);
67 std::vector<Real> deltas(optionlets, 0.0);
68 std::vector<Real> vegas(optionlets, 0.0);
69 std::vector<Real> stdDevs(optionlets, 0.0);
70 std::vector<DiscountFactor> discountFactors(optionlets, 0.0);
75 for (
Size i=0; i<optionlets; ++i) {
80 if (paymentDate > settlement) {
82 discountFactors[i] =
d;
86 Real discountedAccrual =
d * accrualFactor;
92 if (fixingDate > today)
93 sqrtTime = std::sqrt(
vol_->timeFromReference(fixingDate));
98 stdDevs[i] = std::sqrt(
vol_->blackVariance(fixingDate,
101 forward, stdDevs[i], discountedAccrual) * sqrtTime;
103 strike, forward, stdDevs[i]);
107 strike, forward, stdDevs[i], discountedAccrual);
111 Real floorletVega = 0.0;
112 Real floorletDelta = 0.0;
114 stdDevs[i] = std::sqrt(
vol_->blackVariance(fixingDate,
117 forward, stdDevs[i], discountedAccrual) * sqrtTime;
123 strike, forward, stdDevs[i], discountedAccrual);
125 values[i] = floorlet;
126 vegas[i] = floorletVega;
127 deltas[i] = floorletDelta;
130 values[i] -= floorlet;
131 vegas[i] -= floorletVega;
132 deltas[i] -= floorletDelta;
Bachelier-Black-formula cap/floor engine.
const YieldTermStructure & discountCurve_
ext::shared_ptr< SimpleQuote > vol_
Handle< YieldTermStructure > discountCurve_
BachelierCapFloorEngine(Handle< YieldTermStructure > discountCurve, Volatility vol, const DayCounter &dc=Actual365Fixed())
void calculate() const override
Handle< OptionletVolatilityStructure > vol_
std::vector< Time > accrualTimes
std::vector< Rate > forwards
std::vector< Date > startDates
std::vector< Real > gearings
std::vector< Rate > floorRates
std::vector< Real > nominals
std::vector< Date > endDates
std::vector< Rate > capRates
std::vector< Date > fixingDates
Constant caplet volatility, no time-strike dependence.
CapFloor::results results_
CapFloor::arguments arguments_
Shared handle to an observable.
std::map< std::string, ext::any > additionalResults
Calendar for reproducing theoretical calculations.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
Optionlet (caplet/floorlet) volatility structure.
Constant caplet/floorlet volatility.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
Real Volatility
volatility
QL_INTEGER Integer
integer number
std::size_t Size
size of a container
Real bachelierBlackFormulaAssetItmProbability(Option::Type optionType, Real strike, Real forward, Real stdDev)
Real bachelierBlackFormulaStdDevDerivative(Rate strike, Rate forward, Real stdDev, Real discount)
Real bachelierBlackFormula(Option::Type optionType, Real strike, Real forward, Real stdDev, Real discount)
Calendar for reproducing theoretical calculations.
ext::shared_ptr< BlackVolTermStructure > v
StrippedOptionlet Adapter.
Interest-rate term structure.