Пример #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            MdApi md  = MdApi.Instance;
            int   ret = md.Init("*****@*****.**", "Chs771005", MDMode.MD_MODE_NULL);

            if (ret != 0)
            {
                //登录失败
                return;
            }
            //List<Instrument> insts = md.GetInstruments("SHSE", 1, 1);
            //insts.AddRange(md.GetInstruments("SZSE", 1, 1));
            List <Tick> tickLists = new List <Tick>();
            //foreach (Instrument inst in insts)
            //{
            //    List<Tick> tickList = md.GetLastNTicks(inst.symbol, 1, "2016-03-26 15:01:00");
            //    tickLists.AddRange(tickList);
            //}
            List <Tick> tickList = md.GetLastNTicks("SHSE.600830", 1, "2018-08-13 15:00:00");

            //List<Tick> tickList = md.GetTicks("SHSE.600830", "2018-08-13 00:00:00", "2018-08-13 15:05:00");
            //List<Tick> tickList = md.GetTicks("SZSE.300334", "2017-05-12 00:00:00", "2017-05-12 15:00:00");
            tickLists.AddRange(tickList);
            DateTime startTimeUTC = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));

            foreach (Tick tick in tickLists)
            {
                tick.strtime = startTimeUTC.AddSeconds(tick.utc_time).ToString();
            }
            ShowData(tickLists.OfType <object>().ToList());
            this.label1.Text = tickLists.Count.ToString();
        }