Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add yield curves as output from short rate models #36

Open
kasperrisager opened this issue Aug 2, 2022 · 5 comments
Open

Add yield curves as output from short rate models #36

kasperrisager opened this issue Aug 2, 2022 · 5 comments

Comments

@kasperrisager
Copy link

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.

@alecloudenback
Copy link
Member

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
Copy link
Member

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?

@kasperrisager
Copy link
Author

kasperrisager commented Aug 3, 2022

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.

@alecloudenback
Copy link
Member

alecloudenback commented Aug 3, 2022

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

@kasperrisager
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants