Examples of VolatilityPoint


Examples of com.opengamma.core.marketdatasnapshot.VolatilityPoint

    final ManageableVolatilityCubeSnapshot volCube = new ManageableVolatilityCubeSnapshot();

    volCube.setOtherValues(globalValues);
    volCube.setValues(new HashMap<VolatilityPoint, ValueSnapshot>());
    volCube.setStrikes(strikes);
    volCube.getValues().put(new VolatilityPoint(Tenor.DAY, Tenor.YEAR, -1), new ValueSnapshot(null, null));

    volCubes.put(new VolatilityCubeKey(Currency.USD, "Default"), volCube);
    snapshot1.setVolatilityCubes(volCubes);

    MarketDataSnapshotDocument doc1 = new MarketDataSnapshotDocument(snapshot1);
View Full Code Here

Examples of com.opengamma.core.marketdatasnapshot.VolatilityPoint

        if (!(value.getValue() instanceof Double)) {
          continue;
        }
        final Double dValue = (Double) value.getValue();
        final ExternalIdBundle identifiers = value.getSpecification().getTargetSpecification().accept(resolver);
        final VolatilityPoint volatilityPoint;
        final Pair<Tenor, Tenor> strikePoint;
        if (value.getSpecification().getValueName() == MarketDataRequirementNames.MARKET_VALUE) {
          volatilityPoint = getByIdentifier(_pointsById, identifiers);
          strikePoint = getByIdentifier(_strikesById, identifiers);
        } else {
          volatilityPoint = null;
          strikePoint = null;
        }
        if (volatilityPoint == null && strikePoint == null) {
          otherData.setDataPoint(identifiers, dValue);
        } else if (volatilityPoint != null && strikePoint == null) {
          if (volatilityPoint.getRelativeStrike() > -50) {
            final Double previous = dataPoints.put(volatilityPoint, dValue);
            final ExternalIdBundle previousIds = dataIds.put(volatilityPoint, identifiers);
            final Double previousRelativeStrike = relativeStrikes.put(volatilityPoint, volatilityPoint.getRelativeStrike());
            if (previous != null && previous > dValue) {
              //TODO: this is a hack because we don't understand which tickers are for straddles, so we presume that the straddle has lower vol
              dataPoints.put(volatilityPoint, previous);
              dataIds.put(volatilityPoint, previousIds);
              relativeStrikes.put(volatilityPoint, previousRelativeStrike);
View Full Code Here

Examples of com.opengamma.core.marketdatasnapshot.VolatilityPoint

        if (!(value.getValue() instanceof Double)) {
          continue;
        }
        final Double dValue = (Double) value.getValue();
        final ExternalIdBundle identifiers = value.getSpecification().getTargetSpecification().accept(resolver);
        final VolatilityPoint volatilityPoint;
        final Pair<Tenor, Tenor> strikePoint;
        if (value.getSpecification().getValueName() == MarketDataRequirementNames.MARKET_VALUE) {
          volatilityPoint = getByIdentifier(_pointsById, identifiers);
          strikePoint = getByIdentifier(_strikesById, identifiers);
        } else {
          volatilityPoint = null;
          strikePoint = null;
        }
        if (volatilityPoint == null && strikePoint == null) {
          otherData.setDataPoint(identifiers, dValue);
        } else if (volatilityPoint != null && strikePoint == null) {
          if (volatilityPoint.getRelativeStrike() > -50) {
            final Double previous = dataPoints.put(volatilityPoint, dValue);
            final ExternalIdBundle previousIds = dataIds.put(volatilityPoint, identifiers);
            final Double previousRelativeStrike = relativeStrikes.put(volatilityPoint, volatilityPoint.getRelativeStrike());
            if (previous != null && previous > dValue) {
              //TODO: this is a hack because we don't understand which tickers are for straddles, so we presume that the straddle has lower vol
              dataPoints.put(volatilityPoint, previous);
              dataIds.put(volatilityPoint, previousIds);
              relativeStrikes.put(volatilityPoint, previousRelativeStrike);
View Full Code Here

Examples of com.opengamma.core.marketdatasnapshot.VolatilityPoint

        int swapI = index % _swapTenors.size();
        int remainder = index / _swapTenors.size();
        int optionI = remainder % _optionExpiries.size();
        remainder = remainder / _optionExpiries.size();
        int strikeI = remainder;
        return new VolatilityPoint(_swapTenors.get(swapI), _optionExpiries.get(optionI), _relativeStrikes.get(strikeI).doubleValue());
      }

      @Override
      public int size() {
        return size;
View Full Code Here

Examples of com.opengamma.core.marketdatasnapshot.VolatilityPoint

        final Map<VolatilityPoint, Double> normalizedRelativeStrikes = new HashMap<>();
        final Map<Pair<Tenor, Tenor>, Double> atmStrikes = data.getATMStrikes();
        final Map<Pair<Tenor, Tenor>, Double> normalizedATMStrikes = new HashMap<>();
        final Map<Pair<Tenor, Tenor>, Double> normalizedATMVols = new HashMap<>();
        for (final Map.Entry<VolatilityPoint, Double> entry : volatilityPoints.entrySet()) {
          final VolatilityPoint oldPoint = entry.getKey();
          final Tenor swapTenor = oldPoint.getSwapTenor();
          final Tenor swaptionExpiry = oldPoint.getOptionExpiry();
          final double relativeStrike = oldPoint.getRelativeStrike();
          if (atmStrikes.containsKey(Pair.of(swapTenor, swaptionExpiry))) {
            final Pair<Tenor, Tenor> tenorPair = Pair.of(swapTenor, swaptionExpiry);
            final double absoluteStrike = atmStrikes.get(tenorPair) + relativeStrike / 10000;
            final double vol = entry.getValue();
            final VolatilityPoint newPoint = new VolatilityPoint(swapTenor, swaptionExpiry, absoluteStrike);
            if (Double.doubleToLongBits(relativeStrike) == 0) {
              if (normalizedATMStrikes.containsKey(tenorPair)) {
                throw new OpenGammaRuntimeException("Normalized ATM strike data set already contains value for " + tenorPair);
              }
              normalizedATMStrikes.put(tenorPair, atmStrikes.get(tenorPair));
View Full Code Here

Examples of com.opengamma.core.marketdatasnapshot.VolatilityPoint

          Double relativeStrikeBps = sign * normalizedStrike;
          if (relativeStrikeBps == -0.0) {
            //Apparently the volatilities should be the same, so lets avoid fudge pains
            relativeStrikeBps = 0.0;
          }
          final VolatilityPoint point = new VolatilityPoint(swapTenor, optionExpiry, relativeStrikeBps);

          final ExternalId identifier = getIdentifier(ticker + " Curncy");

          final ObjectsPair<Currency, VolatilityPoint> key = Pair.of(currency, point);
          if (_idsByPoint.containsKey(key)) {
View Full Code Here

Examples of com.opengamma.core.marketdatasnapshot.VolatilityPoint

    HashMap<VolatilityPoint, ValueSnapshot> values = Maps.newHashMap();
    FudgeMsg valuesMessage = msg.getMessage("values");
    if (valuesMessage == null) {
      return values;
    }
    VolatilityPoint key = null;
    for (FudgeField fudgeField : valuesMessage) {
      Integer ordinal = fudgeField.getOrdinal();
      if (ordinal == null) {
        continue;
      }
View Full Code Here

Examples of com.opengamma.core.marketdatasnapshot.VolatilityPoint

          Double relativeStrikeBps = sign * normalizedStrike;
          if (relativeStrikeBps == -0.0) {
            //Apparently the volatilities should be the same, so lets avoid fudge pains
            relativeStrikeBps = 0.0;
          }
          final VolatilityPoint point = new VolatilityPoint(swapTenor, optionExpiry, relativeStrikeBps);

          final ExternalId identifier = getIdentifier(ticker);

          final ObjectsPair<Currency, VolatilityPoint> key = Pair.of(currency, point);
          if (_idsByPoint.containsKey(key)) {
View Full Code Here

Examples of com.opengamma.core.marketdatasnapshot.VolatilityPoint

              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;
                final VolatilityPoint coordinate = new VolatilityPoint(x, y, z);
                data.put(coordinate, volatility);
                ids.put(coordinate, id.toBundle());
              }
            }
          }
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.