Examples of HullWhiteOneFactorParameters


Examples of com.opengamma.financial.analytics.parameters.HullWhiteOneFactorParameters

    for (int i = 0; i < n; i++) {
      final Tenor tenor = Tenor.of(Period.parse((String) tenors.get(i).getValue()));
      final ExternalId volatilityParameterId = deserializer.fieldValueToObject(ExternalId.class, volatilityParameterIds.get(i));
      volatilityTermStructure.put(tenor, volatilityParameterId);
    }
    final HullWhiteOneFactorParameters parameters = new HullWhiteOneFactorParameters(currency, meanReversionId, initialVolatilityId,
        volatilityTermStructure);
    parameters.setUniqueId(uniqueId);
    return parameters;
  }
View Full Code Here

Examples of com.opengamma.financial.analytics.parameters.HullWhiteOneFactorParameters

    final ExternalId initialVolatilityId = ExternalId.of("Test", "IV");
    final SortedMap<Tenor, ExternalId> volatilityParameterIds = new TreeMap<>();
    for (int i = 1; i < 10; i++) {
      volatilityParameterIds.put(Tenor.ofMonths(i), ExternalId.of("Test", "V" + i));
    }
    final HullWhiteOneFactorParameters object = new HullWhiteOneFactorParameters(currency, meanReversionId, initialVolatilityId, volatilityParameterIds);
    object.setUniqueId(UniqueId.of("Test", "123"));
    assertEquals(object, cycleObject(HullWhiteOneFactorParameters.class, object));
  }
View Full Code Here

Examples of com.opengamma.financial.analytics.parameters.HullWhiteOneFactorParameters

    protected void addAllConfigurations(final List<FunctionConfiguration> functions) {
      final ConfigSearchRequest<HullWhiteOneFactorParameters> hwSearchRequest = new ConfigSearchRequest<>();
      hwSearchRequest.setType(HullWhiteOneFactorParameters.class);
      for (final ConfigDocument configDocument : ConfigSearchIterator.iterable(getConfigMaster(), hwSearchRequest)) {
        final String configurationName = configDocument.getName();
        final HullWhiteOneFactorParameters hullWhiteParameters = ((ConfigItem<HullWhiteOneFactorParameters>) configDocument.getConfig()).getValue();
        final Currency currency = hullWhiteParameters.getCurrency();
        functions.add(functionConfiguration(HullWhiteOneFactorParametersFunction.class, configurationName, currency.getCode()));
      }
      final ConfigSearchRequest<G2ppParameters> g2ppSearchRequest = new ConfigSearchRequest<>();
      g2ppSearchRequest.setType(G2ppParameters.class);
      for (final ConfigDocument configDocument : ConfigSearchIterator.iterable(getConfigMaster(), g2ppSearchRequest)) {
View Full Code Here

Examples of com.opengamma.financial.analytics.parameters.HullWhiteOneFactorParameters

    final ConfigSource configSource = OpenGammaCompilationContext.getConfigSource(context);
    final Collection<ConfigItem<HullWhiteOneFactorParameters>> configs = configSource.get(HullWhiteOneFactorParameters.class, _name, VersionCorrection.LATEST);
    if (configs == null) {
      throw new OpenGammaRuntimeException("HullWhiteOneFactorParameter configuration called " + _name + " was null");
    }
    final HullWhiteOneFactorParameters parameters = configs.iterator().next().getValue();
    requirements.add(new ValueRequirement(MarketDataRequirementNames.MARKET_VALUE, ComputationTargetType.PRIMITIVE, parameters.getMeanReversionId()));
    requirements.add(new ValueRequirement(MarketDataRequirementNames.MARKET_VALUE, ComputationTargetType.PRIMITIVE, parameters.getInitialVolatilityId()));
    final Map<Tenor, ExternalId> volatilityTermStructure = parameters.getVolatilityTermStructure();
    for (final Map.Entry<Tenor, ExternalId> entry : volatilityTermStructure.entrySet()) {
      final ExternalScheme scheme = entry.getValue().getScheme();
      final String id = entry.getValue().getValue();
      final ExternalId tenorAppendedId = ExternalId.of(scheme, createId(entry.getKey(), id));
      requirements.add(new ValueRequirement(MarketDataRequirementNames.MARKET_VALUE, ComputationTargetType.PRIMITIVE, tenorAppendedId));
    }
    final ZonedDateTime atZDT = ZonedDateTime.ofInstant(atInstant, ZoneOffset.UTC);
    return new AbstractInvokingCompiledFunction(atZDT.with(LocalTime.MIDNIGHT), atZDT.plusDays(1).with(LocalTime.MIDNIGHT).minusNanos(1000000)) {

      @Override
      public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target,
          final Set<ValueRequirement> desiredValues) throws AsynchronousExecution {
        final Clock snapshotClock = executionContext.getValuationClock();
        final ZonedDateTime now = ZonedDateTime.now(snapshotClock);
        Object meanReversionObject = inputs.getValue(new ValueRequirement(MarketDataRequirementNames.MARKET_VALUE,
            ComputationTargetType.PRIMITIVE, parameters.getMeanReversionId()));
        if (meanReversionObject == null) {
          // Jim - these are hacks that should be removed.
          meanReversionObject = MEAN_REVERSION_DEFAULT;
          s_logger.warn("Using default mean reversion");
          //throw new OpenGammaRuntimeException("Could not get mean reversion value");
        }
        Object initialVolatilityObject = inputs.getValue(new ValueRequirement(MarketDataRequirementNames.MARKET_VALUE,
            ComputationTargetType.PRIMITIVE, parameters.getInitialVolatilityId()));
        if (initialVolatilityObject == null) {
          // Jim - these are hacks that should be removed.
          initialVolatilityObject = INITIAL_VOLATILITY_DEFAULT;
          s_logger.warn("Using default initial volatility");
          //throw new OpenGammaRuntimeException("Could not get initial volatility value");
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.