@@ -45,13 +45,14 @@ std::pair<std::string, std::string> splitPair(const std::string& pair) {
4545 return std::make_pair (pair.substr (0 , 3 ), pair.substr (3 ));
4646}
4747
48- Handle<YieldTermStructure> getMarketDiscountCurve (const Market* market, const std::string& ccy) {
48+ Handle<YieldTermStructure> getMarketDiscountCurve (const Market* market, const std::string& ccy,
49+ const std::string& configuration) {
4950 try {
50- return market->discountCurve (ccy);
51+ return market->discountCurve (ccy, configuration );
5152 } catch (const std::exception&) {
5253 WLOG (" FXTriangulation: could not get market discount curve '"
53- << ccy
54- << " ' - discounted fx spot rates will be replaced by non-discounted rates in future calculations, which "
54+ << ccy << " ' (requested for configuration ' " << configuration
55+ << " ') - discounted fx spot rates will be replaced by non-discounted rates in future calculations, which "
5556 " might lead to inaccuracies" );
5657 return Handle<YieldTermStructure>();
5758 }
@@ -164,11 +165,12 @@ Handle<Quote> FXTriangulation::getQuote(const std::string& pair) const {
164165 return result;
165166}
166167
167- Handle<FxIndex> FXTriangulation::getIndex (const std::string& indexOrPair, const Market* market) const {
168+ Handle<FxIndex> FXTriangulation::getIndex (const std::string& indexOrPair, const Market* market,
169+ const std::string& configuration) const {
168170
169171 // do we have a cached result?
170172
171- if (auto it = indexCache_.find (indexOrPair); it != indexCache_.end ()) {
173+ if (auto it = indexCache_.find (std::make_pair ( indexOrPair, configuration) ); it != indexCache_.end ()) {
172174 return it->second ;
173175 }
174176
@@ -196,8 +198,8 @@ Handle<FxIndex> FXTriangulation::getIndex(const std::string& indexOrPair, const
196198
197199 // get the discount curves for the result index
198200
199- auto sourceYts = getMarketDiscountCurve (market, forCcy);
200- auto targetYts = getMarketDiscountCurve (market, domCcy);
201+ auto sourceYts = getMarketDiscountCurve (market, forCcy, configuration );
202+ auto targetYts = getMarketDiscountCurve (market, domCcy, configuration );
201203
202204 // get the path from ccy1 to ccy2
203205
@@ -227,8 +229,8 @@ Handle<FxIndex> FXTriangulation::getIndex(const std::string& indexOrPair, const
227229 // we store a quote "as of today" to account for possible spot lag differences
228230
229231 auto [fd, fc, bdc] = getFxIndexConventions (path[i] + path[i + 1 ]);
230- auto s_yts = getMarketDiscountCurve (market, path[i]);
231- auto t_yts = getMarketDiscountCurve (market, path[i + 1 ]);
232+ auto s_yts = getMarketDiscountCurve (market, path[i], configuration );
233+ auto t_yts = getMarketDiscountCurve (market, path[i + 1 ], configuration );
232234 quotes.push_back (Handle<Quote>(boost::make_shared<FxRateQuote>(q, s_yts, t_yts, fd, fc)));
233235 }
234236
@@ -253,7 +255,7 @@ Handle<FxIndex> FXTriangulation::getIndex(const std::string& indexOrPair, const
253255
254256 // add the result to the lookup cache and return it
255257
256- indexCache_[indexOrPair] = result;
258+ indexCache_[std::make_pair ( indexOrPair, configuration) ] = result;
257259 return result;
258260}
259261
0 commit comments