Examples of ConfigDBCurveCalculationConfigSource


Examples of com.opengamma.financial.analytics.ircurve.calcconfig.ConfigDBCurveCalculationConfigSource

    final Object curveSpecObject = inputs.getValue(ValueRequirementNames.YIELD_CURVE_SPEC);
    if (curveSpecObject == null) {
      throw new OpenGammaRuntimeException("Could not get yield curve spec");
    }
    final ConfigSource configSource = OpenGammaExecutionContext.getConfigSource(executionContext);
    final ConfigDBCurveCalculationConfigSource curveCalculationConfigSource = new ConfigDBCurveCalculationConfigSource(configSource);
    final MultiCurveCalculationConfig resultCurveCalculationConfig = curveCalculationConfigSource.getConfig(resultCurveConfigName);
    final String calculationMethod = resultCurveCalculationConfig.getCalculationMethod();
    final String fullCurveName = curveName + "_" + curveCurrency;
    final InterpolatedYieldCurveSpecificationWithSecurities curveSpec = (InterpolatedYieldCurveSpecificationWithSecurities) curveSpecObject;
    final MultipleCurrencyInterestRateCurveSensitivity curveSensitivities = (MultipleCurrencyInterestRateCurveSensitivity) curveSensitivitiesObject;
    final Map<String, List<DoublesPair>> sensitivitiesForCurrency = curveSensitivities.getSensitivity(Currency.of(curveCurrency)).getSensitivities();
View Full Code Here

Examples of com.opengamma.financial.analytics.ircurve.calcconfig.ConfigDBCurveCalculationConfigSource

      resultCurveConfigName = callCurveCalculationConfigName;
    } else {
      return null;
    }
    final ConfigSource configSource = OpenGammaCompilationContext.getConfigSource(context);
    final ConfigDBCurveCalculationConfigSource curveCalculationConfigSource = new ConfigDBCurveCalculationConfigSource(configSource);
    final MultiCurveCalculationConfig resultCurveCalculationConfig = curveCalculationConfigSource.getConfig(resultCurveConfigName);
    if (resultCurveCalculationConfig == null) {
      s_logger.error("Could not find curve calculation configuration named " + resultCurveConfigName + " for currency " + resultCurrency);
      return null;
    }
    final String resultCurveCalculationMethod = resultCurveCalculationConfig.getCalculationMethod();
View Full Code Here

Examples of com.opengamma.financial.analytics.ircurve.calcconfig.ConfigDBCurveCalculationConfigSource

    final ZonedDateTime now = ZonedDateTime.now(snapshotClock);
    final HistoricalTimeSeriesBundle timeSeries = HistoricalTimeSeriesFunctionUtils.getHistoricalTimeSeriesInputs(executionContext, inputs);
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    //TODO won't need to call into database again when calculation configurations are a requirement
    final ConfigSource configSource = OpenGammaExecutionContext.getConfigSource(executionContext);
    final ConfigDBCurveCalculationConfigSource curveCalculationConfigSource = new ConfigDBCurveCalculationConfigSource(configSource);
    final String payCurveCalculationConfigName = desiredValue.getConstraint(ValuePropertyNames.PAY_CURVE_CALCULATION_CONFIG);
    final MultiCurveCalculationConfig payCurveCalculationConfig = curveCalculationConfigSource.getConfig(payCurveCalculationConfigName);
    if (payCurveCalculationConfig == null) {
      throw new OpenGammaRuntimeException("Could not find curve calculation configuration named " + payCurveCalculationConfigName);
    }
    final String receiveCurveCalculationConfigName = desiredValue.getConstraint(ValuePropertyNames.RECEIVE_CURVE_CALCULATION_CONFIG);
    final MultiCurveCalculationConfig receiveCurveCalculationConfig = curveCalculationConfigSource.getConfig(receiveCurveCalculationConfigName);
    if (receiveCurveCalculationConfig == null) {
      throw new OpenGammaRuntimeException("Could not find curve calculation configuration named " + receiveCurveCalculationConfigName);
    }
    final InstrumentDefinition<?> definition = security.accept(_visitor);
    if (definition == null) {
View Full Code Here

Examples of com.opengamma.financial.analytics.ircurve.calcconfig.ConfigDBCurveCalculationConfigSource

    }
    final String payCurveCalculationConfigName = Iterables.getOnlyElement(payCurveCalculationConfigs);
    final String receiveCurveCalculationConfigName = Iterables.getOnlyElement(receiveCurveCalculationConfigs);
    final ConfigSource configSource = OpenGammaCompilationContext.getConfigSource(context);
    final SecuritySource securitySource = OpenGammaCompilationContext.getSecuritySource(context);
    final ConfigDBCurveCalculationConfigSource curveCalculationConfigSource = new ConfigDBCurveCalculationConfigSource(configSource);
    final MultiCurveCalculationConfig payCurveCalculationConfig = curveCalculationConfigSource.getConfig(payCurveCalculationConfigName);
    if (payCurveCalculationConfig == null) {
      s_logger.info("Could not find curve calculation configuration named " + payCurveCalculationConfigName);
      return null;
    }
    final MultiCurveCalculationConfig receiveCurveCalculationConfig = curveCalculationConfigSource.getConfig(receiveCurveCalculationConfigName);
    if (receiveCurveCalculationConfig == null) {
      s_logger.info("Could not find curve calculation configuration named " + receiveCurveCalculationConfigName);
      return null;
    }
    final FinancialSecurity security = (FinancialSecurity) target.getSecurity();
