예제 #1
0
        private void 设置ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            formmodelrun.timer1.Enabled = false;

            FormSet set = new FormSet();

            set.init = new delete_init(axHSQuanTrade1.Init);

            set.fsr = formmodelrun;

            if (set.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
            }

            formmodelrun.timer1.Enabled = true;
        }
예제 #2
0
        //加载风控配置
        private void LoadRiskConfig(string filename)
        {
            string path = FormSet.GetFilePath(filename);

            if (path == "")
            {
                return;
            }
            try
            {
                XmlDocument XmlDoc = new XmlDocument();
                XmlDoc.Load(path);

                XmlNode     xmlContext  = XmlDoc.SelectSingleNode("risk");
                XmlNodeList xmlChildLst = xmlContext.ChildNodes;

                string account  = "";
                string open     = "";
                string margin   = "";
                string withdraw = "";
                string pl       = "";
                foreach (XmlNode oXmlNode in xmlChildLst)
                {
                    //riskinfo
                    if (oXmlNode.Name == "riskinfo")
                    {
                        account = oXmlNode.Attributes["account"].Value;
                        open    = oXmlNode.Attributes["open"].Value;
                        XmlNodeList info = oXmlNode.ChildNodes;
                        margin   = info[0].InnerText.Trim();
                        withdraw = info[1].InnerText.Trim();
                        pl       = info[2].InnerText.Trim();

                        //风控信息
                        string riskinfo = "risk;";
                        riskinfo += account + ";" + margin + ";" + withdraw + ";" + pl + ";" + open + ";";
                        axHSQuanTrade1.Init(riskinfo);
                    }
                }
            }
            catch (System.Exception ex)
            {
                Log.WriteLog("LoadRiskConfig" + ex.ToString(), 1);
            }
        }
