Package com.opengamma.master.historicaltimeseries

Examples of com.opengamma.master.historicaltimeseries.ManageableHistoricalTimeSeries$Meta


    for (final FixedIncomeStripWithSecurity strip : curveSpec.getStrips()) {
      final FactorExposureData swapExternalSensitivitiesData = searchForSwapTenorMatch(decodedSensitivities, strip);
      if (swapExternalSensitivitiesData != null) {
        final ComputedValue computedValue = inputs.getComputedValue(getSensitivityRequirement(swapExternalSensitivitiesData.getExposureExternalId()));
        if (computedValue != null) {
          final ManageableHistoricalTimeSeries mhts = (ManageableHistoricalTimeSeries) computedValue.getValue();
          final Double value = mhts.getTimeSeries().getLatestValue();
          entries[i] = -value; //* (qty.doubleValue() ); // we invert here because OpenGamma uses -1bp shift rather than +1.  DV01 function will invert back.
        } else {
          s_logger.warn("Value was null when getting required input data " + swapExternalSensitivitiesData.getExposureExternalId());
          entries[i] = 0d;
        }
      } else {
        entries[i] = 0d;
      }
      i++;
    }
    // Quick hack to map in bond data.
    i = 0;
    for (final FixedIncomeStripWithSecurity strip : curveSpec.getStrips()) {
      final FactorExposureData bondExternalSensitivitiesData = searchForBondTenorMatch(decodedSensitivities, strip);
      if (bondExternalSensitivitiesData != null) {
        final ComputedValue computedValue = inputs.getComputedValue(getSensitivityRequirement(bondExternalSensitivitiesData.getExposureExternalId()));
        if (computedValue != null) {
          final ManageableHistoricalTimeSeries mhts = (ManageableHistoricalTimeSeries) computedValue.getValue();
          final Double value = mhts.getTimeSeries().getLatestValue();
          entries[i] -= value; //* (qty.doubleValue() ); // we invert here because OpenGamma uses -1bp shift rather than +1.  DV01 function will invert back.
        } else {
          s_logger.warn("Value was null when getting required input data " + bondExternalSensitivitiesData.getExposureExternalId());
        }
      }
View Full Code Here


  public UniqueId writeTimeSeries(String description, String dataSource, String dataProvider, String dataField,
      String observationTime, ObjectId oId, LocalDateDoubleTimeSeries timeSeries) {
   
    UniqueId uId = oId.atLatestVersion();
   
    ManageableHistoricalTimeSeries existingManageableTs = _htsMaster.getTimeSeries(uId);
    LocalDateDoubleTimeSeries existingTs = existingManageableTs.getTimeSeries();

    if (existingTs.isEmpty()) {
      uId = _htsMaster.updateTimeSeriesDataPoints(oId, timeSeries);
      s_logger.debug("Updating time series " + oId + "[" + dataField + "] with all as currently emtpy)");
    } else {
View Full Code Here

   * @param timeSeries  the time-series, not null
   * @return the unique identifier of the time-series
   */
  public UniqueId writeTimeSeries(UniqueId uniqueId, LocalDateDoubleTimeSeries timeSeries) {
   
    ManageableHistoricalTimeSeries existingManageableTs = _htsMaster.getTimeSeries(uniqueId);
    LocalDateDoubleTimeSeries existingTs = existingManageableTs.getTimeSeries();
    if (existingTs.isEmpty()) {
      _htsMaster.updateTimeSeriesDataPoints(uniqueId, timeSeries);
      s_logger.debug("Updating time series " + uniqueId + " with all as currently emtpy)");
    } else {
      // There is a matching time-series already in the master so update it to reflect the new time-series
View Full Code Here

    LocalDateDoubleTimeSeries series = ImmutableLocalDateDoubleTimeSeries.of(dates, values);
   
    ObjectId oid = ObjectId.of("DbHts", "DP101");
    UniqueId uniqueId = _htsMaster.correctTimeSeriesDataPoints(oid, series);
   
    ManageableHistoricalTimeSeries testCorrected = _htsMaster.getTimeSeries(uniqueId);
    assertEquals(uniqueId, testCorrected.getUniqueId());
    LocalDateDoubleTimeSeries timeSeries = testCorrected.getTimeSeries();
    assertEquals(3, timeSeries.size());
    assertEquals(LocalDate.of(2011, 1, 1), timeSeries.getTimeAtIndex(0));
    assertEquals(0.1d, timeSeries.getValueAtIndex(0), 0.001d);
    assertEquals(LocalDate.of(2011, 1, 2), timeSeries.getTimeAtIndex(1));
    assertEquals(0.2d, timeSeries.getValueAtIndex(1), 0.001d);
View Full Code Here

    LocalDateDoubleTimeSeries series = ImmutableLocalDateDoubleTimeSeries.of(dates, values);
   
    ObjectId oid = ObjectId.of("DbHts", "DP101");
    UniqueId uniqueId = _htsMaster.correctTimeSeriesDataPoints(oid, series);
   
    ManageableHistoricalTimeSeries testCorrected = _htsMaster.getTimeSeries(uniqueId);
    assertEquals(uniqueId, testCorrected.getUniqueId());
    LocalDateDoubleTimeSeries timeSeries = testCorrected.getTimeSeries();
    assertEquals(4, timeSeries.size());
    assertEquals(LocalDate.of(2010, 12, 31), timeSeries.getTimeAtIndex(0));
    assertEquals(0.5d, timeSeries.getValueAtIndex(0), 0.001d);
    assertEquals(LocalDate.of(2011, 1, 1), timeSeries.getTimeAtIndex(1));
    assertEquals(3.1d, timeSeries.getValueAtIndex(1), 0.001d);
View Full Code Here

    List<LocalDate> dates = ImmutableList.of(_today.minusDays(2), _today.minusDays(1), _today);
    List<Double> values = ImmutableList.of(1d, 2d, 3d);
    ImmutableLocalDateDoubleTimeSeries origTs = ImmutableLocalDateDoubleTimeSeries.of(dates, values);
    UniqueId id = _htsWriter.writeTimeSeries(DESCRIPTION, DATA_SOURCE, DATA_PROVIDER, DATA_FIELD, OBSERVATION_TIME, ExternalIdBundle.of(ID), origTs);
   
    ManageableHistoricalTimeSeries manageableTs = _htsMaster.getTimeSeries(id);
    LocalDateDoubleTimeSeries readTs = manageableTs.getTimeSeries();
    assertEquals(origTs, readTs);
  }
View Full Code Here

    List<LocalDate> dates = ImmutableList.of(_today.minusDays(2), _today.minusDays(1), _today);
    List<Double> values = ImmutableList.of(2d, 3d, 4d);
    ImmutableLocalDateDoubleTimeSeries updatedTs = ImmutableLocalDateDoubleTimeSeries.of(dates, values);
    UniqueId id = _htsWriter.writeTimeSeries(DESCRIPTION, DATA_SOURCE, DATA_PROVIDER, DATA_FIELD, OBSERVATION_TIME, ExternalIdBundle.of(ID), updatedTs);
   
    ManageableHistoricalTimeSeries manageableTs = _htsMaster.getTimeSeries(id);
    LocalDateDoubleTimeSeries readTs = manageableTs.getTimeSeries();
    assertEquals(updatedTs, readTs);   
  }
View Full Code Here

    List<LocalDate> dates = ImmutableList.of(_today.plusDays(1));
    List<Double> values = ImmutableList.of(4d);
    ImmutableLocalDateDoubleTimeSeries newTs = ImmutableLocalDateDoubleTimeSeries.of(dates, values);
    UniqueId id = _htsWriter.writeTimeSeries(DESCRIPTION, DATA_SOURCE, DATA_PROVIDER, DATA_FIELD, OBSERVATION_TIME, ExternalIdBundle.of(ID), newTs);
   
    ManageableHistoricalTimeSeries manageableTs = _htsMaster.getTimeSeries(id);
    LocalDateDoubleTimeSeries readTs = manageableTs.getTimeSeries();
    List<LocalDate> expectedDates = ImmutableList.of(_today.minusDays(2), _today.minusDays(1), _today, _today.plusDays(1));
    List<Double> expectedValues = ImmutableList.of(1d, 2d, 3d, 4d);
    ImmutableLocalDateDoubleTimeSeries expectedTs = ImmutableLocalDateDoubleTimeSeries.of(expectedDates, expectedValues);
    assertEquals(expectedTs, readTs);
  }
View Full Code Here

    List<Double> values = ImmutableList.of(0d, 4d);
    ImmutableLocalDateDoubleTimeSeries newTs = ImmutableLocalDateDoubleTimeSeries.of(dates, values);
    UniqueId id = _htsWriter.writeTimeSeries(DESCRIPTION, DATA_SOURCE, DATA_PROVIDER, DATA_FIELD, OBSERVATION_TIME, ExternalIdBundle.of(ID), newTs);
   
    // Current implementation drops new, earlier points
    ManageableHistoricalTimeSeries manageableTs = _htsMaster.getTimeSeries(id);
    LocalDateDoubleTimeSeries readTs = manageableTs.getTimeSeries();
    List<LocalDate> expectedDates = ImmutableList.of(_today.minusDays(2), _today.minusDays(1), _today, _today.plusDays(1));
    List<Double> expectedValues = ImmutableList.of(1d, 2d, 3d, 4d);
    ImmutableLocalDateDoubleTimeSeries expectedTs = ImmutableLocalDateDoubleTimeSeries.of(expectedDates, expectedValues);
    assertEquals(expectedTs, readTs);   
  }
View Full Code Here

    List<LocalDate> dates = ImmutableList.of(_today.minusDays(2), _today);
    List<Double> values = ImmutableList.of(6d, 7d);
    ImmutableLocalDateDoubleTimeSeries updatedTs = ImmutableLocalDateDoubleTimeSeries.of(dates, values);
    UniqueId id = _htsWriter.writeTimeSeries(DESCRIPTION, DATA_SOURCE, DATA_PROVIDER, DATA_FIELD, OBSERVATION_TIME, ExternalIdBundle.of(ID), updatedTs);
   
    ManageableHistoricalTimeSeries manageableTs = _htsMaster.getTimeSeries(id);
    LocalDateDoubleTimeSeries readTs = manageableTs.getTimeSeries();
    assertEquals(updatedTs, readTs);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.master.historicaltimeseries.ManageableHistoricalTimeSeries$Meta

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.