EconomicScenarioGenerators.jl icon indicating copy to clipboard operation
EconomicScenarioGenerators.jl copied to clipboard

Add yield curves as output from short rate models

Open kasperrisager opened this issue 3 years ago • 5 comments

The current output from the short rate models is currently the short rate itself. All these models have the neat feature that the yield curve at a simulated future point depends only on the short rate, the time, and initial state information. It would be good to have access to those, e.g. through

yield_curve(srm::ShortRateModel, short_rate, time)

Alternatively, one could build an iterator that gave both short rate and curve, or only the curve.

kasperrisager avatar Aug 02 '22 15:08 kasperrisager

Thanks for the suggestion! Just to clarify:

  • versus what is already the exposed API, you are saying there should be a clean way to get both the short rate path and the yield curve at the same time? Since right now collect(s::ScenarioGenerator) gives you the short rate path, YieldCurve(s) gives you the yield curve, but there isn't a straightforward way to get a YieldCurve once you've collected a particular path?
  • I'm not sure I follow what the usage of the time component would be in your pseudo-code? E.g. what would be the difference between what YieldCurve does now?

alecloudenback avatar Aug 03 '22 02:08 alecloudenback

I think this is related to your comment here, which I'm copying here for sake of the discussion:

And as you write, the process is not for a forward rate but for an actual short rate which is realized. The result comes out as a yield curve which, I guess, is mathematically fine, and gives access to e.g. pv methods that are the discount factors for the scenario. But I must admit I was a little surprised, since I'd normally use yield curves to represent something happening in the future of the scenario, and not on its past path. Again, mathematically fine, which, in my book, makes it fine, generally.

This is very interesting. As I said earlier, I've never had to create ESGs in the past and generally would use ESGs in the context of stochastic modeling wherein the point was to determine a prospective liability using the scenarios imputed in the scenario. I think I'm missing a use-case or formulation as I thought the most practical output would be a YieldCurve-like object?

alecloudenback avatar Aug 03 '22 03:08 alecloudenback

E.g. what would be the difference between what YieldCurve does now?

Right now, YieldCurve(s) represents the accumulated deflator up to time s. From the point of view of someone experiencing this scenario, it relates to the past up to time s. However, if that person experiencing this scenario wants to price a bond maturing after s, they would need a (forward looking) yield curve as measured at time s.

A financial example could be the numerical pricing of a swaption: simulate a bunch of scenarios for the short rate; for each of those, measure the value of the swap at its starting time using the forward looking yield curve, floor at zero, and discount back to time zero using the scenario deflator (current yield curve). Take mean.

kasperrisager avatar Aug 03 '22 07:08 kasperrisager

So like Yields.ForwardStarting(YieldCurve(sg),s), but more direct access to the short rate itself? E.g. what collect(s) does, but only rates prospective from time s?

julia> y = YieldCurve(s)

julia> discount(Yields.ForwardStarting(y,10),10) * discount(y,10)
0.9616406328145991

julia> discount(y,20)
0.9616406328145992

alecloudenback avatar Aug 03 '22 23:08 alecloudenback

No, not really, something different. But it's probably better if I try to work out an example in code or math, maybe a pr will be self explanantory 😄

Anyway, it's quite important in these models that if you price something at time t (e.g. a bond maturing at u>t), you are only allowed to use information collected up to time t. So not the whole yield curve YieldCurve(sg) since it contains information about the short rate before and after t. In short rate models, however, you have access to the yield curve that governs pricing at time t; it's given by the current short rate r(t), t and the other parameters.

kasperrisager avatar Aug 07 '22 18:08 kasperrisager