View Full Code Here

Examples of com.opengamma.financial.analytics.ircurve.calcconfig.ConfigDBCurveCalculationConfigSource

    if (curveCalculationConfigNames == null || curveCalculationConfigNames.size() != 1) {
      return null;
    }
    final String domesticCurveCalculationConfigName = curveCalculationConfigNames.iterator().next();
    final ConfigSource configSource = OpenGammaCompilationContext.getConfigSource(context);
    final ConfigDBCurveCalculationConfigSource curveCalculationConfigSource = new ConfigDBCurveCalculationConfigSource(configSource);
    final MultiCurveCalculationConfig domesticCurveCalculationConfig = curveCalculationConfigSource.getConfig(domesticCurveCalculationConfigName);
    if (domesticCurveCalculationConfig == null) {
      s_logger.error("Could not get domestic curve calculation config called {}", domesticCurveCalculationConfigName);
      return null;
    }
    if (domesticCurveCalculationConfig.getExogenousConfigData() == null) {
      s_logger.error("Need an externally-supplied curve to imply data; tried {}", domesticCurveCalculationConfigName);
      return null;
    }
    if (domesticCurveCalculationConfig.getYieldCurveNames().length != 1) {
      s_logger.error("Can only handle one curve at the moment");
      return null;
    }
    if (!domesticCurveCalculationConfig.getTarget().equals(target.toSpecification())) {
      s_logger.info("Invalid target, was {} - expected {}", target, domesticCurveCalculationConfig.getTarget());
      return null;
    }
    final Map<String, String[]> exogenousConfigs = domesticCurveCalculationConfig.getExogenousConfigData();
    if (exogenousConfigs.size() != 1) {
      s_logger.error("Can only handle curves with one foreign curve config");
      return null;
    }
    if (!domesticCurveCalculationConfig.getCalculationMethod().equals(FX_IMPLIED)) {
      return null;
    }
    ValueProperties.Builder seriesConstraints = null;
    Set<String> values = desiredValue.getConstraints().getValues(DATA_FIELD_PROPERTY);
    if ((values == null) || values.isEmpty()) {
      seriesConstraints = desiredValue.getConstraints().copy().with(DATA_FIELD_PROPERTY, MarketDataRequirementNames.MARKET_VALUE);
    } else if (values.size() > 1) {
      seriesConstraints = desiredValue.getConstraints().copy().withoutAny(DATA_FIELD_PROPERTY)
          .with(DATA_FIELD_PROPERTY, values.iterator().next());
    }
    values = desiredValue.getConstraints().getValues(RESOLUTION_KEY_PROPERTY);
    if ((values == null) || values.isEmpty()) {
      if (seriesConstraints == null) {
        seriesConstraints = desiredValue.getConstraints().copy();
      }
      seriesConstraints.with(RESOLUTION_KEY_PROPERTY, "");
    } else if (values.size() > 1) {
      if (seriesConstraints == null) {
        seriesConstraints = desiredValue.getConstraints().copy();
      }
      seriesConstraints.withoutAny(RESOLUTION_KEY_PROPERTY).with(RESOLUTION_KEY_PROPERTY, values.iterator().next());
    }
    values = desiredValue.getConstraints().getValues(START_DATE_PROPERTY);
    if ((values == null) || values.isEmpty()) {
      if (seriesConstraints == null) {
        seriesConstraints = desiredValue.getConstraints().copy();
      }
      seriesConstraints.with(START_DATE_PROPERTY, "Null");
    }
    values = desiredValue.getConstraints().getValues(INCLUDE_START_PROPERTY);
    if ((values == null) || (values.size() != 1)) {
      if (seriesConstraints == null) {
        seriesConstraints = desiredValue.getConstraints().copy();
      }
      seriesConstraints.with(INCLUDE_START_PROPERTY, YES_VALUE);
    }
    values = desiredValue.getConstraints().getValues(END_DATE_PROPERTY);
    if ((values == null) || values.isEmpty()) {
      if (seriesConstraints == null) {
        seriesConstraints = desiredValue.getConstraints().copy();
      }
      seriesConstraints.with(END_DATE_PROPERTY, "Now");
    }
    values = desiredValue.getConstraints().getValues(INCLUDE_END_PROPERTY);
    if ((values == null) || (values.size() != 1)) {
      if (seriesConstraints == null) {
        seriesConstraints = desiredValue.getConstraints().copy();
      }
      seriesConstraints.with(INCLUDE_END_PROPERTY, YES_VALUE);
    }
    if (seriesConstraints != null) {
      Set<String> propertyValue = constraints.getValues(PROPERTY_ROOT_FINDER_ABSOLUTE_TOLERANCE);
      if (propertyValue == null) {
        seriesConstraints.withAny(PROPERTY_ROOT_FINDER_ABSOLUTE_TOLERANCE);
      } else {
        seriesConstraints.with(PROPERTY_ROOT_FINDER_ABSOLUTE_TOLERANCE, propertyValue);
      }
      propertyValue = constraints.getValues(PROPERTY_ROOT_FINDER_RELATIVE_TOLERANCE);
      if (propertyValue == null) {
        seriesConstraints.withAny(PROPERTY_ROOT_FINDER_RELATIVE_TOLERANCE);
      } else {
        seriesConstraints.with(PROPERTY_ROOT_FINDER_RELATIVE_TOLERANCE, propertyValue);
      }
      propertyValue = constraints.getValues(PROPERTY_ROOT_FINDER_MAX_ITERATIONS);
      if (propertyValue == null) {
        seriesConstraints.withAny(PROPERTY_ROOT_FINDER_MAX_ITERATIONS);
      } else {
        seriesConstraints.with(PROPERTY_ROOT_FINDER_MAX_ITERATIONS, propertyValue);
      }
      propertyValue = constraints.getValues(PROPERTY_DECOMPOSITION);
      if (propertyValue == null) {
        seriesConstraints.withAny(PROPERTY_DECOMPOSITION);
      } else {
        seriesConstraints.with(PROPERTY_DECOMPOSITION, propertyValue);
      }
      propertyValue = constraints.getValues(PROPERTY_USE_FINITE_DIFFERENCE);
      if (propertyValue == null) {
        seriesConstraints.withAny(PROPERTY_USE_FINITE_DIFFERENCE);
      } else {
        seriesConstraints.with(PROPERTY_USE_FINITE_DIFFERENCE, propertyValue);
      }
      propertyValue = constraints.getValues(X_INTERPOLATOR_NAME);
      if (propertyValue == null) {
        seriesConstraints.withAny(X_INTERPOLATOR_NAME);
      } else {
        seriesConstraints.with(X_INTERPOLATOR_NAME, propertyValue);
      }
      propertyValue = constraints.getValues(LEFT_X_EXTRAPOLATOR_NAME);
      if (propertyValue == null) {
        seriesConstraints.withAny(LEFT_X_EXTRAPOLATOR_NAME);
      } else {
        seriesConstraints.with(LEFT_X_EXTRAPOLATOR_NAME, propertyValue);
      }
      propertyValue = constraints.getValues(RIGHT_X_EXTRAPOLATOR_NAME);
      if (propertyValue == null) {
        seriesConstraints.withAny(RIGHT_X_EXTRAPOLATOR_NAME);
      } else {
        seriesConstraints.with(RIGHT_X_EXTRAPOLATOR_NAME, propertyValue);
      }
      return Collections.singleton(new ValueRequirement(YIELD_CURVE_SERIES, target.toSpecification(), seriesConstraints.get()));
    }
    final Set<String> rootFinderAbsoluteTolerance = constraints.getValues(PROPERTY_ROOT_FINDER_ABSOLUTE_TOLERANCE);
    if (rootFinderAbsoluteTolerance == null || rootFinderAbsoluteTolerance.size() != 1) {
      return null;
    }
    final Set<String> rootFinderRelativeTolerance = constraints.getValues(PROPERTY_ROOT_FINDER_RELATIVE_TOLERANCE);
    if (rootFinderRelativeTolerance == null || rootFinderRelativeTolerance.size() != 1) {
      return null;
    }
    final Set<String> maxIterations = constraints.getValues(PROPERTY_ROOT_FINDER_MAX_ITERATIONS);
    if (maxIterations == null || maxIterations.size() != 1) {
      return null;
    }
    final Set<String> decomposition = constraints.getValues(PROPERTY_DECOMPOSITION);
    if (decomposition == null || decomposition.size() != 1) {
      return null;
    }
    final Set<String> useFiniteDifference = constraints.getValues(PROPERTY_USE_FINITE_DIFFERENCE);
    if (useFiniteDifference == null || useFiniteDifference.size() != 1) {
      return null;
    }
    final Set<String> interpolatorName = constraints.getValues(X_INTERPOLATOR_NAME);
    if (interpolatorName == null || interpolatorName.size() != 1) {
      return null;
    }
    final Set<String> leftExtrapolatorName = constraints.getValues(LEFT_X_EXTRAPOLATOR_NAME);
    if (leftExtrapolatorName == null || leftExtrapolatorName.size() != 1) {
      return null;
    }
    final Set<String> rightExtrapolatorName = constraints.getValues(RIGHT_X_EXTRAPOLATOR_NAME);
    if (rightExtrapolatorName == null || rightExtrapolatorName.size() != 1) {
      return null;
    }
    final ConfigDBFXForwardCurveDefinitionSource fxCurveDefinitionSource = new ConfigDBFXForwardCurveDefinitionSource(configSource);
    final ConfigDBFXForwardCurveSpecificationSource fxCurveSpecificationSource = new ConfigDBFXForwardCurveSpecificationSource(configSource);
    final Map.Entry<String, String[]> foreignCurveConfigNames = exogenousConfigs.entrySet().iterator().next();
    final MultiCurveCalculationConfig foreignConfig = curveCalculationConfigSource.getConfig(foreignCurveConfigNames.getKey());
    if (foreignConfig == null) {
      s_logger.error("Foreign config was null; tried {}", foreignCurveConfigNames.getKey());
      return null;
    }
    final ComputationTargetSpecification foreignCurrencySpec = foreignConfig.getTarget();
