示例#1
0
        private void button6_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 <ShareIndex> shareindexList = new List <ShareIndex>();

            DateTime jt = new DateTime(2016, 3, 28);

            //int i = 0, j = 0;
            //string symbolList = "";
            //foreach (Instrument inst in insts)
            //{
            //    i++;
            //    j++;
            //    symbolList += inst.symbol + ",";
            //    if (i >= 10 || j >= insts.Count)
            //    {
            //         List <GMSDK.ShareIndex> shareIndexs = md.GetShareIndex(symbolList, jt.ToString("yyyy-MM-dd"), jt.ToString("yyyy-MM-dd"));
            //        foreach (GMSDK.ShareIndex shareIndex in shareIndexs)
            //        {
            //            shareindexList.Add(shareIndex);
            //        }
            //        i = 0;
            //        symbolList = "";
            //    }
            //}
            shareindexList = md.GetShareIndex("SZSE.000001", "2017-04-17", "2017-04-17");
            ShowData(shareindexList.OfType <object>().ToList());
            this.label1.Text = shareindexList.Count.ToString();
        }