domokane / FinancePy

A Python Finance Library that focuses on the pricing and risk-management of Financial Derivatives, including fixed-income, equity, FX and credit derivatives.
GNU General Public License v3.0
2.1k stars 318 forks source link

Libor-type curve build from OIS #22

Open domokane opened 4 years ago

domokane commented 4 years ago

Bootstrap discount factors from the OIS.

jonfreedman commented 3 years ago

You may want to take a look at the Strata library from OpenGamma as they have pretty good curve fitting support. It's written in Java so you can probably follow it given your Python style.

You'll need to offer curve calibration using outright OIS & IBOR tenor swaps, OIS meeting date swaps, basis swaps of either IBOR/IBOR, IBOR/OIS or OIS/OIS, OIS and IBOR futures, IBOR FRAs (I include ESTR and SOFR in the OIS category). You should also allow for multiple overnight rates per currency (SOFR+FF & ESTR+EONIA).

The most interesting case to cover is probably AUD where you need full multi-curve support as the 3m and 6m curves are co-dependent on each other.

domokane commented 3 years ago

Thanks. I will look into this. D

From: Jon Freedman Sent: 03 October 2020 20:34 To: domokane/FinancePy Cc: domokane; Author Subject: Re: [domokane/FinancePy] Libor-type curve build from OIS (#22)

You may want to take a look at the Strata library from OpenGamma as they have pretty good curve fitting support. It's written in Java so you can probably follow it given your Python style. You'll need to offer curve calibration using outright OIS & IBOR tenor swaps, OIS meeting date swaps, basis swaps of either IBOR/IBOR, IBOR/OIS or OIS/OIS, OIS and IBOR futures, IBOR FRAs (I include ESTR and SOFR in the OIS category). You should also allow for multiple overnight rates per currency (SOFR+FF & ESTR+EONIA). The most interesting case to cover is probably AUD where you need full multi-curve support as the 3m and 6m curves are co-dependent on each other. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

domokane commented 3 years ago

Jon - I have implemented

It works fine. The code may need some refactoring when it's all done. I am also exploring best interpolation schemes.

Right now I would love to find numerical examples e.g. from Bloomberg I can tie out to. Do you have access to any ?

I will now turn to including IBOR basis swaps and OIS-IBOR swaps. The joint coupling of the curves makes this a more complex problem to solve but should be do-able.

Let me have any comments you might have.

jonfreedman commented 3 years ago

I found a few random datasources from Google you could use:

It's not really that important how close to the market they are as long as they're consistent with each other

domokane commented 3 years ago

Thanks. Those are good data sources that I will bookmark.

What I was looking for is a full worked example of building an OIS curve, then a Euribor curve and then using that to value an off-market swap. This paper (https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2219548 ) by Ametrano and Bianchetti is very good but does not quite get there. In any case my curves do build and reprice the market and the swap valuation works so I am pretty sure it's fine but I would have liked an independent check. The good news is that I have found this QL example and I am checking I can tie out.

https://blog.deriscope.com/index.php/en/excel-usd-interest-rate-swap-pnl

jonfreedman commented 3 years ago

Yeah finding test cases will be tricky without streaming market data, I'd use the sebgroup data to fit a curve with 5y, 7y, 10y and check the 6y, 8y, 9y projected rates.

On the topic of interpolation schemes ideally you should support using multiple schemes, e.g. flat between meeting dates at the short end and then something smooth and cubic after the first x meetings. Both the OIS/RFR curves which use meeting dates and inflation curves which use fixing swaps exhibit this behaviour, e.g. you have a market rate at t[x] and t[x+1] and there is no market expectation of any change between those two dates.