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!