public void BuildYahooNormalized_ShouldBuildCorrectYahooNormalized() { var date = new DateTime(2015, 01, 01); var record = new YahooRecord { Date = date, Open = 1.1230004, High = 2.1230004, Low = 0.1230004, Close = 2.0230004, Volume = 123456789012 }; var yahooNormalized = YahooHelper.BuildYahooNormalized(record, 0.11, 0.13, 0.1234567890123); Assert.AreEqual(date, yahooNormalized.Date); Assert.AreEqual(1.1230004, yahooNormalized.Open); Assert.AreEqual(2.1230004, yahooNormalized.High); Assert.AreEqual(0.1230004, yahooNormalized.Low); Assert.AreEqual(2.0230004, yahooNormalized.Close); Assert.AreEqual(123456789012, yahooNormalized.Volume); Assert.AreEqual(0.11, yahooNormalized.Change); Assert.AreEqual(0.13, yahooNormalized.MovingAverage); Assert.AreEqual(0.1234567890123, yahooNormalized.Volatility); }
public static YahooNormalized BuildYahooNormalized(YahooRecord record, double change, double movingAverage, double volatility) { return(new YahooNormalized { Date = record.Date, Open = record.Open, High = record.High, Low = record.Low, Close = record.Close, Volume = record.Volume, Change = change, MovingAverage = movingAverage, Volatility = volatility }); }
public void NormalizeData_ShouldNormalizeDataCorrectly() { _dataRepository.LoadData(_dataFilePath); _dataRepository.NormalizeData(); YahooRecord record = _dataRepository.CsvLinesNormalized[0]; Assert.AreEqual("05/04/2015 00:00:00", record.Date.ToString(CultureInfo.InvariantCulture)); Assert.AreEqual(2110.22998, record.Open); Assert.AreEqual(2120.94995, record.High); Assert.AreEqual(2110.22998, record.Low); Assert.AreEqual(2114.48999, record.Close); Assert.AreEqual(3091580000, record.Volume); Assert.AreEqual(2114.48999, record.AdjClose); }