public void RecordsPopulationAverageScoresOnInsightAnalysisCompleted()
        {
            var time              = new DateTime(2000, 01, 01);
            var stats             = new StatisticsInsightManagerExtension(new TestAccountCurrencyProvider());
            var insight           = Insight.Price(Symbols.SPY, Time.OneDay, InsightDirection.Up);
            var spySecurityValues = new SecurityValues(insight.Symbol, time, SecurityExchangeHours.AlwaysOpen(TimeZones.NewYork), 100m, 1m, 125000, 1m);
            var context           = new InsightAnalysisContext(insight, spySecurityValues, insight.Period);

            context.Score.SetScore(InsightScoreType.Direction, .55, time);
            context.Score.SetScore(InsightScoreType.Magnitude, .25, time);
            stats.OnInsightAnalysisCompleted(context);
            Assert.AreEqual(context.Score.Direction, stats.Statistics.RollingAveragedPopulationScore.Direction);
            Assert.AreEqual(context.Score.Magnitude, stats.Statistics.RollingAveragedPopulationScore.Magnitude);
        }
Example #2
0
        public void IgnoresFlatInsightsWithScore(InsightScoreType scoreType, InsightType insightType, double?magnitude)
        {
            var time              = new DateTime(2000, 01, 01);
            var stats             = new StatisticsInsightManagerExtension(new TestAccountCurrencyProvider());
            var insight           = new Insight(Symbols.SPY, TimeSpan.FromDays(1), insightType, InsightDirection.Flat, magnitude, null);
            var spySecurityValues = new SecurityValues(insight.Symbol, time, SecurityExchangeHours.AlwaysOpen(TimeZones.NewYork), 100m, 1m, 125000, 1m);
            var context           = new InsightAnalysisContext(insight, spySecurityValues, insight.Period);

            context.Score.SetScore(InsightScoreType.Direction, .55, time);
            context.Score.SetScore(InsightScoreType.Magnitude, .25, time);
            stats.OnInsightAnalysisCompleted(context);
            Assert.AreEqual(0.0, stats.Statistics.RollingAveragedPopulationScore.Direction);
            Assert.AreEqual(0.0, stats.Statistics.RollingAveragedPopulationScore.Magnitude);
        }
        public void DefaultConstructorHasZeroWarmupPeriodForPopulationAverageScores()
        {
            var stats = new StatisticsInsightManagerExtension(new TestAccountCurrencyProvider());

            Assert.IsTrue(stats.RollingAverageIsReady);
        }