public PaperMa GetMa(MarketPaper paper, int n) { if (paper == null) { throw new ArgumentNullException(nameof(paper)); } if (n <= 0) { throw new ArgumentException(nameof(n)); } if (paper.ExchangeInfo == null || paper.ExchangeInfo.Count < n) { return(new PaperMa(n)); } // TODO: 保证数据已排序,连续 return(new PaperMa(n, GetMa(paper.ExchangeInfo, n))); }
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 OrderedCalcPaperWheel(PaperMa[] ma, MarketPaper paper) { _paper = paper; _ma = ma; start = _ma[^ 1].Prices.Length;
public OrderedCalcPaperWheelTestWrapper(PaperMa[] ma, MarketPaper paper) : base(ma, paper) { }