0
$\begingroup$

I am valuing few Basis Swaps having combination of USD-FedFunds-H.15-OIS-COMPOUND3M vs USD3MLibor. However, I can understand to value 'USD-FedFunds-H.15-OIS-COMPOUND1D' by using ql.FedFunds(). But dont know how to pass period '3M' parameter in Fedfunds object. Can someone suggest to handle such type of indexes in valuation.

Standard way as mentioned below:

'usd-libor-3m-bba':ql.USDLibor(ql.Period('3M')),
"fedfunds": ql.FedFunds()

Added a sample question for reference.

import QuantLib as ql
import pandas as pd


fedspotRates = [0.02514, 0.026285, 0.027326299999999998,
     0.0279, 0.029616299999999998, 0.026526,
     0.026028, 0.0258695, 0.025958000000000002,
     0.0261375, 0.026355, 0.0266255,
     0.026898, 0.0271745, 0.02741,
     0.027666, 0.028107000000000004, 0.028412000000000003,
     0.028447, 0.0284165]

fedspotPeriod = [ql.Period(1, ql.Weeks), ql.Period(1, ql.Months),
      ql.Period(3, ql.Months), ql.Period(6, ql.Months),
      ql.Period(9, ql.Months), ql.Period(1, ql.Years),
      ql.Period(3, ql.Years),  ql.Period(5, ql.Years),
      ql.Period(10, ql.Years), ql.Period(15, ql.Years), ql.Period(20, ql.Years),
      ql.Period(30, ql.Years), ql.Period(50, ql.Years)]

usdlibor3mRates = [0.0514, 0.006285, 0.027326299999999998,
     0.0279, 0.02961, 0.026526,
     0.026028, 0.0258695, 0.02595,
     0.0261375, 0.026355, 0.0266255,
     0.026898, 0.0271745, 0.02741,
     0.027666, 0.0281070, 0.028,
     0.028447, 0.0284165]

usdlibor3mspotPeriod = [ql.Period(1, ql.Weeks), ql.Period(1, ql.Months),
      ql.Period(3, ql.Months), ql.Period(6, ql.Months),
      ql.Period(9, ql.Months), ql.Period(1, ql.Years),
      ql.Period(3, ql.Years),  ql.Period(5, ql.Years),
      ql.Period(10, ql.Years), ql.Period(15, ql.Years), ql.Period(20, ql.Years),
      ql.Period(30, ql.Years), ql.Period(50, ql.Years)]

dates = [calendar.advance(todaysDate, period) for period in 
fedspotPeriod]
curve = ql.ZeroCurve(dates, fedspotRates[:13], day_count, calendar)
yts = ql.YieldTermStructureHandle(curve)
engine = ql.DiscountingSwapEngine(yts)

fed_float3m = floatingSchedule1
usdlibor_float3m = floatingSchedule2
index1 = fedfunds3m
index2 = usdlibor3m
spread=0
notional=100e6
basisSwap=ql.FloatFloatSwap(ql.VanillaSwap.Payer,
            [notional] * (len(fed_float3m)-1),
            [notional] * (len(usdlibor_float3m)-1),
            fed_float3m,
            index1,
            ql.Actual360(),
            usdlibor_float3m,
            index2,
            ql.Actual360(), False, False,
            [] * (len(fed_float3m)-1),
            [] * (len(fed_float3m)-1))
swapEngine = DiscountingSwapEngine(discount_curve)
basisSwap.setPricingEngine(swapEngine)
$\endgroup$
6
  • $\begingroup$ Not a QL user, so just thinking out loud here: you could (a) either look for a separate class for compound indices, or (b) use the ql.FedFunds() object (which I understand to be the daily FF) and compound it over 3M yourself, thereby "creating" the 3M compounded index yourself. $\endgroup$
    – KevinT
    Apr 13, 2022 at 6:30
  • $\begingroup$ @KevinT Thanks for reply. Can you show in example for second option you suggested. It will be helpful. $\endgroup$
    – robin
    Apr 14, 2022 at 1:58
  • $\begingroup$ Please don't destroy your posted questions and don't be rude. $\endgroup$
    – Bob Jansen
    May 12, 2022 at 13:05
  • $\begingroup$ @BobJansen do I sound like rude if I delete the question. If the question is not answered and addressed, and some guys give rude comment on my post, do you still think I should keep the post. $\endgroup$
    – robin
    May 12, 2022 at 15:53
  • $\begingroup$ @BobJansen and top of it, someone deleted my comments. Isn't that rude. $\endgroup$
    – robin
    May 12, 2022 at 15:56

1 Answer 1

0
$\begingroup$

You will need to use an OISRateHelper. OIS stands for Overnight Indexed Swap, the investopedia article explains OIS well.

$\endgroup$
2
  • $\begingroup$ please suggest how to use OisRateHelper in the above example to price FedFund3m vs USDLibor3m basis swap. $\endgroup$
    – robin
    May 6, 2022 at 21:21
  • $\begingroup$ I mean what are you currently able to do? You can't do ois and you can't make sifma swaps. You need to make at least some attempt that can be fixed by others... this isn't a platform for free work. $\endgroup$ May 6, 2022 at 23:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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