Пример #1
0
 private TimeSeries GetEqualSeries(TimeSeries values1, TimeSeries values2)
 {
     TimeSeries timeSeries = new TimeSeries();
     for (int index = 0; index < values2.Count; ++index)
     {
         DateTime dateTime = values1.GetDateTime(index);
         if (values2.Contains(dateTime))
             timeSeries.Add(dateTime, values1[index]);
     }
     return timeSeries;
 }
Пример #2
0
 public static TimeSeries operator /(double Value, TimeSeries series)
 {
     if (series == null)
     {
         throw new ArgumentException("Operator argument can not be null");
     }
     TimeSeries timeSeries = new TimeSeries(string.Concat(new string[]
     {
         "(",
         Value.ToString("F2"),
         "/",
         series.Name,
         ")"
     }), "");
     for (int i = 0; i < series.Count; i++)
     {
         if (series[i, 0] != 0.0)
         {
             timeSeries.Add(series.GetDateTime(i), Value / series[i, 0]);
         }
     }
     return timeSeries;
 }
Пример #3
0
 public virtual TimeSeries GetReturnSeries()
 {
     TimeSeries timeSeries = new TimeSeries(this.name, this.description + " (return)");
     if (this.Count > 1)
     {
         double num = this[0];
         for (int i = 0; i < this.Count; i++)
         {
             DateTime dateTime = this.GetDateTime(i);
             double num2 = this[i];
             if (num != 0.0)
             {
                 timeSeries.Add(dateTime, num2 / num);
             }
             else
             {
                 timeSeries.Add(dateTime, 0.0);
             }
             num = num2;
         }
     }
     return timeSeries;
 }
Пример #4
0
 public static TimeSeries operator /(TimeSeries series1, TimeSeries series2)
 {
     if (series1 == null || series2 == null)
     {
         throw new ArgumentException("Operator argument can not be null");
     }
     TimeSeries timeSeries = new TimeSeries(string.Concat(new string[]
     {
         "(",
         series1.Name,
         "/",
         series2.Name,
         ")"
     }), "");
     for (int i = 0; i < series1.Count; i++)
     {
         DateTime dateTime = series1.GetDateTime(i);
         if (series2.Contains(dateTime) && series2[dateTime, SearchOption.Exact] != 0.0)
         {
             timeSeries.Add(dateTime, series1[dateTime, 0] / series2[dateTime, 0]);
         }
     }
     return timeSeries;
 }
Пример #5
0
 public virtual TimeSeries GetPositiveSeries()
 {
     TimeSeries timeSeries = new TimeSeries();
     for (int i = 0; i < this.Count; i++)
     {
         if (this[i] > 0.0)
         {
             timeSeries.Add(this.GetDateTime(i), this[i]);
         }
     }
     return timeSeries;
 }