Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/19/13 11:29:28 (11 years ago)
Author:
gkronber
Message:

#1508

  • fixed a bug in the ECB problem instance provider (reversed time series)
  • improved the ProblemInstanceProviderViewGeneric class to show a progress bar while loading the problem instance
  • fixed the build fail (in SolutionLineChartView)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Trading/3.4/EcbProblemInstanceProvider.cs

    r9989 r9991  
    7878      var tList = new List<DateTime>();
    7979      var dList = new List<double>();
    80       double prevValue = 0;
    8180      values.Add(tList);
    8281      values.Add(dList);
     
    10099                if (descriptor.Name.Contains(reader.GetAttribute("currency"))) {
    101100                  reader.MoveToAttribute("rate");
    102                   var curValue = reader.ReadContentAsDouble();
    103                   if (!dList.Any())
    104                     dList.Add(0.0);
    105                   else {
    106                     dList.Add(curValue - prevValue);
    107                   }
    108                   prevValue = curValue;
     101                  dList.Add(reader.ReadContentAsDouble());
    109102
    110103                  reader.MoveToElement();
     
    117110          }
    118111      }
    119       var allowedInputVariables = new string[] { descriptor.Name };
    120       var targetVariable = descriptor.Name;
    121       var ds = new Dataset(new string[] { "Day", descriptor.Name }, values);
     112      // entries in ECB XML are ordered most recent first => reverse lists
     113      tList.Reverse();
     114      dList.Reverse();
     115      // calculate exchange rate deltas
     116      var changes = new[] { 0.0 } // first element
     117        .Concat(dList.Zip(dList.Skip(1), (prev, cur) => cur - prev)).ToList();
     118      values.Add(changes);
     119
     120      var targetVariable = "d(" + descriptor.Name + ")";
     121      var allowedInputVariables = new string[] { targetVariable };
     122
     123      var ds = new Dataset(new string[] { "Day", descriptor.Name, targetVariable }, values);
    122124      return new ProblemData(ds, allowedInputVariables, targetVariable);
    123125    }
Note: See TracChangeset for help on using the changeset viewer.