Beispiel #1
0
        public IDataForward_Code CreateDataForward_Code(XmlElement xmlElem)
        {
            string forwardType = xmlElem.GetAttribute("forwardType");

            if (forwardType.Equals("kline"))
            {
                DataForward_Code_KLine dataForward = new DataForward_Code_KLine(dataCenter);
                dataForward.Load(xmlElem);
                return(dataForward);
            }
            else if (forwardType.Equals("tick"))
            {
                DataForward_Code_Tick2 dataForward = new DataForward_Code_Tick2(dataCenter);
                dataForward.Load(xmlElem);
                return(dataForward);
            }
            return(null);
        }
Beispiel #2
0
        private void ForwardToday_TimeLine(ITimeLineData_RealTime timeLineData, double time, ITickData tickData, int prevTickIndex)
        {
            if (timeLineData == null)
            {
                return;
            }
            int nextTimeLineIndex = DataForward_Code_Tick2.FindNextTimeLineIndex(timeLineData, time);

            if (nextTimeLineIndex == timeLineData.BarPos)
            {
                timeLineData.ChangeCurrentBar(TimeLineUtils.GetTimeLineBar(timeLineData, tickData, prevTickIndex, tickData.BarPos, timeLineData.YesterdayEnd));
            }
            else
            {
                double periodStartTime = timeLineData.Arr_Time[nextTimeLineIndex];
                int    startTickIndex  = FindNextTickIndex(tickData, prevTickIndex, time);
                timeLineData.ChangeCurrentBar(TimeLineUtils.GetTimeLineBar(tickData, startTickIndex, tickData.BarPos, timeLineData.YesterdayEnd), nextTimeLineIndex);
            }
        }
Beispiel #3
0
        private void ForwardToday_KLine(IKLineData_RealTime klineData, double time, ITickData tickData, int prevTickIndex)
        {
            if (klineData.Period.Equals(KLinePeriod.KLinePeriod_1Day))
            {
                klineData.ChangeCurrentBar(KLineUtils.GetKLineBar(klineData, tickData, prevTickIndex, tickData.BarPos));
                return;
            }

            int nextKLineIndex = DataForward_Code_Tick2.FindNextKLineIndex(klineData, time);

            if (nextKLineIndex == klineData.BarPos)
            {
                klineData.ChangeCurrentBar(KLineUtils.GetKLineBar(klineData, tickData, prevTickIndex, tickData.BarPos));
            }
            else
            {
                double periodStartTime = klineData.Arr_Time[nextKLineIndex];
                int    startTickIndex  = FindNextTickIndex(tickData, prevTickIndex, time);
                klineData.ChangeCurrentBar(KLineUtils.GetKLineBar(tickData, startTickIndex, tickData.BarPos), nextKLineIndex);
            }
        }
Beispiel #4
0
 public void ForwardNextDay(int tradingDay, double time)
 {
     DataForward_Code_Tick2.ForwardNextDay(this.dataForForward, tradingDay);
 }