@Override public DistinctMarketDataSelector findMatchingSelector( ValueSpecification valueSpecification, String calculationConfigurationName, SelectorResolver resolver) { if (_calcConfigNames != null && !_calcConfigNames.contains(calculationConfigurationName)) { return null; } if (!s_compatibleVRNames.contains(valueSpecification.getValueName())) { return null; } VolatilitySurfaceKey key = createKey(valueSpecification); if (!contains(_names, key.getName())) { return null; } if (_nameMatchPattern != null && !_nameMatchPattern.getPattern().matcher(key.getName()).matches()) { return null; } if (_nameLikePattern != null && !_nameLikePattern.getPattern().matcher(key.getName()).matches()) { return null; } if (!contains(_instrumentTypes, key.getInstrumentType())) { return null; } if (!contains(_quoteTypes, key.getQuoteType())) { return null; } if (!contains(_quoteUnits, key.getQuoteUnits())) { return null; } return this; }
private static VolatilitySurfaceKey createKey(ValueSpecification valueSpecification) { UniqueId uniqueId = valueSpecification.getTargetSpecification().getUniqueId(); String surface = valueSpecification.getProperties().getStrictValue(ValuePropertyNames.SURFACE); String instrumentType = valueSpecification.getProperties().getStrictValue("InstrumentType"); String quoteType = valueSpecification .getProperties() .getStrictValue(SurfaceAndCubePropertyNames.PROPERTY_SURFACE_QUOTE_TYPE); String quoteUnits = valueSpecification .getProperties() .getStrictValue(SurfaceAndCubePropertyNames.PROPERTY_SURFACE_UNITS); return VolatilitySurfaceKey.of(uniqueId, surface, instrumentType, quoteType, quoteUnits); }