private static void PrintOnBar(IDataForward_Code klineDataForward)
        {
            Console.WriteLine("tick:" + klineDataForward.GetTickData());
            Console.WriteLine("1minute:" + klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_1Minute));
            Console.WriteLine("5minute:" + klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_5Minute));
            Console.WriteLine("15minute:" + klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_15Minute));
            Console.WriteLine("1day:" + klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_1Day));
            ITimeLineData timeLineData = klineDataForward.GetTimeLineData();

            Console.WriteLine("timeline:" + timeLineData);
        }
Esempio n. 2
0
        private static void AddToList(List <string> list, IDataForward_Code klineDataForward)
        {
            IKLineData klineData_1 = klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_1Minute);

            list.Add("DayEnd:" + klineDataForward.IsDayEnd
                     + "|1MinuteEnd:" + klineDataForward.IsPeriodEnd(KLinePeriod.KLinePeriod_1Minute)
                     + "|5MinuteEnd:" + klineDataForward.IsPeriodEnd(KLinePeriod.KLinePeriod_5Minute)
                     + "|15MinuteEnd:" + klineDataForward.IsPeriodEnd(KLinePeriod.KLinePeriod_15Minute)
                     + "|DayEnd:" + klineDataForward.IsPeriodEnd(KLinePeriod.KLinePeriod_1Day));
            list.Add("1minute:" + klineData_1);
            KLineData_RealTime klineData_5 = (KLineData_RealTime)klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_5Minute);

            list.Add("5minute:" + klineData_5);
            list.Add("5minute_" + klineData_5.GetCurrentBar_Original());
        }
        private void KlineDataForward_OnTick(object sender, IForwardOnTickArgument argument)
        {
            string txt = "tick:" + argument.TickInfo.TickBar;

            printStrs_Forward_Tick.Add(txt);
            Console.WriteLine(txt);

            IDataForward_Code klineDataForward = (IDataForward_Code)sender;
            double            price            = argument.TickInfo.TickData.Price;

            Assert.AreEqual(price, klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_1Minute).End);
            Assert.AreEqual(price, klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_5Minute).End);
            Assert.AreEqual(price, klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_15Minute).End);
            Assert.AreEqual(price, klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_1Day).End);
            Assert.AreEqual(price, klineDataForward.GetTimeLineData().Price);
        }
Esempio n. 4
0
        public void TestKLineDataForward_OnBar()
        {
            list_OnBar.Clear();
            string code    = "RB1710";
            int    start   = 20170601;
            int    endDate = 20170603;

            IDataForward_Code klineDataForward = GetDataForward(code, start, endDate);

            klineDataForward.OnBar += KlineDataForward_OnBar;
            list_OnBar.Add(KLinePeriod.KLinePeriod_1Minute + ":" + klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_1Minute));
            Console.WriteLine(KLinePeriod.KLinePeriod_1Minute + ":" + klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_1Minute));
            while (klineDataForward.Forward())
            {
            }

            AssertUtils.AssertEqual_List("forward_kline", GetType(), list_OnBar);
        }
Esempio n. 5
0
        private static void Print(IDataForward_Code klineDataForward)
        {
            //Console.WriteLine("DayEnd:" + klineDataForward.IsDayEnd
            //      + "|1MinuteEnd:" + klineDataForward.IsPeriodEnd(KLinePeriod.KLinePeriod_1Minute)
            //      + "|5MinuteEnd:" + klineDataForward.IsPeriodEnd(KLinePeriod.KLinePeriod_5Minute)
            //      + "|15MinuteEnd:" + klineDataForward.IsPeriodEnd(KLinePeriod.KLinePeriod_15Minute)
            //      + "|DayEnd:" + klineDataForward.IsPeriodEnd(KLinePeriod.KLinePeriod_1Day));
            //Console.WriteLine("1minute:" + klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_1Minute));
            //Console.WriteLine("5minute:" + klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_5Minute));
            //Console.WriteLine("15minute:" + klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_15Minute));
            //Console.WriteLine("1day:" + klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_1Day));
            //Console.WriteLine("timeline:" + klineDataForward.GetTimeLineData());

            double price = klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_1Minute).End;

            Assert.AreEqual(price, klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_5Minute).End);
            Assert.AreEqual(price, klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_15Minute).End);
            Assert.AreEqual(price, klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_1Day).End);
            Assert.AreEqual(price, klineDataForward.GetTimeLineData().Price);
        }
