// future curve
final Object objectFuturePriceData = inputs.getValue(ValueRequirementNames.FUTURE_PRICE_CURVE_DATA);
if (objectFuturePriceData == null) {
throw new OpenGammaRuntimeException("Could not get futures price data");
}
final NodalDoublesCurve futurePriceData = (NodalDoublesCurve) objectFuturePriceData;
// surface
final String surfaceName = desiredValue.getConstraint(ValuePropertyNames.SURFACE);
final Object objectSurfaceData = inputs.getValue(ValueRequirementNames.STANDARD_VOLATILITY_SURFACE_DATA);
if (objectSurfaceData == null) {
throw new OpenGammaRuntimeException("Could not get volatility surface data");
}
@SuppressWarnings("unchecked")
final VolatilitySurfaceData<Double, Double> volatilitySurfaceData = (VolatilitySurfaceData<Double, Double>) objectSurfaceData;
//assumes that the sorting is first x, then y
if (volatilitySurfaceData.size() == 0) {
throw new OpenGammaRuntimeException("Interest rate future option volatility surface definition name=" + futurePriceData.getName() + " contains no data");
}
final SortedSet<Double> x = volatilitySurfaceData.getUniqueXValues();
final DoubleArrayList fittedOptionExpiryList = new DoubleArrayList();
final DoubleArrayList futureDelayList = new DoubleArrayList();
final DoubleArrayList kappaList = new DoubleArrayList();
final DoubleArrayList thetaList = new DoubleArrayList();
final DoubleArrayList vol0List = new DoubleArrayList();
final DoubleArrayList omegaList = new DoubleArrayList();
final DoubleArrayList rhoList = new DoubleArrayList();
final DoubleArrayList chiSqList = new DoubleArrayList();
final Map<DoublesPair, DoubleMatrix2D> inverseJacobians = new HashMap<DoublesPair, DoubleMatrix2D>();
for (final Double t : x) {
final List<ObjectsPair<Double, Double>> strip = volatilitySurfaceData.getYValuesForX(t);
final int n = strip.size();
final DoubleArrayList strikesList = new DoubleArrayList(n);
final DoubleArrayList sigmaList = new DoubleArrayList(n);
final DoubleArrayList errorsList = new DoubleArrayList(n);
final Double futurePrice = futurePriceData.getYValue(t);
if (strip.size() > 4 && futurePrice != null) {
final double forward = 1 - futurePrice / 100;
for (final ObjectsPair<Double, Double> value : strip) {
if (value.first != null && value.second != null) {
strikesList.add(1 - value.first / 100);