0
$\begingroup$

I'm using quantlib to calculate a fair spread of Libor/OIS swap. I have read the reference of ql.Swap and ql.FloatFloatSwap. But the document is too vague. I totally can't understand what parameters should be used.

Now I have a YieldCurve object of 3M Libor and a YieldCurve object of OIS rate. How can I calculate the fair spread of Libor/OIS spread though Quantlib? And Is that possible to calculate DV01 of this swap?

I'm quit confused about this, and I can't find any help in the Internet. Thanks in advance![enter image description here]1

$\endgroup$
1
$\begingroup$

I'm not saying that you don't, but before using software to calculate whatever you need, one should be sure to understand what is being priced and how to price it.

For a Libor 3M vs OIS swap, you need two curves: a 3M curve for the forward estimation of the 3M index and an OIS curve for the forward estimation of the overnight index and to discount the cashflows.

In QuantLib you can use either the ql.Swap or the ql.FloatFloatSwap classes.

For the ql.Swap, the constructor would be:

ql.Swap(firstLeg, secondLeg) and you can build the legs with ql.OvernightLeg and ql.IborLeg

For the ql.FloatFloatSwap the constructor would be:

ql.FloatFloatSwap(swapType, firstLegNotionals, secondLegNotionals, firstLegSchedule, firstLegIndex, firstLegDayCount, secondLegSchedule, secondLegIndex, secondLegDayCount, intermediateCapitalExchange=False, finalCapitalExchange=False, gearing1=[1.0], spread1=[0.0])

Neither of these objects have a method to determine the spread so I believe you will have to implement it yourself with a solver (QuantLib has several solvers). Solve which spread on the overnight index gives you an NPV of 0.

Same goes for the DV01, you will need to implement the logic yourself, with something like :

$$(MtM_{bump.up} - MtM_{bump.down}) / 2$$

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks. How to set spread rate in ql.FloatFloatSwap? $\endgroup$ – Gao Haocheng Jun 12 at 13:00
  • $\begingroup$ It's one of the optional parameters. I corrected the answer to include those. You can also check here for the full list: quantlib.org/reference/… $\endgroup$ – David Duarte Jun 12 at 13:14

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.