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 ?
2 Answers
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
-
$\begingroup$ Looking at github.com/lballabio/QuantLib/blob/master/ql/experimental/…, there's also
MtMCrossCurrencyBasisSwapRateHelper
- some documentation wouldn't have hurt :) $\endgroup$ May 25 at 1:39 -
1$\begingroup$ quantlib.org/reference/deprecated.html might help — it lists currently deprecated features and suggested alternatives.
CrossCurrencyBasisSwapRateHelper
was listed there from version 1.24 (when it was renamed toConstNotionalCrossCurrencyBasisSwapRateHelper
and the old name was deprecated) to version 1.28; it was eventually removed in version 1.29. We might consider keeping older versions of the reference around so that the information is not lost. As for the QuantLib-Python documentation site, that's an external project. $\endgroup$ May 25 at 7:56
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}")
-
$\begingroup$ This answer needs some work. The parameters passed to the
ConstNotionalCrossCurrencyBasisSwapRateHelper
constructor are wrong, see github.com/lballabio/QuantLib/blob/master/ql/experimental/… for its declaration. $\endgroup$ 12 hours ago