Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
af4d044
Added base CrossCcySwap, CrossCcySwapEngine and related tests
paolodelia99 Jun 13, 2025
48e48aa
Update generated headers
github-actions[bot] Jun 13, 2025
3732556
Update CrossCcySwap tests to account for usingAtParCoupons setting
paolodelia99 Jun 14, 2025
a880201
Added missing imports in crossccyswapengine.hpp
paolodelia99 Jun 16, 2025
5884906
Fix tag typo in QuantLib.vcxproj
paolodelia99 Jun 16, 2025
2d8185c
Refactor xccy tests file
paolodelia99 Jun 16, 2025
63f267f
Add crossccyfixfloatswap
paolodelia99 Jun 16, 2025
960ab15
Fixed typo in comments
paolodelia99 Jun 16, 2025
59df14c
add usingAtParCoupons, and fix code format in crossccyfixfloatswap.cpp
paolodelia99 Jun 17, 2025
9b62fab
Update generated headers
github-actions[bot] Jun 16, 2025
a65859e
Update copyright list in license
github-actions[bot] Jun 17, 2025
ecdda37
Add missing import in crossccyfixfloatswap tests
paolodelia99 Jun 17, 2025
cecf124
Added crossccybasisswap and related tests
paolodelia99 Jun 17, 2025
77e673f
Fix typo in crossccybasisswap filename in Makefile.am
paolodelia99 Jun 17, 2025
e35c609
Update generated headers
github-actions[bot] Jun 17, 2025
496d95d
Add constructor docstring in crossccybasisswap.hpp
paolodelia99 Jun 19, 2025
9c82a36
Add constructor docstring in crossccyfixfloatswap.hpp
paolodelia99 Jun 19, 2025
68c8353
Rename xccyswapengine constructor params
paolodelia99 Aug 1, 2025
1f1f4fa
Merge branch 'master' into feature/const-notional-xccy
paolodelia99 Dec 23, 2025
68e1dda
Adjusted code to new ON coupon alignment
paolodelia99 Dec 26, 2025
f5a7cf8
Fix doc string and add ONXccy test
paolodelia99 Dec 26, 2025
2edbcd3
Fix doc string and add ONXccy test
paolodelia99 Dec 26, 2025
d82c3c9
Update copyright list in license
lballabio-bot Dec 26, 2025
f3466f6
Update old license links
lballabio-bot Dec 26, 2025
c1e96da
using crossccyswap for impliedQuote calc in constnotionalxccyhelper, …
paolodelia99 Feb 7, 2026
b3f44c6
remove old code in xccyratehelper
paolodelia99 Feb 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ Copyright (C) 2015, 2016 Andres Hernandez
Copyright (C) 2016 Nicholas Bertocchi
Copyright (C) 2016 Stefano Fondi
Copyright (C) 2016, 2017 Fabrice Lecuyer
Copyright (C) 2016, 2018, 2020, 2022 Quaternion Risk Management Ltd
Copyright (C) 2016, 2019, 2020 Eisuke Tani
Copyright (C) 2016, 2020, 2022 Quaternion Risk Management Ltd

