Difference in scheduling between Fixed and Floating legs?

Hi all,

I am building a swap vanilla using the RateCalculationSwapLeg Builder. I’m using as a test case a contract with a floating leg and a fixed leg. I build the legs in the same exact way except for when it comes to the calculation, which is where the difference is:

//Fixed
SwapLeg parsedLeg = leg.calculation(FixedRateCalculation.of(unparsedLeg.getFixedRateValue(), unparsedLeg.getDayCounter())).build(); 
//Floating
SwapLeg parsedLeg = leg.calculation(IborRateCalculation.of(unparsedLeg.getIndexRate())).build(); 

Now this compiles and works, but the resulting schedule is different for the two legs in one date that I have seen - one says one scheduled date is 31.07.2009, the other says it is 30.07.2009. Since this is a test contract I already know the correct value that should be computed is 31.07.2009 and this is correctly computed by the fixed leg, while the floating computes it incorrectly.
My question is then, why the floating leg computes it incorrectly, and how can I fix it?

Thank you very much!

Methods like leg.calculation() and unparsedLeg.getDayCounter() are not part of Strata, so I can’t comment on what they are doing.

The schedules are built from the PeriodicSchedule class held as accrualSchedule on the leg, so you need to debug and see what the content of that object is on each leg.

Hello stephen, and thank you for your reply! leg.calculation comes from the Builder class (com.opengamma.strata.product.swap.RateCalculationSwapLeg.Builder) and “builds” the SwapLeg object.

Maybe this gives you more insight on the problem, but I will now dive into PeriodicSchedule class and see the content of that object in each leg.

EDIT: the content of accrualSchedule is basically the same for the two legs, frequency, roll convention, stub convention, … you name it, it’s the same. I will go further into the computation of the legs, which happens in the following snippet

    final Swap swap = Swap.of(strataSwapLegs);
    TradeInfo tradeInfo = TradeInfo.empty(); 
    SwapTrade swapTrade = SwapTrade.of(tradeInfo, swap); 
    ReferenceData refData = ReferenceData.standard(); 
    ResolvedSwapTrade resolved = swapTrade.resolve(refData);
    ResolvedSwap resolvedSwap = resolved.getProduct();

I’m still looking into this - could this be a Strata bug?
I feel like since the roll convention is set to EOM it has to compute 31.07 rather than 30.07 (and this is correctly computed for the fixed leg!) so I don’t get why the floating leg should compute a different date…

EDIT: I got the problem.
By definition if you input EOM Strata will go for the end of the month. The problem is that if you input a different date, even with EOM Strata will follow that date. For example if I put as roll convention EOM but I have a start OR end date something different that the end of a month (say, the 12th of a month) then Strata will compute the periodic schedule ending at the 12th of a month.

How can I force Strata to compute EOM even if I’m ending the contract the 30th of October (not EOM for October)?

EDIT 2: Solved by adding a StubConvention SHORT_FINAL, in this case EOM is respected till the last month of the operation. Thank you!

1 Like