Package com.opengamma.core.marketdatasnapshot

Examples of com.opengamma.core.marketdatasnapshot.ValueSnapshot


      }
      final int intValue = ordinal.intValue();
      if (intValue == 1) {
        key = deserializer.fieldValueToObject(Pair.class, fudgeField);
      } else if (intValue == 2) {
        ValueSnapshot value = deserializer.fieldValueToObject(ValueSnapshot.class, fudgeField);
        values.put(key, value);
        key = null;
      }
    }
    final ManageableVolatilitySurfaceSnapshot ret = new ManageableVolatilitySurfaceSnapshot();
View Full Code Here


    return null;
  }

  @Override
  public ValueSnapshot getValue(final ExternalIdBundle identifiers, final String valueName) {
    ValueSnapshot value = getImpl(identifiers, valueName);
    if (value != null) {
      return value;
    } else {
      for (final ExternalId identifier : identifiers) {
        value = getValue(identifier, valueName);
View Full Code Here

  private void writeOrdinatedValueSnapshot(Map<String, String> prefixes,
                                           Map<Pair<Object, Object>, ValueSnapshot> valueSnapshots) {

    for (Map.Entry<Pair<Object, Object>, ValueSnapshot> entry : valueSnapshots.entrySet()) {
      Map<String, String> tempRow = new HashMap<>();
      ValueSnapshot valueSnapshot = entry.getValue();
      tempRow.putAll(prefixes);

      String surfaceX;
      if (entry.getKey().getFirst() instanceof Tenor) {
        surfaceX = ((Tenor) entry.getKey().getFirst()).toFormattedString();
      } else {
        surfaceX = entry.getKey().getFirst().toString();
      }

      String surfaceY;
      if (entry.getKey().getSecond() instanceof Pair) {
        surfaceY = ((Pair) entry.getKey().getSecond()).getFirst() + "|" + ((Pair) entry.getKey().getSecond()).getSecond();
      } else {
        surfaceY = entry.getKey().getSecond().toString();
      }

      tempRow.put(SnapshotColumns.SURFACE_X.get(), surfaceX);
      tempRow.put(SnapshotColumns.SURFACE_Y.get(), surfaceY);
      if (valueSnapshot.getMarketValue() != null) {
        tempRow.put(SnapshotColumns.MARKET_VALUE.get(), valueSnapshot.getMarketValue().toString());
      }
      if (valueSnapshot.getOverrideValue() != null) {
        tempRow.put(SnapshotColumns.OVERRIDE_VALUE.get(), valueSnapshot.getOverrideValue().toString());
      }
      _sheetWriter.writeNextRow(tempRow);
    }
  }
View Full Code Here

  /** Named ValueSnapshots, needed for Unstructured Market */
  private void writeValueSnapshot(Map<String, String> prefixes, Map<String, ValueSnapshot> valueSnapshots) {

    for (Map.Entry<String, ValueSnapshot> entry : valueSnapshots.entrySet()) {
      Map<String, String> tempRow = new HashMap<>();
      ValueSnapshot valueSnapshot = entry.getValue();
      tempRow.putAll(prefixes);
      tempRow.put(SnapshotColumns.VALUE_NAME.get(), entry.getKey());
      if (valueSnapshot.getMarketValue() != null) {
        tempRow.put(SnapshotColumns.MARKET_VALUE.get(), valueSnapshot.getMarketValue().toString());
      }
      if (valueSnapshot.getOverrideValue() != null) {
        tempRow.put(SnapshotColumns.OVERRIDE_VALUE.get(), valueSnapshot.getOverrideValue().toString());
      }
      _sheetWriter.writeNextRow(tempRow);
    }
  }
View Full Code Here

          s_logger.error("Override value {} should be a Double, LocalDate or empty.", override);
        }
      }
    }

    return new ValueSnapshot(marketValue, overrideValue);
  }
View Full Code Here

@Test(groups = TestGroup.UNIT)
public class UserMarketDataSnapshotTest {

  private UnstructuredMarketDataSnapshot generateUnstructured(final ExternalId testValueId, final Double marketValue) {
    final ManageableUnstructuredMarketDataSnapshot values = new ManageableUnstructuredMarketDataSnapshot();
    values.putValue(testValueId, MarketDataRequirementNames.MARKET_VALUE, new ValueSnapshot(marketValue));
    return values;
  }
View Full Code Here

  }

  private static HashMap<VolatilityPoint, Double> buildVolValues(final Map<VolatilityPoint, ValueSnapshot> values) {
    final HashMap<VolatilityPoint, Double> dataPoints = new HashMap<VolatilityPoint, Double>();
    for (final Entry<VolatilityPoint, ValueSnapshot> entry : values.entrySet()) {
      final ValueSnapshot value = entry.getValue();
      final Double query = queryDouble(value);
      if (query != null) {
        dataPoints.put(entry.getKey(), query);
      }
    }
View Full Code Here

  }

  private static HashMap<Pair<Tenor, Tenor>, Double> buildVolStrikes(final Map<Pair<Tenor, Tenor>, ValueSnapshot> strikes) {
    final HashMap<Pair<Tenor, Tenor>, Double> dataPoints = new HashMap<Pair<Tenor, Tenor>, Double>();
    for (final Entry<Pair<Tenor, Tenor>, ValueSnapshot> entry : strikes.entrySet()) {
      final ValueSnapshot value = entry.getValue();
      final Double query = queryDouble(value);
      if (query != null) {
        dataPoints.put(entry.getKey(), query);
      }
    }
View Full Code Here

TOP

Related Classes of com.opengamma.core.marketdatasnapshot.ValueSnapshot

Copyright © 2018 www.massapicom. 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.