@Override public CurrencyParameterSensitivities parameterSensitivity(OvernightRateSensitivity pointSensitivity) { throw new MarketDataNotFoundException("Unable to create sensitivity for historic index " + index); }
@Override public PointSensitivityBuilder periodRatePointSensitivity( OvernightIndexObservation startDateObservation, LocalDate endDate) { throw new MarketDataNotFoundException("Unable to query forward rate sensitivity for historic index " + index); }
@Override public CurrencyParameterSensitivities parameterSensitivity(InflationRateSensitivity pointSensitivity) { throw new MarketDataNotFoundException("Unable to create sensitivity for historic index " + index); }
@Override public CurrencyParameterSensitivities parameterSensitivity(IborRateSensitivity pointSensitivity) { throw new MarketDataNotFoundException("Unable to create sensitivity for historic index " + index); }
@Override public double rateIgnoringFixings(OvernightIndexObservation observation) { throw new MarketDataNotFoundException("Unable to query forward rate for historic index " + index); }
@Override public PointSensitivityBuilder rateIgnoringFixingsPointSensitivity(OvernightIndexObservation observation) { throw new MarketDataNotFoundException("Unable to query forward rate sensitivity for historic index " + index); }
@Override public double periodRate(OvernightIndexObservation startDateObservation, LocalDate endDate) { throw new MarketDataNotFoundException("Unable to query forward rate for historic index " + index); }
@Override public CurrencyParameterSensitivities createParameterSensitivity(Currency currency, DoubleArray sensitivities) { throw new MarketDataNotFoundException("Unable to create sensitivity for historic index " + index); }
@Override public double rateIgnoringFixings(IborIndexObservation observation) { throw new MarketDataNotFoundException("Unable to query forward rate for historic index " + index); }
@Override public PointSensitivityBuilder rateIgnoringFixingsPointSensitivity(IborIndexObservation observation) { throw new MarketDataNotFoundException("Unable to query forward rate sensitivity for historic index " + index); }
@Override public CurrencyParameterSensitivities createParameterSensitivity(Currency currency, DoubleArray sensitivities) { throw new MarketDataNotFoundException("Unable to create sensitivity for historic index " + index); }
@Override public CurrencyParameterSensitivities createParameterSensitivity(Currency currency, DoubleArray sensitivities) { throw new MarketDataNotFoundException("Unable to create sensitivity for historic index " + index); }
@SuppressWarnings("unchecked") @Override public <T> T getValue(MarketDataId<T> id) { // overridden for performance // no type check against id.getMarketDataType() as checked in factory @SuppressWarnings("unchecked") T value = (T) values.get(id); if (value == null) { throw new MarketDataNotFoundException(msgValueNotFound(id)); } return value; }
@SuppressWarnings("unchecked") @Override public <T> MarketDataBox<T> getValue(MarketDataId<T> id) { // overridden for performance // no type check against id.getMarketDataType() as checked in factory @SuppressWarnings("unchecked") MarketDataBox<T> value = (MarketDataBox<T>) values.get(id); if (value == null) { throw new MarketDataNotFoundException(msgValueNotFound(id)); } return value; }
/** * Gets the market data value associated with the specified identifier. * <p> * If this market data instance contains the identifier, the value will be returned. * Otherwise, an exception will be thrown. * * @param <T> the type of the market data value * @param id the identifier to find * @return the market data value * @throws MarketDataNotFoundException if the identifier is not found */ public default <T> T getValue(MarketDataId<T> id) { return findValue(id) .orElseThrow(() -> new MarketDataNotFoundException(Messages.format( "Market data not found for '{}' of type '{}'", id, id.getClass().getSimpleName()))); }
/** * Gets the market data value associated with the specified identifier. * <p> * The result is a box that provides data for all scenarios. * If this market data instance contains the identifier, the value will be returned. * Otherwise, an exception will be thrown. * * @param <T> the type of the market data value * @param id the identifier to find * @return the market data value box providing data for all scenarios * @throws MarketDataNotFoundException if the identifier is not found */ public default <T> MarketDataBox<T> getValue(MarketDataId<T> id) { return findValue(id) .orElseThrow(() -> new MarketDataNotFoundException(Messages.format( "Market data not found for '{}' of type '{}'", id, id.getClass().getSimpleName()))); }
@Override public double value(PriceIndexObservation observation) { YearMonth fixingMonth = observation.getFixingMonth(); // If fixing in the past, check time series and returns the historic month price index if present if (fixingMonth.isBefore(YearMonth.from(valuationDate))) { OptionalDouble fixing = fixings.get(fixingMonth.atEndOfMonth()); if (fixing.isPresent()) { return fixing.getAsDouble(); } } throw new MarketDataNotFoundException("Unable to query forward value for historic index " + index); }
@Override public PointSensitivityBuilder valuePointSensitivity(PriceIndexObservation observation) { YearMonth fixingMonth = observation.getFixingMonth(); // If fixing in the past, check time series and returns the historic month price index if present if (fixingMonth.isBefore(YearMonth.from(valuationDate))) { if (fixings.get(fixingMonth.atEndOfMonth()).isPresent()) { return PointSensitivityBuilder.none(); } } throw new MarketDataNotFoundException("Unable to query forward value sensitivity for historic index " + index); }
throw new MarketDataNotFoundException(Messages.format( "No FX rate market data for {}/{}", baseCurrency, counterCurrency)); throw new MarketDataNotFoundException(Messages.format( "No FX rate market data for {}/{} using source '{}'", baseCurrency, counterCurrency, fxRatesSource));
@Override public PointSensitivityBuilder ratePointSensitivity(OvernightIndexObservation observation) { LocalDate fixingDate = observation.getFixingDate(); LocalDate valuationDate = getValuationDate(); if (fixingDate.isBefore(valuationDate) || (fixingDate.equals(valuationDate) && fixings.get(fixingDate).isPresent())) { return PointSensitivityBuilder.none(); } throw new MarketDataNotFoundException("Unable to query forward rate sensitivity for historic index " + index); }