Ejemplo n.º 1
0
        public void LoadServerList()
        {
            _mkt_servers.Add(new ServerAddress {
                Name = "模拟行情", Address = "tcp://ctpsim-front01.gfqh.cn:43213"
            });
            _mkt_servers.Add(new ServerAddress {
                Name = "国泰模拟", Address = "tcp://mn101.ctp.gtja-futures.com:41213"
            });
            _td_servers.Add(new ServerAddress {
                Name = "模拟交易", Address = "tcp://ctpsim-front01.gfqh.cn:43205"
            });
            _td_servers.Add(new ServerAddress {
                Name = "国泰模拟", Address = "tcp://mn101.ctp.gtja-futures.com:41205"
            });

            if (File.Exists(BrokersXmlPath))
            {
                XElement rootElem = XElement.Load(BrokersXmlPath);
                var      serversElemCollection = rootElem.Descendants("Servers");
                var      serversElem           = serversElemCollection.FirstOrDefault();
                var      elemServers           = serversElem.Elements("Server");
                foreach (var elemServ in elemServers)
                {
                    string name         = elemServ.Element("Name").Value;
                    var    tradingItems = GetAddressItems(elemServ.Element("Trading"));
                    FillList(_td_servers, tradingItems, name);
                    var marketItems = GetAddressItems(elemServ.Element("MarketData"));
                    FillList(_mkt_servers, marketItems, name);
                }
            }

            _trade_stations.Add(new ServerAddress {
                Name = "交易服务42", Address = ConfigurationHelper.GetAppSettingValue("42", "180.166.182.12:62248")
            });
            _trade_stations.Add(new ServerAddress {
                Name = "交易服务47", Address = ConfigurationHelper.GetAppSettingValue("47", "180.166.182.12:62249")
            });
            _trade_stations.Add(new ServerAddress {
                Name = "交易服务61(万兆)", Address = ConfigurationHelper.GetAppSettingValue("61", "180.166.182.12:62263")
            });
            _trade_stations.Add(new ServerAddress {
                Name = "国泰君安张江", Address = ConfigurationHelper.GetAppSettingValue("gtja-fm", "180.166.9.91:20205")
            });
            _trade_stations.Add(new ServerAddress {
                Name = "广发飞马", Address = ConfigurationHelper.GetAppSettingValue("gf-fm", "124.74.248.198:30009")
            });

            string localHostIP = NativeHost.GetLocalIP();
            string localPort   = "16181";

            _trade_stations.Add(new ServerAddress {
                Name = "本地服务", Address = string.Format("{0}:{1}",
                                                       localHostIP, localPort)
            });
        }
Ejemplo n.º 2
0
        public void LoadServerList()
        {
            _mkt_servers.Add(new ServerAddress {
                Name = "模拟行情", Address = "tcp://ctpsim-front01.gfqh.cn:43213"
            });
            _td_servers.Add(new ServerAddress {
                Name = "模拟交易", Address = "tcp://ctpsim-front01.gfqh.cn:43205"
            });

            if (File.Exists(BrokersXmlPath))
            {
                XElement rootElem = XElement.Load(BrokersXmlPath);
                var      serversElemCollection = rootElem.Descendants("Servers");
                var      serversElem           = serversElemCollection.FirstOrDefault();
                var      elemServers           = serversElem.Elements("Server");
                foreach (var elemServ in elemServers)
                {
                    string name         = elemServ.Element("Name").Value;
                    var    tradingItems = GetAddressItems(elemServ.Element("Trading"));
                    FillList(_td_servers, tradingItems, name);
                    var marketItems = GetAddressItems(elemServ.Element("MarketData"));
                    FillList(_mkt_servers, marketItems, name);
                }
            }

            _trade_stations.Add(new ServerAddress {
                Name = "交易服务42", Address = ConfigurationHelper.GetAppSettingValue("42", "116.228.246.94:62248")
            });
            _trade_stations.Add(new ServerAddress {
                Name = "交易服务47", Address = ConfigurationHelper.GetAppSettingValue("47", "116.228.246.94:62249")
            });

            string localHostIP = NativeHost.GetLocalIP();
            string localPort   = "16181";

            _trade_stations.Add(new ServerAddress {
                Name = "本地服务", Address = string.Format("{0}:{1}",
                                                       localHostIP, localPort)
            });
        }