Package com.opengamma.timeseries.date.localdate

Examples of com.opengamma.timeseries.date.localdate.LocalDateDoubleTimeSeries


  //-------------------------------------------------------------------------
  @Test(expectedExceptions = IllegalArgumentException.class)
  public void test_update_beforeAllExistingPoints() {
    LocalDate[] dates = {LocalDate.of(2010, 12, 1)};
    double[] values = {0.9d};
    LocalDateDoubleTimeSeries series = ImmutableLocalDateDoubleTimeSeries.of(dates, values);
   
    _htsMaster.updateTimeSeriesDataPoints(ObjectId.of("DbHts", "DP101"), series);
  }
View Full Code Here


  @Test(expectedExceptions = IllegalArgumentException.class)
  public void test_update_atExistingPoint() {
    LocalDate[] dates = {LocalDate.of(2011, 1, 3)};
    double[] values = {0.9d};
    LocalDateDoubleTimeSeries series = ImmutableLocalDateDoubleTimeSeries.of(dates, values);
   
    _htsMaster.updateTimeSeriesDataPoints(ObjectId.of("DbHts", "DP101"), series);
  }
View Full Code Here

  //-------------------------------------------------------------------------
  @Test
  public void test_update_102_startsEmpty() {
    LocalDate[] dates = {LocalDate.of(2011, 7, 1), LocalDate.of(2011, 7, 2), LocalDate.of(2011, 7, 4)};
    double[] values = {1.1d, 2.2d, 3.3d};
    LocalDateDoubleTimeSeries series = ImmutableLocalDateDoubleTimeSeries.of(dates, values);
   
    ObjectId oid = ObjectId.of("DbHts", "DP102");
    UniqueId uniqueId = _htsMaster.updateTimeSeriesDataPoints(oid, series);
   
    ManageableHistoricalTimeSeries test = _htsMaster.getTimeSeries(uniqueId);
View Full Code Here

  @Test
  public void test_update_101_startsFull() {
    LocalDate[] dates = {LocalDate.of(2011, 7, 1), LocalDate.of(2011, 7, 2), LocalDate.of(2011, 7, 4)};
    double[] values = {1.1d, 2.2d, 3.3d};
    LocalDateDoubleTimeSeries series = ImmutableLocalDateDoubleTimeSeries.of(dates, values);
   
    ObjectId oid = ObjectId.of("DbHts", "DP101");
    UniqueId uniqueId = _htsMaster.updateTimeSeriesDataPoints(oid, series);
   
    ManageableHistoricalTimeSeries testAdded = _htsMaster.getTimeSeries(uniqueId, HistoricalTimeSeriesGetFilter.ofRange(LocalDate.of(2011, 7, 1), null));
View Full Code Here

    assertEquals(uniqueId.getObjectId(), test.getUniqueId().getObjectId());
    assertEquals(LocalDate.of(2011, 1, 1), _htsMaster.getTimeSeries(uniqueId, HistoricalTimeSeriesGetFilter.ofEarliestPoint()).getTimeSeries().getEarliestTime());
    assertEquals(LocalDate.of(2011, 1, 3), _htsMaster.getTimeSeries(uniqueId, HistoricalTimeSeriesGetFilter.ofLatestPoint()).getTimeSeries().getLatestTime());
    assertEquals(_version2Instant, test.getVersionInstant());
    assertEquals(_version4Instant, test.getCorrectionInstant());
    LocalDateDoubleTimeSeries timeSeries = test.getTimeSeries();
    assertEquals(3, timeSeries.size());
    assertEquals(LocalDate.of(2011, 1, 1), timeSeries.getTimeAtIndex(0));
    assertEquals(3.1d, timeSeries.getValueAtIndex(0), 0.001d);
    assertEquals(LocalDate.of(2011, 1, 2), timeSeries.getTimeAtIndex(1));
    assertEquals(3.22d, timeSeries.getValueAtIndex(1), 0.001d);
    assertEquals(LocalDate.of(2011, 1, 3), timeSeries.getTimeAtIndex(2));
    assertEquals(3.33d, timeSeries.getValueAtIndex(2), 0.001d);
  }
View Full Code Here

  @Test
  public void test_get_UID_102_latest() {
    UniqueId uniqueId = UniqueId.of("DbHts", "DP102");
    ManageableHistoricalTimeSeries test = _htsMaster.getTimeSeries(uniqueId);
    assertEquals(uniqueId.getObjectId(), test.getUniqueId().getObjectId());
    LocalDateDoubleTimeSeries timeSeries = test.getTimeSeries();
    assertEquals(0, timeSeries.size());
  }
View Full Code Here

  @Test
  public void test_get_OID_101_latest() {
    ObjectId oid = ObjectId.of("DbHts", "DP101");
    ManageableHistoricalTimeSeries test = _htsMaster.getTimeSeries(oid, VersionCorrection.LATEST);
    assertEquals(oid, test.getUniqueId().getObjectId());
    LocalDateDoubleTimeSeries timeSeries = test.getTimeSeries();
    assertEquals(3, timeSeries.size());
    assertEquals(LocalDate.of(2011, 1, 1), timeSeries.getTimeAtIndex(0));
    assertEquals(3.1d, timeSeries.getValueAtIndex(0), 0.0001d);
    assertEquals(LocalDate.of(2011, 1, 2), timeSeries.getTimeAtIndex(1));
    assertEquals(3.22d, timeSeries.getValueAtIndex(1), 0.0001d);
    assertEquals(LocalDate.of(2011, 1, 3), timeSeries.getTimeAtIndex(2));
    assertEquals(3.33d, timeSeries.getValueAtIndex(2), 0.0001d);
  }
View Full Code Here

  @Test
  public void test_get_OID_101_post1() {
    ObjectId oid = ObjectId.of("DbHts", "DP101");
    ManageableHistoricalTimeSeries test = _htsMaster.getTimeSeries(oid, VersionCorrection.ofVersionAsOf(_version1Instant.plusSeconds(1)));
    assertEquals(oid, test.getUniqueId().getObjectId());
    LocalDateDoubleTimeSeries timeSeries = test.getTimeSeries();
    assertEquals(1, timeSeries.size());
    assertEquals(LocalDate.of(2011, 1, 1), timeSeries.getTimeAtIndex(0));
    assertEquals(3.1d, timeSeries.getValueAtIndex(0), 0.0001d);
  }
View Full Code Here

  @Test
  public void test_get_OID_101_post2() {
    ObjectId oid = ObjectId.of("DbHts", "DP101");
    ManageableHistoricalTimeSeries test = _htsMaster.getTimeSeries(oid, VersionCorrection.ofVersionAsOf(_version2Instant.plusSeconds(1)));
    assertEquals(oid, test.getUniqueId().getObjectId());
    LocalDateDoubleTimeSeries timeSeries = test.getTimeSeries();
    assertEquals(3, timeSeries.size());
    assertEquals(LocalDate.of(2011, 1, 1), timeSeries.getTimeAtIndex(0));
    assertEquals(3.1d, timeSeries.getValueAtIndex(0), 0.0001d);
    assertEquals(LocalDate.of(2011, 1, 2), timeSeries.getTimeAtIndex(1));
    assertEquals(3.22d, timeSeries.getValueAtIndex(1), 0.0001d);
    assertEquals(LocalDate.of(2011, 1, 3), timeSeries.getTimeAtIndex(2));
    assertEquals(3.33d, timeSeries.getValueAtIndex(2), 0.0001d);
  }
View Full Code Here

  @Test
  public void test_get_OID_101_correctPost2() {
    ObjectId oid = ObjectId.of("DbHts", "DP101");
    ManageableHistoricalTimeSeries test = _htsMaster.getTimeSeries(oid, VersionCorrection.of(_version2Instant.plusSeconds(1), _version2Instant.plusSeconds(1)));
    assertEquals(oid, test.getUniqueId().getObjectId());
    LocalDateDoubleTimeSeries timeSeries = test.getTimeSeries();
    assertEquals(3, timeSeries.size());
    assertEquals(LocalDate.of(2011, 1, 1), timeSeries.getTimeAtIndex(0));
    assertEquals(3.1d, timeSeries.getValueAtIndex(0), 0.0001d);
    assertEquals(LocalDate.of(2011, 1, 2), timeSeries.getTimeAtIndex(1));
    assertEquals(3.2d, timeSeries.getValueAtIndex(1), 0.0001d);
    assertEquals(LocalDate.of(2011, 1, 3), timeSeries.getTimeAtIndex(2));
    assertEquals(3.3d, timeSeries.getValueAtIndex(2), 0.0001d);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.timeseries.date.localdate.LocalDateDoubleTimeSeries

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.