InflationSwaps Curve

Hi Stephen,
We are trying to process Bloomberg Inflation Swaps examples and getting indexOutOfBound exception.
It seems that while building the curve array according to effective date, termination date and the period, the array is too small.

For example,


2016-07-12

NONE



2021-07-12

NONE



NONE


5
Y
NONE

Through debugging we see:
The termInYearsEstimate is 7
frequency.eventsPerYearEstimate() is 0.2
frequency.eventsPerYearEstimate() * termInYearsEstimate is 1.4
int(1.4) is 1

I would have thought that the value should be rounded up rather than truncated and result should be 2

Looks like you used XML and it got eaten. Can you use triple backtick around the XML so we can see what you are asknig?

Sorry about that

Here it is:
<calculationPeriodDates id="recCalcDates"> <effectiveDate> <unadjustedDate>2016-07-12</unadjustedDate> <dateAdjustments> <businessDayConvention>NONE</businessDayConvention> </dateAdjustments> </effectiveDate> <terminationDate> <unadjustedDate>2021-07-12</unadjustedDate> <dateAdjustments> <businessDayConvention>NONE</businessDayConvention> </dateAdjustments> </terminationDate> <calculationPeriodDatesAdjustments> <businessDayConvention>NONE</businessDayConvention> </calculationPeriodDatesAdjustments> <calculationPeriodFrequency> <periodMultiplier>5</periodMultiplier> <period>Y</period> <rollConvention>NONE</rollConvention> </calculationPeriodFrequency> </calculationPeriodDates>

The estimateNumberPeriods() method that you are seeing is intended to optimise the size of the list. As you say, it should round up to ensure that the estimate is an overestimate, not an underestimate. Can you include the exception, as building a schedule from this definition does not throw an error for me:

PeriodicSchedule defn = PeriodicSchedule.builder()
    .startDate(date(2016, 7, 12))
    .endDate(date(2021, 7, 12))
    .businessDayAdjustment(BusinessDayAdjustment.NONE)
    .frequency(Frequency.ofYears(5))
    .build();
Schedule sch = defn.createSchedule(ReferenceData.standard());

In generateBackwards when add the start date by using addFirst we got IndexOutOfBoundException for the first is -1

void addFirst(LocalDate date) {
  array[--first] = date;
}

It is being caught and handled as failure in calculate:
// calculates the result
private Map<Measure, Result<?>> calculate(ScenarioMarketData marketData, ReferenceData refData) {
try {
return function.calculate(target, getMeasures(), parameters, marketData, refData);
} catch (RuntimeException ex) {
return handleFailure(ex);
}
}

Hi Stephen,

Testing with LCH sample file, we are getting the same error. You can see the inflation leg.
<swapStream id="floatingLeg"> <payerPartyReference href="party2" /> <receiverPartyReference href="party1" /> <calculationPeriodDates id="floatingCalcPeriodDates2"> <effectiveDate> <unadjustedDate>2013-06-01</unadjustedDate> <dateAdjustments> <businessDayConvention>NONE</businessDayConvention> </dateAdjustments> </effectiveDate> <terminationDate> <unadjustedDate>2023-06-01</unadjustedDate> <dateAdjustments> <businessDayConvention>NONE</businessDayConvention> </dateAdjustments> </terminationDate> <calculationPeriodDatesAdjustments> <businessDayConvention>NONE</businessDayConvention> </calculationPeriodDatesAdjustments> <calculationPeriodFrequency> <periodMultiplier>10</periodMultiplier> <period>Y</period> <rollConvention>NONE</rollConvention> </calculationPeriodFrequency> </calculationPeriodDates> <paymentDates> <calculationPeriodDatesReference href="floatingCalcPeriodDates2" /> <paymentFrequency> <periodMultiplier>10</periodMultiplier> <period>Y</period> </paymentFrequency> <payRelativeTo>CalculationPeriodEndDate</payRelativeTo> <paymentDatesAdjustments> <businessDayConvention>MODFOLLOWING</businessDayConvention> <businessCenters> <businessCenter>GBLO</businessCenter> </businessCenters> </paymentDatesAdjustments> </paymentDates> <calculationPeriodAmount> <calculation> <notionalSchedule> <notionalStepSchedule> <initialValue>25000000</initialValue> <currency>GBP</currency> </notionalStepSchedule> </notionalSchedule> <inflationRateCalculation> <floatingRateIndex floatingRateIndexScheme="http://www.fpml.org/coding-scheme/inflation-index-description">UK-RPI</floatingRateIndex> <inflationLag> <periodMultiplier>2</periodMultiplier> <period>M</period> </inflationLag> <indexSource rateSourcePageScheme="http://www.fpml.org/coding-scheme/inflation-index-source">UKRPI</indexSource> <interpolationMethod>None</interpolationMethod> <initialIndexLevel>249.5</initialIndexLevel> <fallbackBondApplicable>false</fallbackBondApplicable> </inflationRateCalculation> <dayCountFraction>1/1</dayCountFraction> </calculation> </calculationPeriodAmount> </swapStream>

It should be rounded up. However, it is rounded down.

Bug 1236

Thank you Stephen,
What do you expect to release v1.1?

We have no specific date for v1.1. I hope it will be less than two months away, but no commitments at this time.

Thank you Stephen,
I would be happy to know when the version is released.

Hi Stephen,
Do you have a target date for v1.1?

We are hoping to release this week or early next week.

Thank you Stephen, We are looking forward to it.