private void checkStubForOvernightIndex(XmlElement baseEl, FpmlDocument document, OvernightIndex index) { document.validateNotPresent(baseEl, "stubAmount"); document.validateNotPresent(baseEl, "stubRate"); List<XmlElement> indicesEls = baseEl.getChildren("floatingRate"); if (indicesEls.size() == 1) { XmlElement indexEl = indicesEls.get(0); document.validateNotPresent(indexEl, "floatingRateMultiplierSchedule"); document.validateNotPresent(indexEl, "spreadSchedule"); document.validateNotPresent(indexEl, "rateTreatment"); document.validateNotPresent(indexEl, "capRateSchedule"); document.validateNotPresent(indexEl, "floorRateSchedule"); Index parsed = document.parseIndex(indexEl); if (parsed.equals(index)) { return; } throw new FpmlParseException("OvernightIndex swap cannot have a different index in the stub: " + baseEl); } throw new FpmlParseException("Unknown stub structure: " + baseEl); }
document.validateNotPresent(indexEl, "capRateSchedule"); document.validateNotPresent(indexEl, "floorRateSchedule"); return IborRateStubCalculation.ofIborRate((IborIndex) document.parseIndex(indexEl)); } else if (indicesEls.size() == 2) { XmlElement index1El = indicesEls.get(0); document.validateNotPresent(index2El, "floorRateSchedule"); return IborRateStubCalculation.ofIborInterpolatedRate( (IborIndex) document.parseIndex(index1El), (IborIndex) document.parseIndex(index2El));
document.validateNotPresent(floatingEl, "capRateSchedule"); document.validateNotPresent(floatingEl, "floorRateSchedule"); Index index = document.parseIndex(floatingEl); if (index instanceof IborIndex) { IborRateCalculation.Builder iborRateBuilder = IborRateCalculation.builder(); iborRateBuilder.index((IborIndex) document.parseIndex(floatingEl)); overnightRateBuilder.index((OvernightIndex) document.parseIndex(floatingEl));