27 {
28
29 QuantLib::AnalyticDoubleBarrierBinaryEngine::calculate();
30
31
34 Rate expiryDateDiscount =
process_->riskFreeRate()->discount(
arguments_.exercise->lastDate());
35 Rate factor = payDateDiscount / expiryDateDiscount;
37 }
38
40
41 auto it =
results_.additionalResults.find(
"spot");
42 if (it !=
results_.additionalResults.end())
43 it->second = 1. / boost::any_cast<Real>(it->second);
44 it =
results_.additionalResults.find(
"costOfCarry");
45 if (it !=
results_.additionalResults.end())
46 it->second = -1. * boost::any_cast<Real>(it->second);
47
48
49 auto rfDiscountIt =
results_.additionalResults.find(
"riskFreeRate");
50 auto divDiscountIt =
results_.additionalResults.find(
"dividendYield");
51 if (rfDiscountIt !=
results_.additionalResults.end() && divDiscountIt !=
results_.additionalResults.end())
52 std::swap(rfDiscountIt->second, divDiscountIt->second);
53
54
55 auto barrierLowIt =
results_.additionalResults.find(
"barrierLow");
56 auto barrierHighIt =
results_.additionalResults.find(
"barrierHigh");
57 if (barrierLowIt !=
results_.additionalResults.end() && barrierHighIt !=
results_.additionalResults.end()) {
58 barrierLowIt->second = 1. / boost::any_cast<Real>(barrierLowIt->second);
59 barrierHighIt->second = 1. / boost::any_cast<Real>(barrierHighIt->second);
60 std::swap(barrierLowIt->second, barrierHighIt->second);
61 }
62 }
63}
const Instrument::results * results_
Swap::arguments * arguments_