Пример #1
0
        public void TestTransferKLine_Day()
        {
            string                 code      = "m1405";
            IKLineData             data_1min = MockDataLoader.GetKLineData(code, 20131216, 20131231, new KLinePeriod(KLineTimeType.MINUTE, 1));
            CacheUtils_TradingTime cache     = new CacheUtils_TradingTime(code, MockDataLoader.GetTradingTimeList(code));
            IKLineData             data      = DataTransfer_KLine2KLine.Transfer_Day(data_1min, new KLinePeriod(KLineTimeType.DAY, 1), cache);

            AssertUtils.AssertEqual_KLineData("Kline2kline_M05_20131216_20131231_Day", GetType(), data);
        }
Пример #2
0
        public void TestTransferKLine_DayOverNight()
        {
            string                 code      = "m1505";
            IKLineData             klineData = MockDataLoader.GetKLineData(code, 20141215, 20150116, KLinePeriod.KLinePeriod_1Minute);
            CacheUtils_TradingTime cache     = new CacheUtils_TradingTime(code, MockDataLoader.GetTradingTimeList(code));
            IKLineData             data      = DataTransfer_KLine2KLine.Transfer_Day(klineData, new KLinePeriod(KLineTimeType.DAY, 1), cache);

            AssertUtils.AssertEqual_KLineData("Kline2Kline_M05_20141215_20150116_Day", GetType(), data);
        }
Пример #3
0
        public void TestTransferKLine_Minute()
        {
            string                 code        = "m1405";
            int                    start       = 20131216;
            int                    end         = 20131231;
            List <double[]>        tradingTime = MockDataLoader.GetTradingTime(code, start);
            IKLineData             data_1min   = MockDataLoader.GetKLineData(code, start, end, KLinePeriod.KLinePeriod_1Minute);
            CacheUtils_TradingTime cache       = new CacheUtils_TradingTime(code, MockDataLoader.GetTradingTimeList(code));

            //转换成5分钟线
            IKLineData data = DataTransfer_KLine2KLine.Transfer(data_1min, KLinePeriod.KLinePeriod_5Minute, cache);

            AssertUtils.AssertEqual_KLineData("Kline2Kline_M05_20131216_20131231_5Minute", GetType(), data);

            //转换成15分钟
            data = DataTransfer_KLine2KLine.Transfer(data_1min, new KLinePeriod(KLineTimeType.MINUTE, 15), cache);
            AssertUtils.AssertEqual_KLineData("Kline2Kline_M05_20131216_20131231_15Minute", GetType(), data);

            //转换成1小时
            data = DataTransfer_KLine2KLine.Transfer(data_1min, new KLinePeriod(KLineTimeType.HOUR, 1), cache);
            AssertUtils.AssertEqual_KLineData("Kline2Kline_M05_20131216_20131231_1Hour", GetType(), data);
        }