public void Removed()
    {
        List <UlcerIndexResult> results = quotes.GetUlcerIndex(14)
                                          .RemoveWarmupPeriods()
                                          .ToList();

        // assertions
        Assert.AreEqual(502 - 13, results.Count);

        UlcerIndexResult last = results.LastOrDefault();

        Assert.AreEqual(5.7255, Math.Round((double)last.UI, 4));
    }
    public void Standard()
    {
        List <UlcerIndexResult> results = quotes.GetUlcerIndex(14)
                                          .ToList();

        // assertions

        // proper quantities
        // should always be the same number of results as there is quotes
        Assert.AreEqual(502, results.Count);
        Assert.AreEqual(489, results.Where(x => x.UI != null).Count());

        // sample value
        UlcerIndexResult r = results[501];

        Assert.AreEqual(5.7255, Math.Round((double)r.UI, 4));
    }
Exemple #3
0
        public void GetUlcerIndex()
        {
            int lookbackPeriod = 14;
            List <UlcerIndexResult> results = Indicator.GetUlcerIndex(history, lookbackPeriod).ToList();

            // assertions

            // proper quantities
            // should always be the same number of results as there is history
            Assert.AreEqual(502, results.Count);
            Assert.AreEqual(502 - lookbackPeriod + 1, results.Where(x => x.UI != null).Count());

            // sample value
            UlcerIndexResult r = results[501];

            Assert.AreEqual(5.7255m, Math.Round((decimal)r.UI, 4));
        }
Exemple #4
0
        public void GetUlcerIndexTest()
        {
            int lookbackPeriod = 14;

            IEnumerable <UlcerIndexResult> results = Indicator.GetUlcerIndex(history, lookbackPeriod);

            // assertions

            // proper quantities
            // should always be the same number of results as there is history
            Assert.AreEqual(502, results.Count());
            Assert.AreEqual(502 - lookbackPeriod + 1, results.Where(x => x.UI != null).Count());

            // sample value
            UlcerIndexResult r = results.Where(x => x.Date == DateTime.ParseExact("12/31/2018", "MM/dd/yyyy", null)).FirstOrDefault();

            Assert.AreEqual((decimal)5.7255, Math.Round((decimal)r.UI, 4));
        }