Esempio n. 6
0
        public void TestRealTimeReader()
        {
            string code    = "RB1710";
            int    start   = 20170601;
            int    endDate = 20170610;

            IDataForward_Code realTimeReader = GetRealTimeReader(code, start, endDate, false);

            while (!realTimeReader.IsEnd)
            {
                realTimeReader.Forward();
                IKLineData klineData = realTimeReader.GetKLineData(KLinePeriod.KLinePeriod_1Minute);
                Console.WriteLine(klineData);
            }
        }
        private static void Print(IDataForward_Code klineDataForward)
        {
            //Console.WriteLine("DayEnd:" + klineDataForward.IsDayEnd
            //      + "|1MinuteEnd:" + klineDataForward.IsPeriodEnd(KLinePeriod.KLinePeriod_1Minute)
            //      + "|5MinuteEnd:" + klineDataForward.IsPeriodEnd(KLinePeriod.KLinePeriod_5Minute)
            //      + "|15MinuteEnd:" + klineDataForward.IsPeriodEnd(KLinePeriod.KLinePeriod_15Minute)
            //      + "|DayEnd:" + klineDataForward.IsPeriodEnd(KLinePeriod.KLinePeriod_1Day));

            KLineData_RealTime klineData_1 = (KLineData_RealTime)klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_1Minute);

            Console.WriteLine("tick:" + klineDataForward.GetTickData());
            Console.WriteLine("1minute:" + klineData_1);
            Console.WriteLine("1minute_" + klineData_1.GetCurrentBar_Original());
            KLineData_RealTime klineData_1Day = (KLineData_RealTime)klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_1Day);

            Console.WriteLine("1day:" + klineData_1Day);
            ITimeLineData timeLineData = klineDataForward.GetTimeLineData();

            Console.WriteLine("timeline:" + timeLineData);

            Assert.AreEqual(klineData_1.End, timeLineData.Price);
            Assert.AreEqual(klineData_1.Mount, timeLineData.Mount);
            Assert.AreEqual(klineData_1.Hold, timeLineData.Hold);
        }
        private void KlineDataForward_OnBar1(object sender, IForwardOnBarArgument argument)
        {
            IDataForward_Code klineDataForward = (IDataForward_Code)sender;

            //Console.WriteLine("DayEnd:" + klineDataForward.IsDayEnd
            //        + "|1MinuteEnd:" + klineDataForward.IsPeriodEnd(KLinePeriod.KLinePeriod_1Minute)
            //        + "|5MinuteEnd:" + klineDataForward.IsPeriodEnd(KLinePeriod.KLinePeriod_5Minute)
            //        + "|15MinuteEnd:" + klineDataForward.IsPeriodEnd(KLinePeriod.KLinePeriod_15Minute)
            //        + "|DayEnd:" + klineDataForward.IsPeriodEnd(KLinePeriod.KLinePeriod_1Day));
            Console.WriteLine("1minute:" + klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_1Minute));
            Console.WriteLine("tradingTimeStart:" + klineDataForward.IsTradingTimeStart
                              + "|tradingTimeEnd:" + klineDataForward.IsTradingTimeEnd
                              + "|dayStart:" + klineDataForward.IsDayStart
                              + "|dayEnd:" + klineDataForward.IsDayEnd);
        }
Esempio n. 9
0
        //[TestMethod]
        public void TestKLineData_Play()
        {
            string code    = "RB1710";
            int    start   = 20170601;
            int    endDate = 20170601;

            IDataForward_Code klineDataForward = GetKLineDataForward(code, start, endDate);

            klineDataForward.OnTick += KlineDataForward_OnTick;
            Console.WriteLine(klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_1Minute));
            klineDataForward.Play();
            while (klineDataForward.Time < 20170531.210005)
            {
            }
            klineDataForward.Pause();
        }
Esempio n. 10
0
        public void TestKLineDataForward_Minute()
        {
            string code    = "RB1710";
            int    start   = 20170101;
            int    endDate = 20170803;

            IDataForward_Code klineDataForward = GetDataForward(code, start, endDate);

            //List<string> list = new List<string>();
            dic_Period_Content.Clear();
            klineDataForward.OnBar += KlineDataForward_OnBar;
            //AddToList(list, klineDataForward);
            //Print(klineDataForward);
            //Console.WriteLine(KLinePeriod.KLinePeriod_1Minute + ":" + klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_1Minute));
            AddContent(KLinePeriod.KLinePeriod_1Minute, klineDataForward.GetKLineData(KLinePeriod.KLinePeriod_1Minute).ToString());
            while (klineDataForward.Forward())
            {
            }

            AssertKLineDataInDic(code, start, endDate);
            //AssertUtils.AssertEqual_List("forward_bigperiod", GetType(), list);
        }