|
1 | 1 | /* |
2 | 2 | Copyright (C) 2016 Quaternion Risk Management Ltd |
| 3 | + Copyright (C) 2024 Skandinaviska Enskilda Banken AB (publ) |
3 | 4 | All rights reserved. |
4 | 5 |
|
5 | 6 | This file is part of ORE, a free-software/open-source library |
@@ -33,11 +34,11 @@ FXVolatilityCurveConfig::FXVolatilityCurveConfig(const string& curveID, const st |
33 | 34 | const string& fxForeignCurveID, const string& fxDomesticCurveID, |
34 | 35 | const DayCounter& dayCounter, const Calendar& calendar, |
35 | 36 | const SmileInterpolation& interp, const string& conventionsID, |
36 | | - const std::vector<Size>& smileDelta) |
| 37 | + const std::vector<Size>& smileDelta, const string& smileExtrapolation) |
37 | 38 | : CurveConfig(curveID, curveDescription), dimension_(dimension), expiries_(expiries), dayCounter_(dayCounter), |
38 | 39 | calendar_(calendar), fxSpotID_(fxSpotID), fxForeignYieldCurveID_(fxForeignCurveID), |
39 | 40 | fxDomesticYieldCurveID_(fxDomesticCurveID), conventionsID_(conventionsID), smileDelta_(smileDelta), |
40 | | - smileInterpolation_(interp) { |
| 41 | + smileInterpolation_(interp), smileExtrapolation_(smileExtrapolation) { |
41 | 42 | populateRequiredCurveIds(); |
42 | 43 | } |
43 | 44 |
|
@@ -134,14 +135,17 @@ void FXVolatilityCurveConfig::fromXML(XMLNode* node) { |
134 | 135 | smileDelta_ = parseListOfValues<Size>(sDelta, &parseInteger); |
135 | 136 | } else if (smileType == "Delta") { |
136 | 137 | dimension_ = Dimension::SmileDelta; |
137 | | - // only read smile interpolation method if dimension is smile. |
| 138 | + // only read smile interpolation and extrapolation method if dimension is smile. |
138 | 139 | if (smileInterp == "" || smileInterp == "Linear") { |
139 | 140 | smileInterpolation_ = SmileInterpolation::Linear; |
140 | 141 | } else if (smileInterp == "Cubic") { |
141 | 142 | smileInterpolation_ = SmileInterpolation::Cubic; |
142 | 143 | } else { |
143 | 144 | QL_FAIL("SmileInterpolation " << smileInterp << " not supported"); |
144 | 145 | } |
| 146 | + |
| 147 | + smileExtrapolation_ = XMLUtils::getChildValue(node, "SmileExtrapolation", false, "Flat"); |
| 148 | + |
145 | 149 | deltas_ = XMLUtils::getChildrenValuesAsStrings(node, "Deltas", true); |
146 | 150 |
|
147 | 151 | // check that these are valid deltas |
@@ -235,6 +239,8 @@ XMLNode* FXVolatilityCurveConfig::toXML(XMLDocument& doc) { |
235 | 239 | } else { |
236 | 240 | QL_FAIL("Unknown SmileInterpolation in FXVolatilityCurveConfig::toXML()"); |
237 | 241 | } |
| 242 | + if (!smileExtrapolation_.empty()) |
| 243 | + XMLUtils::addChild(doc, node, "SmileExtrapolation", smileExtrapolation_); |
238 | 244 | XMLUtils::addChild(doc, node, "Conventions", to_string(conventionsID_)); |
239 | 245 | XMLUtils::addGenericChildAsList(doc, node, "Deltas", deltas_); |
240 | 246 | } else if (dimension_ == Dimension::SmileBFRR) { |
|
0 commit comments