Package it.unimi.dsi.fastutil.doubles

Examples of it.unimi.dsi.fastutil.doubles.DoubleArrayList.toDoubleArray()


          } else {
            s_logger.info("Had a null value for tenor number " + j);
          }
        }
        riskReversals[i] = riskReversalList.toDoubleArray();
        strangle[i] = strangleList.toDoubleArray();
      }
    }
    final boolean isCallData = true; //TODO this shouldn't be hard-coded
    return new ForexSmileDeltaSurfaceDataBundle(forwardCurve, expiries, deltas, atms, riskReversals, strangle, isCallData);
  }
View Full Code Here


        } else {
          s_logger.error("Value was null when getting required input data " + factor.getExposureExternalId());
        }
      }
    }
    final StringLabelledMatrix1D labelledMatrix = new StringLabelledMatrix1D(indices.toArray(new String[] {}), labels.toArray(), values.toDoubleArray());
    final ValueSpecification valueSpecification = new ValueSpecification(EXTERNAL_SENSITIVITIES_REQUIREMENT, target.toSpecification(), createCurrencyValueProperties(target).get());
    return Collections.singleton(new ComputedValue(valueSpecification, labelledMatrix));
  }

  private List<FactorExposureData> decodeSensitivities(final SecuritySource secSource, final RawSecurity rawSecurity) {
View Full Code Here

          previousStrip = strip;
          nInstruments++;
        }
      }
      nodesPerCurve.put(curveName, nInstruments);
      curveNodes.put(curveName, nodeTimes.toDoubleArray());
      interpolators.put(curveName, interpolator);
    }
    final YieldCurveBundle knownCurves = getKnownCurves(curveCalculationConfig, targetSpec, inputs);
    final double absoluteTolerance = Double.parseDouble(absoluteToleranceName);
    final double relativeTolerance = Double.parseDouble(relativeToleranceName);
View Full Code Here

        .with(InterpolatedDataProperties.RIGHT_X_EXTRAPOLATOR_NAME, rightExtrapolatorName);
    if (shifts != null) {
      resultProperties.with(VolatilitySurfaceShiftFunction.SHIFT, shifts);
    }
    final Interpolator1D interpolator = CombinedInterpolatorExtrapolatorFactory.getInterpolator(interpolatorName, leftExtrapolatorName, rightExtrapolatorName);
    final DoublesCurve volatility = InterpolatedDoublesCurve.fromSorted(timesList.toDoubleArray(), volsList.toDoubleArray(), interpolator);
    final BlackForexTermStructureParameters termStructure = new BlackForexTermStructureParameters(volatility);
    return Collections.singleton(new ComputedValue(new ValueSpecification(ValueRequirementNames.STANDARD_VOLATILITY_SURFACE_DATA, target.toSpecification(),
        resultProperties.get()), termStructure));
  }
View Full Code Here

          }
        }
        if (!strikesList.isEmpty()) {
          final double[] strikes = strikesList.toDoubleArray();
          final double[] sigma = sigmaList.toDoubleArray();
          final double[] errors = errorsList.toDoubleArray();
          ArrayUtils.reverse(strikes);
          ArrayUtils.reverse(sigma);
          ArrayUtils.reverse(errors);
          final LeastSquareResultsWithTransform fittedResult = new HestonModelFitter(forward, strikes, t, sigma, errors, HESTON_FUNCTION).solve(HESTON_INITIAL_VALUES);
          final DoubleMatrix1D parameters = fittedResult.getModelParameters();
View Full Code Here

      tList.add(DateUtils.getDifferenceInYears(now, now.plus(tenor.getPeriod())));
      fxList.add(fxForward);
    }
    final Interpolator1D interpolator = CombinedInterpolatorExtrapolatorFactory.getInterpolator(Interpolator1DFactory.LINEAR,
        Interpolator1DFactory.LINEAR_EXTRAPOLATOR, Interpolator1DFactory.LINEAR_EXTRAPOLATOR);
    return InterpolatedDoublesCurve.from(tList.toDoubleArray(), fxList.toDoubleArray(), interpolator);
  }

}
View Full Code Here

            volatility.add((Double) volatilityObject);
            volatilityTime.add(t);
          }
        }
        final HullWhiteOneFactorPiecewiseConstantParameters hullWhiteParameters = new HullWhiteOneFactorPiecewiseConstantParameters(meanReversion, volatility.toDoubleArray(),
            volatilityTime.toDoubleArray());
        return Collections.singleton(new ComputedValue(result, hullWhiteParameters));
      }

      @Override
      public ComputationTargetType getTargetType() {
View Full Code Here

      throw new OpenGammaRuntimeException("Could not get any data for " + volatilityDataRequirement);
    }
    final Interpolator1D xInterpolator = CombinedInterpolatorExtrapolatorFactory.getInterpolator(xInterpolatorName, leftXExtrapolatorName, rightXExtrapolatorName);
    final Interpolator1D yInterpolator = CombinedInterpolatorExtrapolatorFactory.getInterpolator(yInterpolatorName, leftYExtrapolatorName, rightYExtrapolatorName);
    final GridInterpolator2D interpolator = new GridInterpolator2D(xInterpolator, yInterpolator);
    final Surface<Double, Double, Double> surface = InterpolatedDoublesSurface.from(x.toDoubleArray(), y.toDoubleArray(), sigma.toDoubleArray(), interpolator);
    final VolatilitySurface volatilitySurface = new VolatilitySurface(surface);
    final ValueProperties properties = getResultProperties(surfaceName, instrumentType, leftXExtrapolatorName, rightXExtrapolatorName, xInterpolatorName, leftYExtrapolatorName,
        rightYExtrapolatorName, yInterpolatorName);
    final ValueSpecification spec = new ValueSpecification(ValueRequirementNames.INTERPOLATED_VOLATILITY_SURFACE, target.toSpecification(), properties);
    return Collections.singleton(new ComputedValue(spec, volatilitySurface));
View Full Code Here

          }
        }
        if (!strikesList.isEmpty()) {
          final double[] strikes = strikesList.toDoubleArray();
          final double[] sigma = sigmaList.toDoubleArray();
          final double[] errors = errorsList.toDoubleArray();
          ArrayUtils.reverse(strikes);
          ArrayUtils.reverse(sigma);
          ArrayUtils.reverse(errors);
          final LeastSquareResultsWithTransform fittedResult = new HestonModelFitter(forward, strikes, t, sigma, errors, HESTON_FUNCTION).solve(HESTON_INITIAL_VALUES);
          final DoubleMatrix1D parameters = fittedResult.getModelParameters();
View Full Code Here

              errors.add(error);
              fittedPointsForStrip.add(value.first);
            }
          }
          if (blackVols.size() > 4) {
            final LeastSquareResultsWithTransform fittedResult = new SABRModelFitter(forward, strikes.toDoubleArray(), ttm.doubleValue(), blackVols.toDoubleArray(),
                errors.toDoubleArray(), SABR_FUNCTION).solve(sabrInitialValues, fixed);
            final DoubleMatrix1D parameters = fittedResult.getModelParameters();
            fittedOptionExpiryList.add(ttm.doubleValue());
            futureDelayList.add(0);
            alphaList.add(parameters.getEntry(0));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.