Пример #1
0
        private IKLineData GetData_Day(KLinePeriod period)
        {
            if (period.PeriodType != KLineTimeType.DAY)
            {
                return(null);
            }

            int                beforeStartDate    = dataReader.TradingDayReader.GetPrevTradingDay(startDate, beforeBarCount);
            IKLineData         klineData          = dataReader.KLineDataReader.GetData(code, beforeStartDate, endDate, period);
            KLineData_RealTime klineData_RealTime = new KLineData_RealTime(klineData);
            int                index = klineData_RealTime.IndexOfTime(startDate);

            klineData_RealTime.BarPos = index;
            return(klineData_RealTime);
        }
Пример #2
0
        private IKLineData GetData_Minute(KLinePeriod period)
        {
            if (period.PeriodType != KLineTimeType.MINUTE)
            {
                return(null);
            }

            int day = beforeBarCount * period.Period / 225;

            int                beforeStartDate    = dataReader.TradingDayReader.GetPrevTradingDay(startDate, day);
            IKLineData         klineData          = dataReader.KLineDataReader.GetData(code, beforeStartDate, endDate, period);
            KLineData_RealTime klineData_RealTime = new KLineData_RealTime(klineData);
            TradingSession     session            = tradingSessionReader.GetTradingSession(startDate);
            int                index = klineData_RealTime.IndexOfTime(session.StartTime);

            klineData_RealTime.BarPos = index;

            return(klineData_RealTime);
        }