Skip to content

Commit 86a41bc

Browse files
pcaspersjenkins
authored andcommitted
QPR-12139 use inverted fx index is notionals are swapped
1 parent 3954cb6 commit 86a41bc

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

OREAnalytics/orea/engine/parsensitivityanalysis.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#include <ql/pricingengines/capfloor/blackcapfloorengine.hpp>
6464
#include <ql/pricingengines/credit/midpointcdsengine.hpp>
6565
#include <ql/pricingengines/swap/discountingswapengine.hpp>
66+
#include <ql/quotes/derivedquote.hpp>
6667
#include <ql/termstructures/yield/flatforward.hpp>
6768
#include <ql/termstructures/yield/oisratehelper.hpp>
6869
#include <qle/instruments/fixedbmaswap.hpp>
@@ -1701,6 +1702,10 @@ ParSensitivityAnalysis::makeCrossCcyBasisSwap(const boost::shared_ptr<Market>& m
17011702
boost::shared_ptr<FxIndex> fxIndex =
17021703
boost::make_shared<FxIndex>("dummy", conv->settlementDays(), currency, baseCurrency, conv->settlementCalendar(),
17031704
fxSpot, discountCurve, baseDiscountCurve);
1705+
auto m = [](Real x) { return 1.0 / x; };
1706+
boost::shared_ptr<FxIndex> reversedFxIndex = boost::make_shared<FxIndex>(
1707+
"dummyRev", conv->settlementDays(), baseCurrency, currency, conv->settlementCalendar(),
1708+
Handle<Quote>(boost::make_shared<DerivedQuote<decltype(m)>>(fxSpot, m)), baseDiscountCurve, discountCurve);
17041709

17051710
// LOG("Make Cross Ccy Swap for base ccy " << baseCcy << " currency " << ccy);
17061711
// Set up first leg as spread leg, second as flat leg
@@ -1714,7 +1719,7 @@ ParSensitivityAnalysis::makeCrossCcyBasisSwap(const boost::shared_ptr<Market>& m
17141719
DLOG("create resettable xccy par instrument (1), convention " << conv->id());
17151720
helper = boost::make_shared<CrossCcyBasisMtMResetSwap>(
17161721
baseNotional, baseCurrency, baseSchedule, *baseIndex, 0.0, // spread index leg => use fairForeignSpread
1717-
currency, schedule, *index, 0.0, fxIndex, true, // resettable flat index leg
1722+
currency, schedule, *index, 0.0, reversedFxIndex, true, // resettable flat index leg
17181723
conv->paymentLag(), conv->flatPaymentLag(),
17191724
conv->includeSpread(), conv->lookback(), conv->fixingDays(), conv->rateCutoff(), conv->isAveraged(),
17201725
conv->flatIncludeSpread(), conv->flatLookback(), conv->flatFixingDays(), conv->flatRateCutoff(), conv->flatIsAveraged(),
@@ -1758,7 +1763,7 @@ ParSensitivityAnalysis::makeCrossCcyBasisSwap(const boost::shared_ptr<Market>& m
17581763
// second leg is resettable, so the second leg is the non-base non-flat spread leg
17591764
helper = boost::make_shared<CrossCcyBasisMtMResetSwap>(
17601765
baseNotional, baseCurrency, baseSchedule, *baseIndex, 0.0, // flat index leg
1761-
currency, schedule, *index, 0.0, fxIndex, true, // resettable spread index leg => use fairDomesticSpread
1766+
currency, schedule, *index, 0.0, reversedFxIndex, true, // resettable spread index leg => use fairDomesticSpread
17621767
conv->flatPaymentLag(), conv->paymentLag(),
17631768
conv->flatIncludeSpread(), conv->flatLookback(), conv->flatFixingDays(), conv->flatRateCutoff(), conv->flatIsAveraged(),
17641769
conv->includeSpread(), conv->lookback(), conv->fixingDays(), conv->rateCutoff(), conv->isAveraged(),

0 commit comments

Comments
 (0)