40 displacement_(displacement) {
51 displacement_(displacement) {
62 "BlackCapFloorEngine should only be used for vol surfaces stripped "
63 "with shifted log normal model. Options were stripped with model "
64 <<
vol_->volatilityType());
68 "Displacement used for stripping and provided for "
69 "pricing differ. Model displacement was : "
70 <<
vol_->displacement());
81 std::vector<Real> values(optionlets, 0.0);
82 std::vector<Real> deltas(optionlets, 0.0);
83 std::vector<Real> vegas(optionlets, 0.0);
84 std::vector<Real> stdDevs(optionlets, 0.0);
85 std::vector<DiscountFactor> discountFactors(optionlets, 0.0);
90 for (
Size i=0; i<optionlets; ++i) {
95 if (paymentDate > settlement) {
97 discountFactors[i] =
d;
101 Real discountedAccrual =
d * accrualFactor;
106 if (fixingDate > today)
107 sqrtTime = std::sqrt(
vol_->timeFromReference(fixingDate));
112 stdDevs[i] = std::sqrt(
vol_->blackVariance(fixingDate,
122 strike, forward, stdDevs[i], discountedAccrual,
127 Real floorletVega = 0.0;
128 Real floorletDelta = 0.0;
130 stdDevs[i] = std::sqrt(
vol_->blackVariance(fixingDate,
140 strike, forward, stdDevs[i], discountedAccrual,
displacement_);
142 values[i] = floorlet;
143 vegas[i] = floorletVega;
144 deltas[i] = floorletDelta;
147 values[i] -= floorlet;
148 vegas[i] -= floorletVega;
149 deltas[i] -= floorletDelta;
Black-formula cap/floor engine.
const YieldTermStructure & discountCurve_
ext::shared_ptr< SimpleQuote > vol_
Handle< YieldTermStructure > discountCurve_
Real displacement() const
void calculate() const override
BlackCapFloorEngine(Handle< YieldTermStructure > discountCurve, Volatility vol, const DayCounter &dc=Actual365Fixed(), Real displacement=0.0)
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.
template class providing a null value for a given type.
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 blackFormulaAssetItmProbability(Option::Type optionType, Real strike, Real forward, Real stdDev, Real displacement)
Real blackFormula(Option::Type optionType, Real strike, Real forward, Real stdDev, Real discount, Real displacement)
Real blackFormulaStdDevDerivative(Rate strike, Rate forward, Real stdDev, Real discount, Real displacement)
Calendar for reproducing theoretical calculations.
ext::shared_ptr< BlackVolTermStructure > v
Interest-rate term structure.