private void AssertText(string code, int start, int end, string fileName) { List <string> list_OnBar = new List <string>(); IDataPackage_Code datapackage = DataCenter.Default.DataPackageFactory.CreateDataPackage_Code(code, start, end, 0, 0); IKLineData_Extend klineData = datapackage.GetKLineData(KLinePeriod.KLinePeriod_1Minute); ITickData tickData = datapackage.GetTickData(start); KLineToTickIndeier indeier = new KLineToTickIndeier(tickData, klineData); int lastBarPos; for (int i = 0; i < tickData.Length; i++) { list_OnBar.Add("tick:" + tickData.GetBar(i)); Console.WriteLine("tick:" + tickData.GetBar(i)); int pos = indeier.GetKLineBarPosIfFinished(i, out lastBarPos); if (pos >= 0) { list_OnBar.Add(klineData.Period + ":" + klineData.GetBar(pos)); Console.WriteLine(klineData.Period + ":" + klineData.GetBar(pos)); for (int m = pos + 1; m <= lastBarPos; m++) { list_OnBar.Add(klineData.Period + ":" + klineData.GetBar(m)); Console.WriteLine(klineData.Period + ":" + klineData.GetBar(m)); //lastBarPos = 1; } } } AssertUtils.AssertEqual_List(fileName, GetType(), list_OnBar); }
private static void DoIndex(List <string> list_OnBar, IKLineData_Extend klineData, ITickData tickData, KLineToTickIndeier indeier) { int lastBarPos; for (int i = 0; i < tickData.Length; i++) { list_OnBar.Add("tick:" + tickData.GetBar(i)); Console.WriteLine("tick:" + tickData.GetBar(i)); int pos = indeier.GetKLineBarPosIfFinished(i, out lastBarPos); if (pos >= 0) { list_OnBar.Add(klineData.Period + ":" + klineData.GetBar(pos)); Console.WriteLine(klineData.Period + ":" + klineData.GetBar(pos)); for (int m = pos + 1; m <= lastBarPos; m++) { list_OnBar.Add(klineData.Period + ":" + klineData.GetBar(m)); Console.WriteLine(klineData.Period + ":" + klineData.GetBar(m)); } } } }