erezc
July 18, 2016, 1:45pm
1
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?
erezc
July 18, 2016, 2:56pm
3
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());
erezc
July 19, 2016, 5:48am
5
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);
}
}
erezc
July 20, 2016, 6:09am
6
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>
erezc
July 20, 2016, 2:52pm
7
It should be rounded up. However, it is rounded down.
erezc
July 24, 2016, 4:24am
9
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.
erezc
July 25, 2016, 2:19pm
11
Thank you Stephen,
I would be happy to know when the version is released.
erezc
September 14, 2016, 2:12pm
12
Hi Stephen,
Do you have a target date for v1.1?
stephen
September 27, 2016, 9:06am
13
We are hoping to release this week or early next week.
erezc
September 27, 2016, 11:40am
14
Thank you Stephen, We are looking forward to it.