19#include <ql/exercise.hpp>
29 QuantLib::AnalyticDoubleBarrierBinaryEngine::calculate();
34 Rate expiryDateDiscount =
process_->riskFreeRate()->discount(
arguments_.exercise->lastDate());
35 Rate factor = payDateDiscount / expiryDateDiscount;
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);
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);
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);
Wrapper of QuantLib analytic double barrier binary engine to allow for flipping back some of the addi...
const Instrument::results * results_
void calculate() const override
ext::shared_ptr< GeneralizedBlackScholesProcess > process_
Swap::arguments * arguments_