|
36 | 36 | #include <qle/termstructures/pricecurve.hpp> |
37 | 37 | #include <qle/termstructures/zeroinflationcurveobservermoving.hpp> |
38 | 38 | #include <qle/termstructures/yoyinflationcurveobservermoving.hpp> |
| 39 | +#include <qle/termstructures/proxyoptionletvolatility.hpp> |
39 | 40 |
|
40 | 41 | #include <ql/currencies/europe.hpp> |
41 | 42 | #include <ql/indexes/ibor/eonia.hpp> |
@@ -407,17 +408,29 @@ Handle<OptionletVolatilityStructure> DependencyMarket::capFloorVol(const string& |
407 | 408 | addMarketObject(MarketObject::CapFloorVol, name, config); |
408 | 409 | // ensure that the dependent ibor indiex is captured |
409 | 410 | iborIndex(capFloorVolIndexBase(name, config).first, config); |
410 | | - return flatRateCvs(); |
| 411 | + Handle<OptionletVolatilityStructure> handleflatRateCvs = flatRateCvs(); |
| 412 | + if (curveConfigs_ && curveConfigs_->hasCapFloorVolCurveConfig(name)) { |
| 413 | + auto cc = curveConfigs_->capFloorVolCurveConfig(name); |
| 414 | + if (!cc->proxyTargetIndex().empty()){ |
| 415 | + QuantLib::ext::shared_ptr<ProxyOptionletVolatility> capletVol = QuantLib::ext::make_shared<ProxyOptionletVolatility>(handleflatRateCvs, parseIborIndex(cc->proxySourceIndex()), |
| 416 | + parseIborIndex(cc->proxyTargetIndex()), cc->proxySourceRateComputationPeriod(), |
| 417 | + cc->proxyTargetRateComputationPeriod(), cc->proxyScalingFactor()); |
| 418 | + return Handle<OptionletVolatilityStructure>(capletVol); |
| 419 | + } |
| 420 | + } |
| 421 | + return handleflatRateCvs; |
411 | 422 | } |
412 | 423 |
|
413 | 424 | std::pair<string, QuantLib::Period> DependencyMarket::capFloorVolIndexBase(const string& name, |
414 | 425 | const string& config) const { |
415 | 426 | if (curveConfigs_ && curveConfigs_->hasCapFloorVolCurveConfig(name)) { |
416 | 427 | auto cc = curveConfigs_->capFloorVolCurveConfig(name); |
417 | | - if (!cc->proxyTargetIndex().empty()) |
| 428 | + if (!cc->proxyTargetIndex().empty()){ |
418 | 429 | return std::make_pair(cc->proxyTargetIndex(), cc->proxyTargetRateComputationPeriod()); |
419 | | - else |
| 430 | + } |
| 431 | + else{ |
420 | 432 | return std::make_pair(cc->index(), cc->rateComputationPeriod()); |
| 433 | + } |
421 | 434 | } |
422 | 435 | QuantLib::ext::shared_ptr<IborIndex> index; |
423 | 436 | if (tryParseIborIndex(name, index)) { |
|
0 commit comments