19#include <ql/exercise.hpp>
32 QuantLib::AnalyticDigitalAmericanEngine::calculate();
37 Rate expiryDateDiscount =
process_->riskFreeRate()->discount(
arguments_.exercise->lastDate());
38 Rate factor = payDateDiscount / expiryDateDiscount;
41 auto discTouchProbIt =
results_.additionalResults.find(
"discountedTouchProbability");
42 if (discTouchProbIt !=
results_.additionalResults.end()) {
44 discTouchProbIt->second = boost::any_cast<Real>(discTouchProbIt->second) * factor;
46 discTouchProbIt->second = 1.0 - (factor * (1.0 - boost::any_cast<Real>(discTouchProbIt->second)));
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);
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);
Wrapper of QuantLib analytic digital American option engine to allow for flipping back some of the ad...
const Instrument::results * results_
void calculate() const override
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
virtual bool knock_in() const override
Swap::arguments * arguments_