Quantlib reconstruct the bond curve using a model with fixed parameters

318 views Asked by At

I'm new using QuantLib. I would like to construct a bond curve using some parameters of NS model. All I found was the other way around, give some bonds and get the parameters.

For example, I want to construct a bond curve using NS with parameters [0.03;-0.02;0; 0.17; 0.08].

I tried to use "setPricingEngine" or "DiscountingBondEngine" what I was not lucky.

Any comment would be very helpful.

Thank You

1

There are 1 answers

1
Luigi Ballabio On BEST ANSWER

There's no such possibility at this time. To enable it, you could do something like:

  • Add a constructor to the NelsonSiegelFitting class that takes the parameters and uses them to fill the solution_ array;
  • Add a constructor to the FittedBondDiscountCurve class that takes a pre-built fitting method and no bonds.
  • modify the calculate method of FittedBondDiscountCurve so that it skips the optimization if no bonds were given.

This way, you could build the NS fitting with the desired parameters, pass it to the curve, and then use the curve in the discounting engine.

If you manage it, please consider contributing your changes to the library.