View Full Code Here

Examples of com.opengamma.financial.analytics.ircurve.calcconfig.ConfigDBCurveCalculationConfigSource

      resultCurveConfigName = callCurveCalculationConfigName;
    } else {
      return null;
    }
    final ConfigSource configSource = OpenGammaCompilationContext.getConfigSource(context);
    final ConfigDBCurveCalculationConfigSource curveCalculationConfigSource = new ConfigDBCurveCalculationConfigSource(configSource);
    final MultiCurveCalculationConfig resultCurveCalculationConfig = curveCalculationConfigSource.getConfig(resultCurveConfigName);
    if (resultCurveCalculationConfig == null) {
      s_logger.error("Could not find curve calculation configuration named " + resultCurveConfigName + " for currency " + resultCurrency);
      return null;
    }
    requirements.add(getCurveSensitivitiesRequirement(putCurveName, putCurveCalculationConfigName, callCurveName, callCurveCalculationConfigName, surfaceName,
View Full Code Here

Examples of com.opengamma.financial.analytics.ircurve.calcconfig.ConfigDBCurveCalculationConfigSource

    }
    final SecuritySource securitySource = OpenGammaExecutionContext.getSecuritySource(executionContext);
    final Clock snapshotClock = executionContext.getValuationClock();
    final ZonedDateTime now = ZonedDateTime.now(snapshotClock);
    final ConfigSource configSource = OpenGammaExecutionContext.getConfigSource(executionContext);
    final ConfigDBCurveCalculationConfigSource curveCalculationConfigSource = new ConfigDBCurveCalculationConfigSource(configSource);
    final MultiCurveCalculationConfig curveCalculationConfig = curveCalculationConfigSource.getConfig(curveCalculationConfigName);
    if (curveCalculationConfig == null) {
      throw new OpenGammaRuntimeException("Could not find curve calculation configuration named " + curveCalculationConfigName);
    }
    final String[] curveNames = curveCalculationConfig.getYieldCurveNames(); //TODO
    final YieldCurveBundle curves = YieldCurveFunctionUtils.getYieldCurves(inputs, curveCalculationConfig);
View Full Code Here

Examples of com.opengamma.financial.analytics.ircurve.calcconfig.ConfigDBCurveCalculationConfigSource

    if (curveCalculationConfigNames == null || curveCalculationConfigNames.size() != 1) {
      return null;
    }
    final String curveCalculationConfigName = curveCalculationConfigNames.iterator().next();
    final ConfigSource configSource = OpenGammaCompilationContext.getConfigSource(context);
    final ConfigDBCurveCalculationConfigSource curveCalculationConfigSource = new ConfigDBCurveCalculationConfigSource(configSource);
    final MultiCurveCalculationConfig curveCalculationConfig = curveCalculationConfigSource.getConfig(curveCalculationConfigName);
    if (curveCalculationConfig == null) {
      s_logger.error("Could not find curve calculation configuration named " + curveCalculationConfigName);
      return null;
    }
    final Currency currency = FinancialSecurityUtils.getCurrency(target.getSecurity());
View Full Code Here

Examples of com.opengamma.financial.analytics.ircurve.calcconfig.ConfigDBCurveCalculationConfigSource

    final ZonedDateTime now = ZonedDateTime.now(snapshotClock);
    final HistoricalTimeSeriesBundle timeSeries = HistoricalTimeSeriesFunctionUtils.getHistoricalTimeSeriesInputs(executionContext, inputs);
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final String curveCalculationConfigName = desiredValue.getConstraint(ValuePropertyNames.CURVE_CALCULATION_CONFIG);
    final ConfigSource configSource = OpenGammaExecutionContext.getConfigSource(executionContext);
    final ConfigDBCurveCalculationConfigSource curveCalculationConfigSource = new ConfigDBCurveCalculationConfigSource(configSource);
    final MultiCurveCalculationConfig curveCalculationConfig = curveCalculationConfigSource.getConfig(curveCalculationConfigName);
    if (curveCalculationConfig == null) {
      throw new OpenGammaRuntimeException("Could not find curve calculation configuration named " + curveCalculationConfigName);
    }
    final String[] curveNames = curveCalculationConfig.getYieldCurveNames();
    final int numCurveNames = curveNames.length;
View Full Code Here

Examples of com.opengamma.financial.analytics.ircurve.calcconfig.ConfigDBCurveCalculationConfigSource

    if (curveCalculationConfigNames == null || curveCalculationConfigNames.size() != 1) {
      return null;
    }
    final String curveCalculationConfigName = curveCalculationConfigNames.iterator().next();
    final ConfigSource configSource = OpenGammaCompilationContext.getConfigSource(context);
    final ConfigDBCurveCalculationConfigSource curveCalculationConfigSource = new ConfigDBCurveCalculationConfigSource(configSource);
    final MultiCurveCalculationConfig curveCalculationConfig = curveCalculationConfigSource.getConfig(curveCalculationConfigName);
    if (curveCalculationConfig == null) {
      s_logger.debug("Could not find curve calculation configuration named {}", curveCalculationConfigName);
      return null;
    }
    final FinancialSecurity security = (FinancialSecurity) target.getSecurity();
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.