30 {
31
32 QuantLib::AnalyticDigitalAmericanEngine::calculate();
33
34
37 Rate expiryDateDiscount =
process_->riskFreeRate()->discount(
arguments_.exercise->lastDate());
38 Rate factor = payDateDiscount / expiryDateDiscount;
40
41 auto discTouchProbIt =
results_.additionalResults.find(
"discountedTouchProbability");
42 if (discTouchProbIt !=
results_.additionalResults.end()) {
44 discTouchProbIt->second = boost::any_cast<Real>(discTouchProbIt->second) * factor;
45 else
46 discTouchProbIt->second = 1.0 - (factor * (1.0 - boost::any_cast<Real>(discTouchProbIt->second)));
47 }
48 }
49
51
52 auto resToInvert = vector<string>({"spot", "forward", "strike"});
53 for (const string& res : resToInvert) {
54 auto it =
results_.additionalResults.find(res);
55 if (it !=
results_.additionalResults.end())
56 it->second = 1. / boost::any_cast<Real>(it->second);
57 }
58
59
60 auto rfDiscountIt =
results_.additionalResults.find(
"riskFreeDiscount");
61 auto divDiscountIt =
results_.additionalResults.find(
"dividendDiscount");
62 if (rfDiscountIt !=
results_.additionalResults.end() && divDiscountIt !=
results_.additionalResults.end())
63 std::swap(rfDiscountIt->second, divDiscountIt->second);
64 }
65}
const Instrument::results * results_
virtual bool knock_in() const override
Swap::arguments * arguments_