Package com.opengamma.timeseries.date.localdate

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


    final LocalDateDoubleTimeSeries ts1 = x[0];
    final LocalDateDoubleTimeSeries ts2 = x[1];
    final int n = ts1.size();
    final int[] times = new int[n];
    final double[] returns = new double[n];
    final LocalDateDoubleEntryIterator iter1 = ts1.iterator();
    int i = 0;
    while (iter1.hasNext()) {
      final int date = iter1.nextTimeFast();
      final Double value2 = ts2.getValue(date);
      if (value2 == null || Math.abs(value2) < ZERO) {
        if (getMode().equals(CalculationMode.STRICT)) {
          throw new TimeSeriesException("No data in second series for time " + iter1.currentTime());
        }
      } else {
        times[i] = iter1.currentTimeFast();
        returns[i++] = Math.log(iter1.currentValue() / value2);
      }
    }
    return getSeries(times, returns, i);
  }
View Full Code Here


    final int[] resultDates = new int[ts.size() - 1];
    final double[] resultValues = new double[ts.size() - 1];
    int resultIndex = 0;

    final LocalDateDoubleEntryIterator it = ts.iterator();
    it.nextTimeFast();
    double previousValue = it.currentValue();

    double dividend;
    Double dividendTSData;
    while (it.hasNext()) {
      final int date = it.nextTimeFast();
      final double value = it.currentValue();

      if (isValueNonZero(previousValue) && isValueNonZero(value)) {
        resultDates[resultIndex] = date;
        if (d == null) {
          dividend = 0;
View Full Code Here

    final LocalDateDoubleTimeSeries ts1 = x[0];
    final LocalDateDoubleTimeSeries ts2 = x[1];
    final int n = ts1.size();
    final int[] times = new int[n];
    final double[] returns = new double[n];
    final LocalDateDoubleEntryIterator iter1 = ts1.iterator();
    int i = 0;
    while (iter1.hasNext()) {
      final int date = iter1.nextTimeFast();
      final Double value2 = ts2.getValue(date);
      if (value2 == null || Math.abs(value2) < ZERO) {
        if (getMode().equals(CalculationMode.STRICT)) {
          throw new TimeSeriesException("No data in second series for time " + iter1.currentTime());
        }
      } else {
        times[i] = iter1.currentTimeFast();
        returns[i++] = (iter1.currentValue() / value2 - 1);
      }
    }
    return getSeries(times, returns, i);
  }
View Full Code Here

    final int[] resultDates = new int[ts.size() - 1];
    final double[] resultValues = new double[ts.size() - 1];
    int resultIndex = 0;

    final LocalDateDoubleEntryIterator it = ts.iterator();
    it.nextTimeFast();
    double previousValue = it.currentValue();

    double dividend;
    Double dividendTSData;
    while (it.hasNext()) {
      final int date = it.nextTimeFast();
      final double value = it.currentValue();

      if (isValueNonZero(previousValue) && isValueNonZero(value)) {
        resultDates[resultIndex] = date;
        if (d == null) {
          dividend = 0;
View Full Code Here

    final int[] resultDates = new int[ts.size() - 1];
    final double[] resultValues = new double[ts.size() - 1];
    int resultIndex = 0;

    final LocalDateDoubleEntryIterator it = ts.iterator();
    it.nextTimeFast();
    double previousValue = it.currentValue();

    double dividend;
    Double dividendTSData;
    while (it.hasNext()) {
      final int date = it.nextTimeFast();
      final double value = it.currentValue();

      if (isValueNonZero(previousValue) && isValueNonZero(value)) {
        resultDates[resultIndex] = date;
        if (d == null) {
          dividend = 0;
View Full Code Here

    final int n = ts.size();
    final int[] filteredDates = new int[n];
    final double[] filteredData = new double[n];
    final int[] rejectedDates = new int[n];
    final double[] rejectedData = new double[n];
    final LocalDateDoubleEntryIterator it = ts.iterator();
    int i = 0, j = 0;
    while (it.hasNext()) {
      int date = it.nextTimeFast();
      double value = it.currentValue();
      if (Math.abs(value) < _zero) {
        rejectedDates[j] = date;
        rejectedData[j++] = value;
      } else {
        filteredDates[i] = date;
View Full Code Here

    final int n = ts.size();
    final int[] filteredDates = new int[n];
    final double[] filteredData = new double[n];
    final int[] rejectedDates = new int[n];
    final double[] rejectedData = new double[n];
    final LocalDateDoubleEntryIterator it = ts.iterator();
    int i = 0, j = 0;
    while (it.hasNext()) {
      int date = it.nextTimeFast();
      double value = it.currentValue();
      if (Math.abs(value - median) > _standardDeviations * mad / .6745) {
        rejectedDates[j] = date;
        rejectedData[j++] = value;
      } else {
        filteredDates[i] = date;
View Full Code Here

    final int n = ts.size();
    final int[] filteredDates = new int[n];
    final double[] filteredData = new double[n];
    final int[] rejectedDates = new int[n];
    final double[] rejectedData = new double[n];
    final LocalDateDoubleEntryIterator it = ts.iterator();
    int i = 0, j = 0;
    while (it.hasNext()) {
      int date = it.nextTimeFast();
      double value = it.currentValue();
      if (value < 0) {
        rejectedDates[j] = date;
        rejectedData[j++] = value;
      } else {
        filteredDates[i] = date;
View Full Code Here

    final int[] filteredDates = new int[n];
    final double[] filteredData = new double[n];
    final int[] rejectedDates = new int[n];
    final double[] rejectedData = new double[n];
   
    LocalDateDoubleEntryIterator it = ts.iterator();
    int firstDate = it.nextTimeFast();
    double firstValue = it.currentValue();
    int secondDate = 0;
    double secondValue = 0;
    int i = 0, j = 0;
    // handle most pairs
    while (it.hasNext()) {
      secondDate = it.nextTimeFast();
      secondValue = it.currentValue();
      if (Math.abs(firstValue / secondValue - 1) < _maxPercentageMove) {
        filteredDates[i] = firstDate;
        filteredData[i++] = firstValue;
      } else {
        rejectedDates[j] = firstDate;
View Full Code Here

    final int n = ts.size();
    final int[] filteredDates = new int[n];
    final double[] filteredData = new double[n];
    final int[] rejectedDates = new int[n];
    final double[] rejectedData = new double[n];
    final LocalDateDoubleEntryIterator it = ts.iterator();
    int i = 0, j = 0;
    while (it.hasNext()) {
      int date = it.nextTimeFast();
      double value = it.currentValue();
      if (value > _maxValue || value < _minValue) {
        rejectedDates[j] = date;
        rejectedData[j++] = value;
      } else {
        filteredDates[i] = date;
View Full Code Here

TOP

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

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.