예제 #3
0
        private void LoadViewConfig()
        {
            List <ToolStripMenuItem> menus = new List <ToolStripMenuItem>();

            menus.Add(SysMS);
            menus.Add(TradeMS);
            menus.Add(FormMS);
            menus.Add(HelpMS);

            string islogin = "******";

            string menuitem = "";

            try
            {
                string filepath = FormSet.GetFilePath("Menu.xml");
                if (filepath == "")
                {
                    return;
                }
                XmlDocument XmlDoc = new XmlDocument();
                XmlDoc.Load(filepath);

                XmlNode     xmlContext  = XmlDoc.SelectSingleNode("Menu");
                XmlNodeList xmlChildLst = xmlContext.ChildNodes;

                foreach (XmlNode oXmlNode in xmlChildLst)
                {
                    //visible
                    if (oXmlNode.Name == "visible")
                    {
                        XmlNodeList items = oXmlNode.ChildNodes;
                        foreach (XmlNode item in items)
                        {
                            if (item.Name == "SysMS")
                            {
                                islogin = item.Attributes["login"].Value;
                            }
                            menuitem += item.InnerText;
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                Log.WriteLog("LoadViewConfig" + ex.ToString(), 1);
            }

            //显示哪些菜单
            for (int i = 0; i < menus.Count; i++)
            {
                foreach (ToolStripItem item in menus[i].DropDownItems)
                {
                    if (menuitem.IndexOf(item.Name) >= 0)
                    {
                        item.Visible = true;
                    }
                    else
                    {
                        item.Visible = false;
                    }
                }
            }

            //是否立即登录
            if (islogin == "1")
            {
                foreach (AccountInfo info in FormSet.listAccount)
                {
                    string login = "******";

                    login = login + info.account + ";" + info.pwd + ";" + info.serverip + ";" + info.apitype + ";" + info.brokeid + ";#";

                    axHSQuanTrade1.Init(login);

                    //延迟100ms
                    testExcel.timeDelay(100);
                }
            }
        }
예제 #4
0
        public string LoadAccountConfig()
        {
            //开始需要清空list
            FormSet.listAccount.Clear();

            string fileConfig = FormSet.getfilename();

            if (fileConfig == "")
            {
                MessageBox.Show("account.xml配置文件不存在,无法登录!");
                return("");
            }

            XmlDocument doc = new XmlDocument();

            doc.Load(fileConfig);

            XmlNode root = doc.LastChild;

            XmlNodeList list = root.ChildNodes;

            for (int i = 0; i < list.Count; i++)
            {
                XmlNodeList sublist = list[i].ChildNodes;

                AccountInfo data = new AccountInfo();

                data.account = sublist[0].InnerText.Trim();

                data.pwd = sublist[1].InnerText.Trim();

                data.serverip = sublist[2].InnerText.Trim();

                data.apitype = sublist[3].InnerText.Trim();

                data.brokeid = sublist[4].InnerText.Trim();

                FormSet.listAccount.Add(data);
            }


            //加载合约

            FormSet.listCodeInfo.Clear();

            FormSet.listIp.Clear();

            fileConfig = FormSet.getcodefilename();

            if (fileConfig == "")
            {
                MessageBox.Show("code.xml配置文件不存在,无法连接行情!");
                return("");
            }

            doc.Load(fileConfig);


            list = doc.SelectNodes("/ranges/codeinfo");

            //list = doc.SelectSingleNode("/ranges").ChildNodes;

            for (int i = 0; i < list.Count; i++)
            {
                XmlNodeList sublist = list[i].ChildNodes;

                CodeInfo data = new CodeInfo();

                string s = sublist[0].Name;

                data.code = sublist[0].InnerText.Trim();

                data.name = sublist[1].InnerText.Trim();

                data.subtype = sublist[2].InnerText.Trim();


                FormSet.listCodeInfo.Add(data);
            }

            list = doc.SelectNodes("/ranges/ip");

            for (int i = 0; i < list.Count; i++)
            {
                XmlNodeList sublist = list[i].ChildNodes;

                foreach (XmlNode xn in sublist)
                {
                    if (xn.Name == "ufx")
                    {
                        FormSet.listIp["ufx"] = xn.InnerText.Trim();
                    }
                    else if (xn.Name == "ctp")
                    {
                        FormSet.listIp["ctp"] = xn.InnerText.Trim();
                    }
                }
            }

            list = doc.SelectNodes("/ranges/port");

            for (int i = 0; i < list.Count; i++)
            {
                XmlNodeList sublist = list[i].ChildNodes;

                FormSet.port = sublist[0].InnerText.Trim();
            }

            if (FormSet.listIp.Count == 0)
            {
                FormSet.listIp["ufx"] = "";
                FormSet.listIp["ctp"] = "";
                MessageBox.Show("尚未配置行情地址!");
            }

            return("ok");
        }
예제 #5
0
        public void LoadConfig()
        {
            //开始需要清空list
            listAccount.Clear();

            fsr.clearFundaccount();

            string fileConfig = getfilename();

            XmlDocument doc = new XmlDocument();

            doc.Load(fileConfig);

            XmlNode root = doc.LastChild;

            XmlNodeList list = root.ChildNodes;

            for (int i = 0; i < list.Count; i++)
            {
                XmlNodeList sublist = list[i].ChildNodes;

                AccountInfo data = new AccountInfo();

                data.account = sublist[0].InnerText.Trim();

                cbbAccount.Items.Add(data.account);

                //加到checkedlist里面
                fsr.addFundaccount(data.account);

                data.pwd = sublist[1].InnerText.Trim();

                data.serverip = sublist[2].InnerText.Trim();

                data.apitype = sublist[3].InnerText.Trim();

                data.brokeid = sublist[4].InnerText.Trim();

                InsertList(data);

                listAccount.Add(data);
            }


            //加载合约

            FormSet.listCodeInfo.Clear();

            listIp.Clear();

            fileConfig = FormSet.getcodefilename();

            doc.Load(fileConfig);

            list = doc.SelectNodes("/ranges/codeinfo");

            for (int i = 0; i < list.Count; i++)
            {
                XmlNodeList sublist = list[i].ChildNodes;

                CodeInfo data = new CodeInfo();

                data.code = sublist[0].InnerText.Trim();

                data.name = sublist[1].InnerText.Trim();

                data.subtype = sublist[2].InnerText.Trim();


                FormSet.listCodeInfo.Add(data);

                InsertCode(data);
            }

            list = doc.SelectNodes("/ranges/ip");

            for (int i = 0; i < list.Count; i++)
            {
                XmlNodeList sublist = list[i].ChildNodes;

                foreach (XmlNode xn in sublist)
                {
                    if (xn.Name == "ufx")
                    {
                        FormSet.listIp["ufx"] = xn.InnerText.Trim();
                    }
                    else if (xn.Name == "ctp")
                    {
                        FormSet.listIp["ctp"] = xn.InnerText.Trim();
                    }
                }
            }

            if (FormSet.listIp.Count == 0)
            {
                FormSet.listIp["ufx"] = "";
                FormSet.listIp["ctp"] = "";
            }
        }