|
From: Ben W. <ben...@ma...> - 2023-09-15 20:31:09
|
There is no WAL calculator in Quantlib. WAL modelling is very much related to the tranche waterfall structure. The typical model is the CPR (constant prepayment rate). To do this properly you will need the details of every series, model paydown profile, calculate the WAL for the given CPR. You can estimate the CPR from the actual or estimated bond factors. You can get more in to this by looking at the expected defaults in the pool and see what the impact is on the waterfall. On Sat, 16 Sept 2023, 2:57 am Michael (DataDriven portal), < mi...@da...> wrote: > Hi Ben: > > Thanks a lot. I will use that. I am also wondering if WAL (weighted > average life) for a bond is calculated by QuantLib (I could not find it in > the documentation) which is defined here: > https://www.investopedia.com/terms/w/weightedaveragelife.asp. > > Thanks, > > Michael > > On Thu, Sep 14, 2023 at 4:32 PM Ben Watson <ben...@ma...> > wrote: > >> >> >> This is from the python documentation >> >> >> import QuantLib as ql >> import numpy as np >> import matplotlib.pyplot as plt >> >> X = [1., 2., 3., 4., 5.] >> Y = [0.5, 0.6, 0.7, 0.8, 0.9] >> >> methods = { >> 'Linear Interpolation': ql.LinearInterpolation(X, Y), >> 'LogLinearInterpolation': ql.LogLinearInterpolation(X, Y), >> 'CubicNaturalSpline': ql.CubicNaturalSpline(X, Y), >> 'LogCubicNaturalSpline': ql.LogCubicNaturalSpline(X, Y), >> 'ForwardFlatInterpolation': ql.ForwardFlatInterpolation(X, Y), >> 'BackwardFlatInterpolation': ql.BackwardFlatInterpolation(X, Y), >> 'LogParabolic': ql.LogParabolic(X, Y) >> } >> >> xx = np.linspace(1, 10) >> fig = plt.figure(figsize=(15,4)) >> plt.scatter(X, Y, label='Original Data') >> for name, i in methods.items(): >> yy = [i(x, allowExtrapolation=True) for x in xx] >> plt.plot(xx, yy, label=name); >> plt.legend(); >> >> On Fri, 15 Sept 2023, 4:34 am Michael (DataDriven portal), < >> mi...@da...> wrote: >> >>> Hi All, >>> >>> I am looking for some QuantLib examples on how to calculate bond's I >>> spread that match Bloomberg calculations (as described below). >>> >>> Any help is greatly appreciated! >>> >>> Bloomberg's I-spread is calculated like this: find the 2 swap rate >>> quotes nearest the bond maturity. Linearly interpolate to get the swap rate >>> at the bond's maturity. (Unless you happen to have a swap rate quote >>> exactly at the bond's maturity.) I-spread = interpolated swap rate - the >>> bond's conventional yield >>> >>> Thanks, >>> >>> Michael >>> _______________________________________________ >>> QuantLib-users mailing list >>> Qua...@li... >>> https://lists.sourceforge.net/lists/listinfo/quantlib-users >>> >> |