Package com.opengamma.core.marketdatasnapshot.impl

Examples of com.opengamma.core.marketdatasnapshot.impl.ManageableVolatilityCubeSnapshot


    final HashMap<Pair<Tenor, Tenor>, ValueSnapshot> strikes = new HashMap<Pair<Tenor, Tenor>, ValueSnapshot>();
    strikes.put(Pair.of(Tenor.DAY, Tenor.WORKING_WEEK), new ValueSnapshot(12.0, 12.0));
    strikes.put(Pair.of(Tenor.DAY, Tenor.WORKING_WEEK), null);

    final HashMap<VolatilityCubeKey, VolatilityCubeSnapshot> volCubes = new HashMap<VolatilityCubeKey, VolatilityCubeSnapshot>();
    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


    return new VolatilityCubeKey(currency, cube);
  }

  @Override
  VolatilityCubeSnapshot buildSnapshot(ViewComputationResultModel resultModel, VolatilityCubeKey key, VolatilityCubeData volatilityCubeData) {
    ManageableVolatilityCubeSnapshot ret = new ManageableVolatilityCubeSnapshot();
   
    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()) {
      values.put(ycp.getKey(), new ValueSnapshot(ycp.getValue()));
    }  

    Map<Pair<Tenor, Tenor>, ValueSnapshot> strikes = new HashMap<Pair<Tenor, Tenor>, ValueSnapshot>();
    for (Entry<Pair<Tenor, Tenor>, Double> strike : volatilityCubeData.getATMStrikes().entrySet()) {
      strikes.put(strike.getKey(), new ValueSnapshot(strike.getValue()));
    }

    ret.setOtherValues(otherValues);
    ret.setValues(values);
    ret.setStrikes(strikes);
    return ret;
  }
View Full Code Here

TOP

Related Classes of com.opengamma.core.marketdatasnapshot.impl.ManageableVolatilityCubeSnapshot

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.