Esempio n. 1
0
        public void TestWindowSize()
        {
            SmaMetric sma = new SmaMetric("GOOG", 4, 5);

            sma.Add(new DateTime(2013, 6, 13, 5, 0, 0), 1000);
            sma.Add(new DateTime(2013, 6, 13, 5, 0, 5), 10);
            sma.Add(new DateTime(2013, 6, 13, 5, 0, 10), 10);
            sma.Add(new DateTime(2013, 6, 13, 5, 0, 15), 10);
            sma.Add(new DateTime(2013, 6, 13, 5, 0, 20), 10);

            Assert.AreEqual(10, sma.Avg);
        }
Esempio n. 2
0
        public void TestIntervals()
        {
            SmaMetric sma = new SmaMetric("GOOG", 5, 5);

            sma.Add(new DateTime(2013, 6, 13, 5, 0, 0), 10);
            sma.Add(new DateTime(2013, 6, 13, 5, 0, 2), 1000);
            sma.Add(new DateTime(2013, 6, 13, 5, 0, 5), 10);
            sma.Add(new DateTime(2013, 6, 13, 5, 0, 7), 1000);
            sma.Add(new DateTime(2013, 6, 13, 5, 0, 10), 10);

            Assert.AreEqual(10, sma.Avg);
        }
Esempio n. 3
0
        public void ComputeAverage()
        {
            SmaMetric sma = new SmaMetric("GOOG", 5, 5);

            sma.Add(new DateTime(2013, 6, 13, 5, 0, 0), 10);
            sma.Add(new DateTime(2013, 6, 13, 5, 0, 5), 20);
            sma.Add(new DateTime(2013, 6, 13, 5, 0, 10), 10);
            sma.Add(new DateTime(2013, 6, 13, 5, 0, 15), 20);
            sma.Add(new DateTime(2013, 6, 13, 5, 0, 20), 10);

            Assert.AreEqual(14, sma.Avg);
        }
Esempio n. 4
0
        public void TestMinutesLabel()
        {
            SmaMetric sma = new SmaMetric("GOOG", 50, 300);

            Assert.AreEqual("5m SMA", sma.Label);
        }
Esempio n. 5
0
        public void TestHoursLabel()
        {
            SmaMetric sma = new SmaMetric("GOOG", 50, 3600);

            Assert.AreEqual("1h SMA", sma.Label);
        }
Esempio n. 6
0
        public void AverageWithNoQuotes()
        {
            SmaMetric sma = new SmaMetric("GOOG", 5, 5);

            Assert.AreEqual(0, sma.Avg);
        }