@@ -970,7 +970,9 @@ void ScriptedTradeEngineBuilder::setupBlackScholesProcesses() {
970970 auto spot = Handle<Quote>(QuantLib::ext::make_shared<DerivedPriceQuote>(
971971 market_->commodityPriceCurve (name, configuration (MarketContext::pricing))));
972972 auto priceCurve = market_->commodityPriceCurve (name, configuration (MarketContext::pricing));
973- auto fc = market_->discountCurve (modelIndicesCurrencies_[i], configuration (MarketContext::pricing));
973+ auto fc = modelIndicesCurrencies_[i] == baseCcy_
974+ ? modelCurves_.front ()
975+ : market_->discountCurve (modelIndicesCurrencies_[i], configuration (MarketContext::pricing));
974976 auto div = Handle<YieldTermStructure>(QuantLib::ext::make_shared<PriceTermStructureAdapter>(*priceCurve, *fc));
975977 div->enableExtrapolation ();
976978 if (!zeroVolatility_)
@@ -981,8 +983,10 @@ void ScriptedTradeEngineBuilder::setupBlackScholesProcesses() {
981983 std::string targetCcy = ind.fx ()->targetCurrency ().code ();
982984 std::string sourceCcy = ind.fx ()->sourceCurrency ().code ();
983985 auto spot = market_->fxSpot (sourceCcy + targetCcy, configuration (MarketContext::pricing));
984- auto div = market_->discountCurve (sourceCcy, configuration (MarketContext::pricing));
985- auto fc = market_->discountCurve (targetCcy, configuration (MarketContext::pricing));
986+ auto div = sourceCcy == baseCcy_ ? modelCurves_.front ()
987+ : market_->discountCurve (sourceCcy, configuration (MarketContext::pricing));
988+ auto fc = targetCcy == baseCcy_ ? modelCurves_.front ()
989+ : market_->discountCurve (targetCcy, configuration (MarketContext::pricing));
986990 if (!zeroVolatility_)
987991 vol = market_->fxVol (sourceCcy + targetCcy, configuration (MarketContext::pricing));
988992 processes_.push_back (QuantLib::ext::make_shared<GeneralizedBlackScholesProcess>(spot, div, fc, vol));
0 commit comments