Ejemplo n.º 1
0
        public IKLineData GetKLineData(string code, int startDate, int endDate, KLinePeriod period)
        {
            ITradingDayReader openDateReader = dataReaderFactory.OpenDateReader;

            IList <int>       openDates     = openDateReader.GetOpenDates(startDate, endDate);
            int               prevOpenDate  = openDateReader.GetPrevOpenDate(startDate);
            IKLineData        lastKLineData = dataReaderFactory.KLineDataReader.GetData(code, prevOpenDate, prevOpenDate, period);
            List <IKLineData> klineDataList = new List <IKLineData>();

            for (int i = 0; i < openDates.Count; i++)
            {
                int      openDate = openDates[i];
                TickData tickdata = dataReaderFactory.TickDataReader.GetTickData(code, openDate);
                if (tickdata != null)
                {
                    List <double[]>   openTimes = dataProvider.GetOpenTime(code, openDate);
                    OpenTimeUtilsArgs args      = new OpenTimeUtilsArgs(openDate, openDateReader, openTimes, period);
                    KLineData         klineData = DataTransfer_Tick2KLine2.Transfer(tickdata, lastKLineData, args);
                    klineDataList.Add(klineData);
                }
            }
            if (klineDataList.Count == 0)
            {
                return(null);
            }
            return(KLineData.Merge(klineDataList));
        }
Ejemplo n.º 2
0
        public static KLineData Transfer(int date, TickData data, ITradingDayReader openDateReader, List <double[]> opentime, KLinePeriod targetPeriod, KLineData lastKLineData)
        {
            DataTransfer_Tick2KLine2 transfer = new DataTransfer_Tick2KLine2(data, lastKLineData, new OpenTimeUtilsArgs(date, openDateReader, opentime, targetPeriod));

            return(transfer.CalcKLineData());
        }
Ejemplo n.º 3
0
        public static KLineData Transfer(TickData data, IKLineData lastKLineData, OpenTimeUtilsArgs args)
        {
            DataTransfer_Tick2KLine2 transfer = new DataTransfer_Tick2KLine2(data, lastKLineData, args);

            return(transfer.CalcKLineData());
        }