|
16 | 16 | FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. |
17 | 17 | */ |
18 | 18 |
|
19 | | -#include <boost/make_shared.hpp> |
| 19 | +#include <ored/portfolio/builders/fxeuropeanbarrieroption.hpp> |
20 | 20 | #include <ored/portfolio/builders/fxdigitaloption.hpp> |
21 | 21 | #include <ored/portfolio/builders/fxoption.hpp> |
22 | 22 | #include <ored/portfolio/enginefactory.hpp> |
@@ -63,6 +63,23 @@ void FxEuropeanBarrierOption::build(const QuantLib::ext::shared_ptr<EngineFactor |
63 | 63 | Real rebate = barrier_.rebate(); |
64 | 64 | QL_REQUIRE(rebate >= 0, "Rebate must be non-negative"); |
65 | 65 |
|
| 66 | + auto fxEuropeanBarrierOptionBuilder = |
| 67 | + QuantLib::ext::dynamic_pointer_cast<FxEuropeanBarrierOptionEngineBuilder>(engineFactory->builder(tradeType_)); |
| 68 | + if (fxEuropeanBarrierOptionBuilder) { |
| 69 | + // We have a delegating builder for this trade |
| 70 | + auto delegatingBuilderTrade_ = fxEuropeanBarrierOptionBuilder->build(this, engineFactory); |
| 71 | + instrument_ = delegatingBuilderTrade_->instrument(); |
| 72 | + maturity_ = delegatingBuilderTrade_->maturity(); |
| 73 | + npvCurrency_ = delegatingBuilderTrade_->npvCurrency(); |
| 74 | + additionalData_ = delegatingBuilderTrade_->additionalData(); |
| 75 | + requiredFixings_ = delegatingBuilderTrade_->requiredFixings(); |
| 76 | + setSensitivityTemplate(delegatingBuilderTrade_->sensitivityTemplate()); |
| 77 | + addProductModelEngine(delegatingBuilderTrade_->productModelEngine()); |
| 78 | + |
| 79 | + // notional and notional currency are defined in overriden methods! |
| 80 | + |
| 81 | + return; |
| 82 | + } |
66 | 83 | // Replicate the payoff of European Barrier Option (with strike K and barrier B) using combinations of options |
67 | 84 |
|
68 | 85 | // Call |
@@ -418,5 +435,14 @@ XMLNode* FxEuropeanBarrierOption::toXML(XMLDocument& doc) const { |
418 | 435 | Real FxEuropeanBarrierOption::strike() const { |
419 | 436 | return soldAmount_ / boughtAmount_; |
420 | 437 | } |
| 438 | + |
| 439 | +QuantLib::Real FxEuropeanBarrierOption::notional() const { |
| 440 | + return delegatingBuilderTrade_ != nullptr ? delegatingBuilderTrade_->notional() : Trade::notional(); |
| 441 | +} |
| 442 | + |
| 443 | +string FxEuropeanBarrierOption::notionalCurrency() const { |
| 444 | + return delegatingBuilderTrade_ != nullptr ? delegatingBuilderTrade_->notionalCurrency() : Trade::notionalCurrency(); |
| 445 | +} |
| 446 | + |
421 | 447 | } // namespace data |
422 | 448 | } // namespace ore |
0 commit comments