Пример #1
0
        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);
        }
Пример #2
0
 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
     };
 }