Copyright (C) 2017 BN Algorithms Ltd
Copyright (C) 2017 Joseph Jeisman
Expand Down
8 changes: 8 additions & 0 deletions QuantLib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,9 @@
<ClInclude Include="ql\instruments\cpicapfloor.hpp" />
<ClInclude Include="ql\instruments\cpiswap.hpp" />
<ClInclude Include="ql\instruments\creditdefaultswap.hpp" />
<ClInclude Include="ql\instruments\crossccybasisswap.hpp" />
<ClInclude Include="ql\instruments\crossccyfixfloatswap.hpp" />
<ClInclude Include="ql\instruments\crossccyswap.hpp" />
<ClInclude Include="ql\instruments\dividendschedule.hpp" />
<ClInclude Include="ql\instruments\doublebarrieroption.hpp" />
<ClInclude Include="ql\instruments\doublebarriertype.hpp" />
Expand Down Expand Up @@ -1587,6 +1590,7 @@
<ClInclude Include="ql\pricingengines\quanto\all.hpp" />
<ClInclude Include="ql\pricingengines\quanto\quantoengine.hpp" />
<ClInclude Include="ql\pricingengines\swap\all.hpp" />
<ClInclude Include="ql\pricingengines\swap\crossccyswapengine.hpp" />
<ClInclude Include="ql\pricingengines\swap\cvaswapengine.hpp" />
<ClInclude Include="ql\pricingengines\swap\discountingswapengine.hpp" />
<ClInclude Include="ql\pricingengines\swap\discretizedswap.hpp" />
Expand Down Expand Up @@ -2195,6 +2199,9 @@
<ClCompile Include="ql\instruments\cpicapfloor.cpp" />
<ClCompile Include="ql\instruments\cpiswap.cpp" />
<ClCompile Include="ql\instruments\creditdefaultswap.cpp" />
<ClCompile Include="ql\instruments\crossccybasisswap.cpp" />
<ClCompile Include="ql\instruments\crossccyfixfloatswap.cpp" />
<ClCompile Include="ql\instruments\crossccyswap.cpp" />
<ClCompile Include="ql\instruments\doublebarrieroption.cpp" />
<ClCompile Include="ql\instruments\doublebarriertype.cpp" />
<ClCompile Include="ql\instruments\equitytotalreturnswap.cpp" />
Expand Down Expand Up @@ -2649,6 +2656,7 @@
<ClCompile Include="ql\pricingengines\lookback\analyticcontinuouspartialfixedlookback.cpp" />
<ClCompile Include="ql\pricingengines\lookback\analyticcontinuouspartialfloatinglookback.cpp" />
<ClCompile Include="ql\pricingengines\lookback\mclookbackengine.cpp" />
<ClCompile Include="ql\pricingengines\swap\crossccyswapengine.cpp" />
<ClCompile Include="ql\pricingengines\swap\cvaswapengine.cpp" />
<ClCompile Include="ql\pricingengines\swap\discountingswapengine.cpp" />
<ClCompile Include="ql\pricingengines\swap\discretizedswap.cpp" />
Expand Down
24 changes: 24 additions & 0 deletions QuantLib.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,15 @@
<ClInclude Include="ql\instruments\creditdefaultswap.hpp">
<Filter>instruments</Filter>
</ClInclude>
<ClInclude Include="ql\instruments\crossccybasisswap.hpp">
<Filter>instruments</Filter>
</ClInclude>
<ClInclude Include="ql\instruments\crossccyfixfloatswap.hpp">
<Filter>instruments</Filter>
</ClInclude>
<ClInclude Include="ql\instruments\crossccyswap.hpp">
<Filter>instruments</Filter>
</ClInclude>
<ClInclude Include="ql\instruments\dividendschedule.hpp">
<Filter>instruments</Filter>
</ClInclude>
Expand Down Expand Up @@ -2730,6 +2739,9 @@
<ClInclude Include="ql\pricingengines\swap\all.hpp">
<Filter>pricingengines\swap</Filter>
</ClInclude>
<ClInclude Include="ql\pricingengines\swap\crossccyswapengine.hpp">
<Filter>pricingengines\swap</Filter>
</ClInclude>
<ClInclude Include="ql\pricingengines\swap\cvaswapengine.hpp">
<Filter>pricingengines\swap</Filter>
</ClInclude>
Expand Down Expand Up @@ -4793,6 +4805,15 @@
<ClCompile Include="ql\instruments\creditdefaultswap.cpp">
<Filter>instruments</Filter>
</ClCompile>
<ClCompile Include="ql\instruments\crossccybasisswap.cpp">
<Filter>instruments</Filter>
</ClCompile>
<ClCompile Include="ql\instruments\crossccyfixfloatswap.cpp">
<Filter>instruments</Filter>
</ClCompile>
<ClCompile Include="ql\instruments\crossccyswap.cpp">
<Filter>instruments</Filter>
</ClCompile>
<ClCompile Include="ql\instruments\europeanoption.cpp">
<Filter>instruments</Filter>
</ClCompile>
Expand Down Expand Up @@ -6038,6 +6059,9 @@
<ClCompile Include="ql\pricingengines\bond\discretizedconvertible.cpp">
<Filter>pricingengines\bond</Filter>
</ClCompile>
<ClCompile Include="ql\pricingengines\swap\crossccyswapengine.cpp">
<Filter>pricingengines\swap</Filter>
</ClCompile>
<ClCompile Include="ql\pricingengines\swap\cvaswapengine.cpp">
<Filter>pricingengines\swap</Filter>
</ClCompile>
Expand Down
8 changes: 8 additions & 0 deletions ql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ set(QL_SOURCES
instruments/cpicapfloor.cpp
instruments/cpiswap.cpp
instruments/creditdefaultswap.cpp
instruments/crossccybasisswap.cpp
instruments/crossccyfixfloatswap.cpp
instruments/crossccyswap.cpp
instruments/doublebarrieroption.cpp
instruments/doublebarriertype.cpp
instruments/equitytotalreturnswap.cpp
Expand Down Expand Up @@ -724,6 +727,7 @@ set(QL_SOURCES
pricingengines/lookback/analyticcontinuouspartialfixedlookback.cpp
pricingengines/lookback/analyticcontinuouspartialfloatinglookback.cpp
pricingengines/lookback/mclookbackengine.cpp
pricingengines/swap/crossccyswapengine.cpp
pricingengines/swap/cvaswapengine.cpp
pricingengines/swap/discountingswapengine.cpp
pricingengines/swap/discretizedswap.cpp
Expand Down Expand Up @@ -1343,6 +1347,9 @@ set(QL_HEADERS
instruments/cpicapfloor.hpp
instruments/cpiswap.hpp
instruments/creditdefaultswap.hpp
instruments/crossccybasisswap.hpp
instruments/crossccyfixfloatswap.hpp
instruments/crossccyswap.hpp
instruments/dividendschedule.hpp
instruments/doublebarrieroption.hpp
instruments/doublebarriertype.hpp
Expand Down Expand Up @@ -1966,6 +1973,7 @@ set(QL_HEADERS
pricingengines/mclongstaffschwartzengine.hpp
pricingengines/mcsimulation.hpp
pricingengines/quanto/quantoengine.hpp
pricingengines/swap/crossccyswapengine.hpp
pricingengines/swap/cvaswapengine.hpp
pricingengines/swap/discountingswapengine.hpp
pricingengines/swap/discretizedswap.hpp
Expand Down
1 change: 0 additions & 1 deletion ql/cashflows/overnightindexedcoupon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ namespace QuantLib {
OvernightLeg& withLockoutDays(Natural lockoutDays);
OvernightLeg& withObservationShift(bool applyObservationShift = true);
OvernightLeg& compoundingSpreadDaily(bool compoundSpreadDaily = true);
OvernightLeg& withLookback(const Period& lookback);
OvernightLeg& withCaps(Rate cap);
OvernightLeg& withCaps(const std::vector<Rate>& caps);
OvernightLeg& withFloors(Rate floor);
Expand Down
83 changes: 50 additions & 33 deletions ql/experimental/termstructures/crosscurrencyratehelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <ql/cashflows/simplecashflow.hpp>
#include <ql/cashflows/fixedratecoupon.hpp>
#include <ql/experimental/termstructures/crosscurrencyratehelpers.hpp>
#include <ql/pricingengines/swap/crossccyswapengine.hpp>
#include <ql/utilities/null_deleter.hpp>
#include <utility>

Expand Down Expand Up @@ -85,26 +86,6 @@ namespace QuantLib {
return IborLeg(sch, idx).withNotionals(1.0).withPaymentLag(paymentLag);
}

Leg buildFixedLeg(const Date& evaluationDate,
const Period& tenor,
Natural fixingDays,
const Calendar& calendar,
BusinessDayConvention convention,
bool endOfMonth,
Frequency paymentFrequency,
const DayCounter& dayCount,
Integer paymentLag) {

auto freqPeriod = Period(paymentFrequency);

Schedule sch = legSchedule(evaluationDate, tenor, freqPeriod, fixingDays, calendar,
convention, endOfMonth);
return FixedRateLeg(sch)
.withNotionals(1.0)
.withCouponRates(sample_fixed_rate, dayCount)
.withPaymentLag(paymentLag);
}

std::pair<Real, Real>
npvbpsConstNotionalLeg(const Leg& leg,
const Date& initialNotionalExchangeDate,
Expand Down Expand Up @@ -451,13 +432,48 @@ namespace QuantLib {
}

void ConstNotionalCrossCurrencySwapRateHelper::initializeDates() {
fixedLeg_ = buildFixedLeg(evaluationDate_, tenor_, fixingDays_, calendar_, convention_,
endOfMonth_, fixedFrequency_, fixedDayCount_, paymentLag_);
floatLeg_ = buildFloatingLeg(evaluationDate_, tenor_, fixingDays_, floatIndex_->fixingCalendar(),
floatIndex_->businessDayConvention(), endOfMonth_,
floatIndex_, floatIndex_->tenor().frequency(), paymentLag_);
auto overnightIndex = ext::dynamic_pointer_cast<OvernightIndex>(floatIndex_);

initializeDatesFromLegs(fixedLeg_, floatLeg_);
Period floatFreqPeriod;
if (floatIndex_->tenor().frequency() == NoFrequency) {
QL_REQUIRE(!overnightIndex, "Require payment frequency for overnight indices.");
floatFreqPeriod = floatIndex_->tenor();
} else {
floatFreqPeriod = Period(floatIndex_->tenor().frequency());
}

Real nominal = 1.0;
Schedule fixedSch = legSchedule(evaluationDate_, tenor_, Period(fixedFrequency_), fixingDays_, calendar_,
convention_, endOfMonth_);
Schedule floatSch = legSchedule(evaluationDate_, tenor_, floatFreqPeriod, fixingDays_, floatIndex_->fixingCalendar(),
floatIndex_->businessDayConvention(), endOfMonth_);

xccySwap_ = ext::make_shared<CrossCcyFixFloatSwap>(
CrossCcyFixFloatSwap::Type::Payer,
nominal,
Currency(),
fixedSch,
sample_fixed_rate,
fixedDayCount_,
convention_,
paymentLag_,
calendar_,
nominal,
floatIndex_->currency(),
floatSch,
floatIndex_,
Spread(0.0),
floatIndex_->businessDayConvention(),
paymentLag_,
calendar_
);
auto engine = ext::make_shared<CrossCcySwapEngine>(
floatIndex_->currency(), floatingLegDiscountHandle(),
Currency(), fixedLegDiscountHandle(),
makeQuoteHandle(1.0), true);
xccySwap_->setPricingEngine(engine);

initializeDatesFromLegs(xccySwap_->leg(0), xccySwap_->leg(1));
}

const Handle<YieldTermStructure>&
Expand All @@ -473,16 +489,17 @@ namespace QuantLib {
Real ConstNotionalCrossCurrencySwapRateHelper::impliedQuote() const {
QL_REQUIRE(!termStructureHandle_.empty(), "term structure not set");
QL_REQUIRE(!collateralHandle_.empty(), "collateral term structure not set");

auto [fixedNpv, fixedBps] = npvbpsConstNotionalLeg(
fixedLeg_, initialNotionalExchangeDate_, finalNotionalExchangeDate_, fixedLegDiscountHandle());

auto [floatNpv, floatBps] = npvbpsConstNotionalLeg(
floatLeg_, initialNotionalExchangeDate_, finalNotionalExchangeDate_, floatingLegDiscountHandle());
xccySwap_->deepUpdate();

const Spread basisPoint = 1.0e-4;
Real fixedNpv = xccySwap_->inCcyLegNPV(0);
Real fixedBps = xccySwap_->inCcyLegBPS(0);
Real floatNpv = xccySwap_->inCcyLegNPV(1);

QL_REQUIRE(std::fabs(fixedBps) > 0.0, "null fixed-leg BPS");
auto impliedQuote = sample_fixed_rate + ((floatNpv + fixedNpv) / (-fixedBps / basisPoint));

return sample_fixed_rate + (floatNpv - fixedNpv) / fixedBps;
return impliedQuote;
}

void ConstNotionalCrossCurrencySwapRateHelper::accept(AcyclicVisitor& v) {
Expand Down
4 changes: 2 additions & 2 deletions ql/experimental/termstructures/crosscurrencyratehelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define quantlib_crosscurrencyratehelpers_hpp

#include <ql/termstructures/yield/ratehelpers.hpp>
#include <ql/instruments/crossccyfixfloatswap.hpp>

namespace QuantLib {

Expand Down Expand Up @@ -222,8 +223,7 @@ namespace QuantLib {
ext::shared_ptr<IborIndex> floatIndex_;
bool collateralOnFixedLeg_;

Leg fixedLeg_;
Leg floatLeg_;
ext::shared_ptr<CrossCcyFixFloatSwap> xccySwap_;
};

}
Expand Down
6 changes: 6 additions & 0 deletions ql/instruments/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ this_include_HEADERS = \
cpicapfloor.hpp \
cpiswap.hpp \
creditdefaultswap.hpp \
crossccybasisswap.hpp \
crossccyfixfloatswap.hpp \
crossccyswap.hpp \
dividendschedule.hpp \
doublebarrieroption.hpp \
doublebarriertype.hpp \
Expand Down Expand Up @@ -100,6 +103,9 @@ cpp_files = \
cpicapfloor.cpp \
cpiswap.cpp \
creditdefaultswap.cpp \
crossccybasisswap.cpp \
crossccyfixfloatswap.cpp \
crossccyswap.cpp \
doublebarrieroption.cpp \
doublebarriertype.cpp \
equitytotalreturnswap.cpp \
Expand Down
3 changes: 3 additions & 0 deletions ql/instruments/all.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#include <ql/instruments/cpicapfloor.hpp>
#include <ql/instruments/cpiswap.hpp>
#include <ql/instruments/creditdefaultswap.hpp>
#include <ql/instruments/crossccybasisswap.hpp>
#include <ql/instruments/crossccyfixfloatswap.hpp>
#include <ql/instruments/crossccyswap.hpp>
#include <ql/instruments/dividendschedule.hpp>
#include <ql/instruments/doublebarrieroption.hpp>
#include <ql/instruments/doublebarriertype.hpp>
Expand Down
Loading
Loading