Changeset 9991 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Trading
- Timestamp:
- 09/19/13 11:29:28 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Trading/3.4/EcbProblemInstanceProvider.cs
r9989 r9991 78 78 var tList = new List<DateTime>(); 79 79 var dList = new List<double>(); 80 double prevValue = 0;81 80 values.Add(tList); 82 81 values.Add(dList); … … 100 99 if (descriptor.Name.Contains(reader.GetAttribute("currency"))) { 101 100 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()); 109 102 110 103 reader.MoveToElement(); … … 117 110 } 118 111 } 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); 122 124 return new ProblemData(ds, allowedInputVariables, targetVariable); 123 125 }
Note: See TracChangeset
for help on using the changeset viewer.