Examples of VolatilityCubeDefinition


Examples of com.opengamma.financial.analytics.volatility.cube.VolatilityCubeDefinition

    ManageableUnstructuredMarketDataSnapshot otherValues = getUnstructured(volatilityCubeData.getOtherData());

    Map<VolatilityPoint, ValueSnapshot> values = new HashMap<VolatilityPoint, ValueSnapshot>();
   
    //fill with nulls
    VolatilityCubeDefinition definition = _cubeDefinitionSource.getDefinition(key.getCurrency(), key.getName());
   
    Iterable<VolatilityPoint> allPoints = definition.getAllPoints();
    for (VolatilityPoint point : allPoints) {
      values.put(point, new ValueSnapshot(null));
    }
   
    for (Entry<VolatilityPoint, Double> ycp : volatilityCubeData.getDataPoints().entrySet()) {
View Full Code Here

Examples of com.opengamma.financial.analytics.volatility.cube.VolatilityCubeDefinition

      @QueryParam("versionAsOf") String versionAsOfStr,
      @QueryParam("name") String name) {
    final Currency currency = Currency.parse(currencyStr);
    if (versionAsOfStr != null) {
      final VersionCorrection versionCorrection = VersionCorrection.parse(versionAsOfStr, null);
      VolatilityCubeDefinition result = getVolatilityCubeDefinitionSource().getDefinition(currency, name, versionCorrection);
      return responseOkFudge(result);
    } else {
      VolatilityCubeDefinition result = getVolatilityCubeDefinitionSource().getDefinition(currency, name);
      return responseOkFudge(result);
    }
  }
View Full Code Here

Examples of com.opengamma.financial.analytics.volatility.cube.VolatilityCubeDefinition

      optionExpiries.add(volatilityPoint.getOptionExpiry());
      swapTenors.add(volatilityPoint.getSwapTenor());
      relativeStrikes.add(volatilityPoint.getRelativeStrike());
    }

    final VolatilityCubeDefinition ret = new VolatilityCubeDefinition();
    ret.setOptionExpiries(Lists.newArrayList(optionExpiries));
    ret.setSwapTenors(Lists.newArrayList(swapTenors));
    ret.setRelativeStrikes(Lists.newArrayList(relativeStrikes));

    ret.setUniqueId(UniqueId.of("SECONDARY_VOLATILITY_CUBE_DEFINITION", currency.getCode()));
    return ret;
  }
View Full Code Here

Examples of com.opengamma.financial.analytics.volatility.cube.VolatilityCubeDefinition

      log.fail(t);
    }
  }

  private static VolatilityCubeDefinition createDefaultVolatilityCubeDefinition() {
    final VolatilityCubeDefinition volatilityCubeDefinition = new VolatilityCubeDefinition();
    volatilityCubeDefinition.setSwapTenors(Lists.newArrayList(Tenor.ofMonths(3), Tenor.ofYears(1), Tenor.ofYears(2), Tenor.ofYears(5), Tenor.ofYears(10), Tenor.ofYears(15), Tenor.ofYears(20),
        Tenor.ofYears(30)));
    volatilityCubeDefinition.setOptionExpiries(Lists.newArrayList(Tenor.ofMonths(3), Tenor.ofMonths(6), Tenor.ofYears(1), Tenor.ofYears(2), Tenor.ofYears(4), Tenor.ofYears(5), Tenor.ofYears(10),
        Tenor.ofYears(15), Tenor.ofYears(20)));
    final int[] values = new int[] {0, 20, 25, 50, 70, 75, 100, 200, 5 };
    final List<Double> relativeStrikes = new ArrayList<Double>(values.length * 2 - 1);
    for (final int value : values) {
      relativeStrikes.add(Double.valueOf(value));
      if (value != 0) {
        relativeStrikes.add(Double.valueOf(-value));
      }
    }
    Collections.sort(relativeStrikes);
    volatilityCubeDefinition.setRelativeStrikes(relativeStrikes);
    return volatilityCubeDefinition;
  }
View Full Code Here

Examples of com.opengamma.financial.analytics.volatility.cube.VolatilityCubeDefinition

    final String fullDefinitionName = definitionName + "_" + currency.getCode();
    final SwaptionVolatilityCubeSpecification specification = specificationSource.getSpecification(fullSpecificationName);
    if (specification == null) {
      throw new OpenGammaRuntimeException("Could not get swaption volatility cube specification named " + fullSpecificationName);
    }
    final VolatilityCubeDefinition definition = definitionSource.getDefinition(currency, fullDefinitionName);
    if (definition == null) {
      throw new OpenGammaRuntimeException("Could not get swaption volatility cube definition named " + fullDefinitionName);
    }
    final CubeInstrumentProvider<Tenor, Tenor, Double> provider = (CubeInstrumentProvider<Tenor, Tenor, Double>) specification.getCubeInstrumentProvider();
    final Set<ValueRequirement> result = new HashSet<ValueRequirement>();
    for (final Tenor swapTenor : definition.getSwapTenors()) {
      for (final Tenor swaptionExpiry : definition.getOptionExpiries()) {
        for (final Double relativeStrike : definition.getRelativeStrikes()) {
          final ExternalId identifier = provider.getInstrument(swapTenor, swaptionExpiry, relativeStrike);
          result.add(new ValueRequirement(provider.getDataFieldName(), ComputationTargetType.PRIMITIVE, identifier));
        }
      }
    }
View Full Code Here

Examples of com.opengamma.financial.analytics.volatility.cube.VolatilityCubeDefinition

        final String fullDefinitionName = definitionName + "_" + currency.getCode();
        final SwaptionVolatilityCubeSpecification specification = specificationSource.getSpecification(fullSpecificationName);
        if (specification == null) {
          throw new OpenGammaRuntimeException("Could not get swaption volatility cube specification named " + fullSpecificationName);
        }
        final VolatilityCubeDefinition definition = definitionSource.getDefinition(currency, fullDefinitionName);
        if (definition == null) {
          throw new OpenGammaRuntimeException("Could not get swaption volatility cube definition named " + fullDefinitionName);
        }
        final CubeInstrumentProvider<Tenor, Tenor, Double> provider = (CubeInstrumentProvider<Tenor, Tenor, Double>) specification.getCubeInstrumentProvider();
        final Map<VolatilityPoint, Double> data = new HashMap<VolatilityPoint, Double>();
        final Map<VolatilityPoint, ExternalIdBundle> ids = new HashMap<VolatilityPoint, ExternalIdBundle>();
        for (final Tenor x : definition.getSwapTenors()) {
          for (final Tenor y : definition.getOptionExpiries()) {
            for (final Double z : definition.getRelativeStrikes()) {
              final ExternalId id = provider.getInstrument(x, y, z);
              final ValueRequirement requirement = new ValueRequirement(provider.getDataFieldName(), ComputationTargetType.PRIMITIVE, id);
              final Object volatilityObject = inputs.getValue(requirement);
              if (volatilityObject != null) {
                final Double volatility = (Double) volatilityObject;
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.