Replacing a Deprecated QuantLib Cross-Currency Swap Helper
Summary
The document addresses a QuantLib change affecting construction of cross-currency basis swap curves for collateral posted in a currency different from the asset currency. It identifies ConstNotionalCrossCurrencyBasisSwapRateHelper as the apparent replacement for the deprecated CrossCurrencyBasisSwapRateHelper. The replacement supports basis swaps with constant notionals, whereas the older helper also accommodated varying notionals.
The discussion describes the replacement’s role in curve building and lists typical inputs such as settlement conventions, a market quote, dates, calendar, currencies, and a basis swap index. It also includes a sample workflow that places the helper among curve instruments and queries a discount factor. The guidance is brief and notes that documentation for the replacement is limited; the example’s parameter conventions and suitability for a particular market setup should therefore be checked against the installed QuantLib version and the intended swap conventions.
Key ideas
- ConstNotionalCrossCurrencyBasisSwapRateHelper is presented as the replacement for the deprecated cross-currency helper.
- The replacement is intended for basis swaps with constant notional amounts.
- The helper contributes market quotes to construction of a cross-currency basis swap curve.
- Curve setup depends on conventions and inputs including dates, settlement, currencies, and the relevant swap index.
- The document reports limited documentation, so implementation details should be verified for the QuantLib version in use.
Tags
Full text
# CrossCurrencyBasisSwapRateHelper feature deprecated
# CrossCurrencyBasisSwapRateHelper feature deprecated
I have been using the CrossCurrencyBasisSwapRateHelper feature to generate a colateralised discounting curve where the collateral is in a currency different to that of the asset. However, I noticed that this feature has now been deprecated and no longer available although it is still listed under the 'Helpers' section of the online Quantlib help documentation. Is their an alternative ?
## Answer by Stephen Ellis NZ (score 2)
https://quant.stackexchange.com/a/75651
it looks as if ConstNotionalCrossCurrencyBasisSwapRateHelper has been added as replacement. Just no documentation offered on the at https://quantlib-python-docs.readthedocs.io/en/latest/thelpers.html?highlight=helpers
## Answer by TourEiffel (score 1)
https://quant.stackexchange.com/a/75654
It seems that the `ConstNotionalCrossCurrencyBasisSwapRateHelper` is indeed a replacement for the deprecated `CrossCurrencyBasisSwapRateHelper` in QuantLib.
The `ConstNotionalCrossCurrencyBasisSwapRateHelper` class is used to create rate helpers for cross-currency basis swap curves, where the collateral is in a currency different from that of the asset. It allows for a constant notional amount for the basis swaps, as opposed to varying notionals that were supported by the deprecated helper.
To use `ConstNotionalCrossCurrencyBasisSwapRateHelper`, you would typically create an instance of the helper and pass the required parameters such as the settlement days, quote, start and end dates, and the underlying basis swap index. This helper can then be used in the construction of your cross-currency basis swap curve.
Here's a basic example demonstrating the usage of `ConstNotionalCrossCurrencyBasisSwapRateHelper` in Python with QuantLib:
```
import QuantLib as ql
# Set up the required parameters
settlement_days = 2
quote = ql.SimpleQuote(0.01) # Example basis swap rate quote
start_date = ql.Date(25, 5, 2023) # Example start date
end_date = ql.Date(25, 5, 2024) # Example end date
calendar = ql.TARGET() # Example calendar
collateral_currency = ql.EURCurrency() # Example collateral currency
asset_currency = ql.USDCurrency() # Example asset currency
basis_swap_index = ql.Euribor6M() # Example basis swap index
# Create the basis swap rate helper
basis_swap_helper = ql.ConstNotionalCrossCurrencyBasisSwapRateHelper(
settlement_days, quote, start_date, end_date,
calendar, collateral_currency, basis_swap_index, asset_currency
)
# Retrieve the discount curve for collateral currency
collateral_curve = ql.YieldTermStructureHandle(
ql.FlatForward(0, ql.TARGET(), 0.05, ql.Actual360())
) # Example collateral curve
# Construct the discounting curve with the basis swap helper
helpers = [basis_swap_helper]
curve = ql.PiecewiseLogCubicDiscount(settlement_days, calendar, helpers, ql.Actual360())
# Evaluate the curve at a specific date
curve_date = ql.Date(1, 6, 2023) # Example evaluation date
discount_factor = curve.discount(curve_date)
print(f"Discount factor at {curve_date}: {discount_factor:.6f}")
```Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.