Example #1
0
        public ActionResult GetQiHao()
        {
            Tcp_Hiscode tcp = new Tcp_Hiscode();

            if (!tcp.GetLastSingle())
            {
                return(FailResult("获取失败"));
            }


            return(SuccessResult(JsonProvider.ToJson(tcp.DataRow)));
        }
Example #2
0
        public async void StarSprider()
        {
            Tcp_Hiscode tcp = new Tcp_Hiscode();

            if (!tcp.GetLastSingle())
            {
                MessageBox.Show("采集失败!");
                this.timer1.Stop();
            }
            DateTime DBTime = tcp.Datetime.Value;
            DateTime Today  = DateTime.Today;

            TimeSpan ts = Today - DBTime;

            int days = ts.Days;

            DateTime endday = DateTime.Today;
            DateTime sarday = DateTime.Today.AddDays(0 - days);


            while (sarday <= endday)
            {
                string today = sarday.ToString("yyyyMMdd");
                string url   = string.Format("http://kaijiang.500.com/static/public/ssc/xml/qihaoxml/{0}.xml?_A=IEAKFSZM1534655958600", today);

                sarday = sarday.AddDays(1);

                HttpClient client = new HttpClient();
                string     html   = await client.GetStringAsync(url);

                SysOpenCode.xml xml = XmlHelper.Deserialize <SysOpenCode.xml>(html);

                for (int j = 0; j < xml.row.Count; j++)
                {
                    Tcp_Hiscode t = new Tcp_Hiscode();
                    t.Expect   = xml.row[j].expect;
                    t.Opencode = xml.row[j].opencode;
                    t.Datetime = DateTime.Parse(xml.row[j].opentime);

                    if (t.SelectByExpect(t.Expect))
                    {
                        continue;
                    }


                    if (t.Insert())
                    {
                        this.textBox1.Text += "\r\n" + t.Expect;
                    }
                }
            }
        }
Example #3
0
        public ActionResult HuiCe()
        {
            string expect = Request.Form["expect"];

            int lid = int.Parse(Request.Form["lid"]);

            Tcp_Clscript tcp = new Tcp_Clscript();

            if (!tcp.SelectByPK(lid))
            {
                return(FailResult("获取策略脚本失败!"));
            }
            CPQaunt.Facade.BuilderScriptFacade builder = new CPQaunt.Facade.BuilderScriptFacade();

            MessageScriptModel message = builder.Builder(expect, tcp.Content);  //得到下注数字集合

            if (message.type == MessageType.Log)
            {
                return(FailResult(message.message));
            }

            Tcp_Hiscode tcphis = new Tcp_Hiscode();

            if (tcphis.SelectByExpect(expect))
            {
                string[]    sl     = tcphis.Opencode.Split(',');
                NumberModel number = new NumberModel();
                number.N1 = int.Parse(sl[0]);
                number.N2 = int.Parse(sl[1]);
                number.N3 = int.Parse(sl[2]);
                number.N4 = int.Parse(sl[3]);
                number.N5 = int.Parse(sl[4]);

                foreach (var item in message.numbers)
                {
                    if (item.N1 == number.N1 && item.N2 == number.N2 && item.N3 == number.N3 && item.N4 == number.N4 && item.N5 == number.N5)
                    {
                        return(SuccessResult(message.numbers.Count));
                    }
                }
                return(SuccessResult("0"));
            }
            return(FailResult("回测失败!"));
        }
Example #4
0
        private async void button1_Click(object sender, EventArgs e)
        {
            int days = 0 - int.Parse(this.textBox1.Text);

            DateTime endday = DateTime.Today;
            DateTime sarday = DateTime.Today.AddDays(days);


            while (sarday <= endday)
            {
                string today = sarday.ToString("yyyyMMdd");
                string url   = string.Format("http://kaijiang.500.com/static/public/ssc/xml/qihaoxml/{0}.xml?_A=IEAKFSZM1534655958600", today);

                sarday = sarday.AddDays(1);

                HttpClient client = new HttpClient();
                string     html   = await client.GetStringAsync(url);

                xml xml = XmlHelper.Deserialize <xml>(html);

                for (int j = 0; j < xml.row.Count; j++)
                {
                    Tcp_Hiscode t = new Tcp_Hiscode();
                    t.Expect   = xml.row[j].expect;
                    t.Opencode = xml.row[j].opencode;
                    t.Datetime = DateTime.Parse(xml.row[j].opentime);

                    if (t.selectbyecpect(t.Expect))
                    {
                        continue;
                    }


                    if (t.Insert())
                    {
                        //this.textBox1.Text += "\r\n" + t.Expect;
                    }
                }
            }


            MessageBox.Show("更新完成!");
        }