Example #1
0
        private Point[] GetIndustryWheel(IEnumerable <MarketPaper> papers)
        {
            int[] days = { 5, 10, 20, 30, 60, 120, 250 };
            int   i;

            Point[] r = null;
            foreach (var p in papers)
            {
                PaperMa[] ma = new PaperMa[days.Length];
                for (i = 0; i < days.Length; i++)
                {
                    ma[i] = _maService.GetMa(p, days[i]);
                }

                if (ma[^ 1].Prices.Length == 0)
        public void Should_Get_Start_Index()
        {
            int      total = 100;
            DateTime now   = new DateTime(2020, 6, 1);

            PaperMa[]   ma = new PaperMa[5];
            MarketPaper p  = new MarketPaper("000001", "忘了是啥");

            for (int i = 0; i < 5; i++)
            {
                Point[] points = new Point[total / i];
                for (int j = 0; j < points.Length; j++)
                {
                    points[j].Time  = now.AddDays(j - points.Length + 1);
                    points[j].Value = j;
                }
                ma[i] = new PaperMa(i, points);
            }

            OrderedCalcPaperWheelTestWrapper wheel = new OrderedCalcPaperWheelTestWrapper(ma, p);

            wheel.GetStartIndexTest(ma[0], now)
            .ShouldBe(total - 1);
        }
 public int GetStartIndexTest(PaperMa ma, DateTime time)
 {
     return(base.GetStartIndex(ma, time));
 }