コード例 #1
0
        private void ForwardNextDay_KLine(KLineData_RealTime klineData, KLinePeriod period)
        {
            if (period.PeriodType >= KLineTimeType.DAY)
            {
                double day            = currentTickData.TradingDay;
                int    nextKLineIndex = FindNextKLineIndex(klineData, day);
                if (nextKLineIndex != klineData.BarPos)
                {
                    dic_KLinePeriod_IsEnd[period] = true;
                    klineData.SetRealTimeData(GetKLineBar(currentTickData), nextKLineIndex);
                }
                else
                {
                    dic_KLinePeriod_IsEnd[period] = false;
                    klineData.SetRealTimeData(GetKLineBar(klineData, currentTickData));
                }
                return;
            }

            ITickBar tickBar = currentTickData.GetCurrentBar();
            KLineData_DaySplitter daySplitter = dic_Period_DaySplitter[period];

            daySplitter.NextDay();
            //klineData.BarPos = daySplitter.CurrentDayKLineIndex;
            ForwardKLine_NextPeriod(klineData, daySplitter.CurrentDayKLineIndex, tickBar);
        }
コード例 #2
0
        private void InitDaySplitter(IDataReader dataReader, string code)
        {
            ITradingSessionReader_Instrument sessionReader = dataReader.CreateTradingSessionReader(code);

            this.dic_Period_DaySplitter = new Dictionary <KLinePeriod, KLineData_DaySplitter>();
            foreach (KLinePeriod period in dic_Period_KLineData.Keys)
            {
                KLineData_RealTime    klineData   = dic_Period_KLineData[period];
                KLineData_DaySplitter daySplitter = new KLineData_DaySplitter(klineData, sessionReader);
                dic_Period_DaySplitter.Add(period, daySplitter);
            }
        }
コード例 #3
0
 public KLineDataForward_BigPeriod(KLineData_RealTime mainKLineData, Dictionary <KLinePeriod, KLineData_RealTime> allKLineData, ITradingSessionReader_Instrument tradingSessionReader) : this(mainKLineData, allKLineData)
 {
     this.daySplitter = new KLineData_DaySplitter(mainKLineData, tradingSessionReader);
     this.daySplitter.NextDay();
     this.daySplitter.NextDay();
 }