|
From: <da...@el...> - 2020-11-20 13:41:54
|
Hi everyone, I've made some mods for my own use to the ExponentialSplinesFitting class, and before I go ahead and submit a pull request, I'd appreciate some initial feedback. The form of the discount function for the exponential spline fit is: df(t) = sum( b(i) exp -i.kappa.t ) for i = 1 to N. Where b(i) and kappa are the variables used to fit the curve. The current implementation fixes N at 9 (so 9 x b(i) + 1 x kappa = 10 parameters). If the discount factor is constrained to be 1 at time t=0 (which is usually is) then one of the b(i)s is constrained, since at t=0, sum(b(i)) = 1, reducing the total number of independent parameters to 9. In the implementation b(1) is constrained. >From my experience of using exponential spline fitting over the years, and from what I have read, there is no definitive argument for fixing N=9. Indeed the number chosen can depend on several considerations: the density of bonds across the curve; whether you want to fit the very short end etc. You also find that the value of kappa doesn't make much difference to the quality of fit as long as it is in the right range. Other implementations fix kappa (it's akin to the far-forward overnight rate, so something around 1% in the current environment), and then optimize over the b(i)s. If you extrapolate the spline beyond the last bond (which is probably not a great idea) then kappa does have an effect on the shape of that extrapolated part but I feel it is simply an artefact of the fitting. In my implementation, the number of parameters is a variable and hence a class member, and there is also the option to fix kappa and supply a non-zero value for that fix (kappa = 0 is a special case as it produces df(t) = 1 no matter how much the b(i)s are varied (in the constrained model) ). Initially I had derived my new class, unimaginatively named ExponentialSplinesFittingN from ExponentialSplinesFitting, but on reflection the inheritance is redundant as I am over-riding every method, so perhaps it should also derive directly from the abstract base FittedBondDiscountCurve::FittingMethod. I am open to suggestions for a decent name! I wrote it before I had read the QL "style guide" so will need to amend my implantation anyway: hence this is a good moment to hear any thoughts! Best wishes David Sansom |