}
final Object volatilitySurfaceObject = inputs.getValue(ValueRequirementNames.STANDARD_VOLATILITY_SURFACE_DATA);
if (volatilitySurfaceObject == null) {
throw new OpenGammaRuntimeException("Could not get volatility surface data");
}
final SmileDeltaTermStructureParameters allSmiles = (SmileDeltaTermStructureParameters) volatilitySurfaceObject;
final double[] uniqueDeltas = allSmiles.getDelta();
final int putDeltaIndex = Arrays.binarySearch(uniqueDeltas, delta);
if (putDeltaIndex < 0) {
throw new OpenGammaRuntimeException("Could not get OTM smile for delta = " + delta);
}
final SmileDeltaParameters[] surface = new SmileDeltaParameters[allSmiles.getNumberExpiration()];
final int atmIndex = (allSmiles.getNumberStrike() - 1) / 2;
final double[] deltas = {delta };
for (int i = 0; i < allSmiles.getNumberExpiration(); i++) {
final SmileDeltaParameters parameters = allSmiles.getSmileForTime(i);
final double timeToExpiration = parameters.getTimeToExpiry();
final double[] volatilities = new double[3];
final double[] allVolatilities = parameters.getVolatility();
volatilities[0] = allVolatilities[putDeltaIndex];
volatilities[1] = allVolatilities[atmIndex];
volatilities[2] = allVolatilities[2 * atmIndex - putDeltaIndex];
surface[i] = new SmileDeltaParameters(timeToExpiration, deltas, volatilities);
}
final Interpolator1D interpolator = allSmiles.getTimeInterpolator();
final SmileDeltaTermStructureParameters resultSmiles = new SmileDeltaTermStructureParameters(surface, interpolator);
final Currency ccy1;
final Currency ccy2;
final Object spotObject = inputs.getValue(ValueRequirementNames.SPOT_RATE);
if (spotObject == null) {
throw new OpenGammaRuntimeException("Could not get spot requirement");