135 {
137 "term structure handle");
138
139
143 settlementDate = referenceDate;
144 } else {
145 QL_REQUIRE(settlementDate >= referenceDate, "settlement date (" << settlementDate
146 << ") before "
147 "discount curve reference date ("
148 << referenceDate << ")");
149 }
150
151
153 results_.errorEstimate = Null<Real>();
156 results_.valuationDate = referenceDate;
157 } else {
159 << ") before "
160 "discount curve reference date ("
161 << referenceDate << ")");
162 }
163
164
168 results_.startDiscounts.resize(numLegs);
169 results_.endDiscounts.resize(numLegs);
171
172 bool includeRefDateFlows =
174
175 const Spread bp = 1.0e-4;
176
177 for (Size i = 0; i < numLegs; i++) {
178
182
183
184 impl_->amountGetter_->setCallAmount(
true);
185
186 for (Size j = 0; j < leg.size(); j++) {
187
188
189
190 if (leg[j]->hasOccurred(settlementDate, includeRefDateFlows)) {
191 continue;
192 }
193
194 DiscountFactor discount =
discountCurve_->discount(leg[j]->date());
195 leg[j]->accept(*(
impl_->amountGetter_));
196 results_.legNPV[i] +=
impl_->amountGetter_->amount() * discount;
197 results_.legBPS[i] +=
impl_->amountGetter_->bpsFactor() * discount;
198
199
200
201 if (j == 1)
202 impl_->amountGetter_->setCallAmount(
false);
203 }
204
210 }
211}
const Instrument::results * results_
Swap::arguments * arguments_