Esempio n. 1
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("TradingDay:");
            sb.Append(tradingDay).Append(",");
            sb.Append(startPos).Append(",");
            sb.Append(endPos).Append(",");
            sb.Append(holidayCount).Append("\r\n");
            for (int i = 0; i < tradingPeriodsArr.Count; i++)
            {
                IKLineDataTradingTimeInfo_Periods periods = tradingPeriodsArr[i];
                sb.Append(periods.ToString()).Append("\r\n");
            }
            return(sb.ToString());
        }
Esempio n. 2
0
        public void TestGetKLineTimeInfo_Day()
        {
            string                   code          = "rb1805";
            int                      start         = 20170928;
            int                      end           = 20171020;
            IKLineData               klineData     = DataCenter.Default.DataReader.KLineDataReader.GetData(code, start, end, KLinePeriod.KLinePeriod_1Minute);
            IList <ITradingTime>     tradingTimes  = DataCenter.Default.DataReader.CreateTradingTimeReader(code).GetTradingTime(start, end);
            KLineDataTradingTimeInfo klineTimeInfo = new KLineDataTradingTimeInfo(klineData, tradingTimes);

            AssertUtils.PrintList(klineTimeInfo.TradingDays);
            Console.WriteLine();
            //for(int i = 0; i < klineTimeInfo.TradingDays.Count; i++)
            //{
            //    int tradingDay = klineTimeInfo.TradingDays[i];
            //    // klineTimeInfo.GetKLineTimeInfo_Day(tradingDay);
            //}
            Console.WriteLine(klineTimeInfo);

            IKLineDataTradingTimeInfo_Periods periods = klineTimeInfo.GetTradingPeriodsByBarPos(350);

            Assert.AreEqual("TradingPeriods:0,345,464", periods.ToString());
            //Console.WriteLine(periods);
        }