29 QL_REQUIRE(spread == 0.0,
"Non zero spreads (" << spread <<
") are not allowed.");
32 std::vector<Real> values(optionlets, 0.0);
33 std::vector<Real> forwards(optionlets, 0.0);
36 Date settlement =
model_->termStructure()->referenceDate();
43 for (
Size i = 0; i < optionlets; ++i) {
47 ext::shared_ptr<IborIndex> iborIndex =
48 ext::dynamic_pointer_cast<IborIndex>(
arguments_.indexes[i]);
52 if (paymentDate > settlement) {
57 model_->termStructure()->timeFromReference(fixingDate);
63 if (fixingDate <= settlement) {
65 std::max(
arguments_.forwards[i] - strike, 0.0) *
f *
71 for (
Size j = 0; j < z.
size(); j++) {
73 if (iborIndex !=
nullptr)
76 model_->forwardRate(fixingDate, fixingDate,
78 model_->zerobond(paymentDate, fixingDate,
82 (
model_->zerobond(valueDate, fixingDate,
84 model_->zerobond(paymentDate, fixingDate,
89 model_->zerobond(paymentDate, fixingDate, z[j]);
91 std::max((floatingLegNpv - fixedLegNpv), 0.0) /
92 model_->numeraire(fixingTime, z[j],
101 for (
Size j = 0; j < z.
size() - 1; j++) {
103 0.0,
payoff.cCoefficients()[j],
104 payoff.bCoefficients()[j],
105 payoff.aCoefficients()[j], p[j], z[j], z[j],
112 0.0, 0.0, 0.0, 0.0, p[z.
size() - 2],
117 0.0, 0.0, 0.0, 0.0, p[0], z[0], -100.0,
127 z[z.
size() - 1], 100.0);
138 if (fixingDate <= settlement) {
140 std::max(-(
arguments_.forwards[i] - strike), 0.0) *
143 for (
Size j = 0; j < z.
size(); j++) {
145 if (iborIndex !=
nullptr)
148 model_->forwardRate(fixingDate, fixingDate,
150 model_->zerobond(paymentDate, fixingDate,
154 (
model_->zerobond(valueDate, fixingDate,
156 model_->zerobond(paymentDate, fixingDate,
161 model_->zerobond(paymentDate, fixingDate, z[j]);
163 std::max(-(floatingLegNpv - fixedLegNpv), 0.0) /
164 model_->numeraire(fixingTime, z[j],
173 for (
Size j = 0; j < z.
size() - 1; j++) {
175 0.0,
payoff.cCoefficients()[j],
176 payoff.bCoefficients()[j],
177 payoff.aCoefficients()[j], p[j], z[j], z[j],
184 0.0, 0.0, 0.0, 0.0, p[z.
size() - 2],
189 0.0, 0.0, 0.0, 0.0, p[0], z[0], -100.0,
194 0.0,
payoff.cCoefficients()[0],
195 payoff.bCoefficients()[0],
196 payoff.aCoefficients()[0], p[0], z[0],
205 values[i] = floorlet;
208 values[i] -= floorlet;
218 results_.additionalResults[
"optionletsPrice"] = values;
219 results_.additionalResults[
"optionletsAtmForward"] = forwards;
1-D array used in linear algebra.
const_iterator end() const
Size size() const
dimension of the array
const_iterator begin() const
Cubic interpolation between discrete points.
const bool extrapolatePayoff_
const Handle< YieldTermStructure > discountCurve_
const bool flatPayoffExtrapolation_
void calculate() const override
const int integrationPoints_
static Real gaussianShiftedPolynomialIntegral(Real a, Real b, Real c, Real d, Real e, Real h, Real x0, Real x1)
Handle< Gaussian1dModel > model_
cubic interpolation between discrete points
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container
ext::shared_ptr< QuantLib::Payoff > payoff