final HistoricalTimeSeriesBundle bundleForCurve = (HistoricalTimeSeriesBundle) inputs.getValue(bundleRequirement);
final CurveSpecification curveSpec = (CurveSpecification) inputs.getValue(specRequirement);
for (final CurveNodeWithIdentifier node : curveSpec.getNodes()) {
String dataField = node.getDataField();
ExternalIdBundle ids = ExternalIdBundle.of(node.getIdentifier());
HistoricalTimeSeries ts = bundleForCurve.get(dataField, ids);
if (ts != null) {
bundle.add(dataField, ids, bundleForCurve.get(dataField, ids));
} else {
s_logger.info("Could not get historical time series for {}", ids);
}
if (node instanceof PointsCurveNodeWithIdentifier) {
final PointsCurveNodeWithIdentifier pointsNode = (PointsCurveNodeWithIdentifier) node;
dataField = pointsNode.getUnderlyingDataField();
ids = ExternalIdBundle.of(pointsNode.getUnderlyingIdentifier());
ts = bundleForCurve.get(dataField, ids);
if (ts != null) {
bundle.add(dataField, ids, bundleForCurve.get(dataField, ids));
} else {
s_logger.info("Could not get historical time series for {}", ids);
}
}
if (node.getCurveNode() instanceof ZeroCouponInflationNode) {
final ZeroCouponInflationNode inflationNode = (ZeroCouponInflationNode) node.getCurveNode();
final ConventionSource conventionSource = OpenGammaExecutionContext.getConventionSource(executionContext);
Convention convention = conventionSource.getConvention(inflationNode.getInflationLegConvention());
if (convention == null) {
throw new OpenGammaRuntimeException("Convention with id " + inflationNode.getInflationLegConvention() + " was null");
}
if (!(convention instanceof InflationLegConvention)) {
throw new OpenGammaRuntimeException("Cannot handle convention type " + convention.getClass());
}
final InflationLegConvention inflationLegConvention = (InflationLegConvention) convention;
convention = conventionSource.getConvention(inflationLegConvention.getPriceIndexConvention());
if (convention == null) {
throw new OpenGammaRuntimeException("Convention with id " + inflationLegConvention.getPriceIndexConvention() + " was null");
}
if (!(convention instanceof PriceIndexConvention)) {
throw new OpenGammaRuntimeException("Cannot handle convention type " + convention.getClass());
}
ids = ExternalIdBundle.of(((PriceIndexConvention) convention).getPriceIndexId());
final HistoricalTimeSeries priceIndexSeries = bundleForCurve.get(dataField, ids);
if (priceIndexSeries != null) {
if (priceIndexSeries.getTimeSeries().isEmpty()) {
s_logger.info("Could for get historical time series for {}", ids);
} else {
bundle.add(dataField, ids, bundleForCurve.get(dataField, ids));
}
} else {