I found 'enableExtrapolation' in many curve-building examples but can only guess. Can anyone help me to understand it? It will be perfect if there are examples to show how it works. Thank you very much!

  • $\begingroup$ Could you please be more specific? $\endgroup$ Jun 12 '20 at 8:53

For example, let us build a survival probabilities curve providing the survival probabilities for the first 5 years.

today = ql.Date().todaysDate()
dates = [today + ql.Period(n , ql.Years) for n in range(5)]
survival_probabilities = [1.0, 0.99, 0.98, 0.97, 0.95]
spcrv = ql.SurvivalProbabilityCurve(dates, survival_probabilities, ql.Actual360(), ql.TARGET())

Suppose you need the survival probability in 7 years, beyond the last data point that you have provided. What do you prefer the library to do?

Sometimes, you want to throw, but most of the time it is more convenient to silently use the same constant hazard rate that you provided between 4 and 5 years to interpolate beyond 5 years.

The same setting works for interest rate curves (do you want to get an error when you ask for a discount factor beyond the date of your last helper? usually not), volatility surfaces, etc.

  • $\begingroup$ Thanks Dimitri! What if my assumption is the values would be exactly the same as 5 years? $\endgroup$
    – YangH
    Jun 15 '20 at 2:42
  • $\begingroup$ FlatHazardRate would use the same hazard rate after 5y that wat calibrated for between 4y and 5y. I suspect (you may want to test!) that if you provide a survival probabilty for 6y just a little lower than 5y, then the hazard rate would be very small from 5y to 6y, and almost the same survival probability would be extrapolated for any time after 6y.. if this is what you really want. $\endgroup$ Jun 15 '20 at 3:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.