static void Main(string[] args) { Logger Log = LogManager.GetCurrentClassLogger(); GetInstruments GetInstruments = new GetInstruments(); GetInstruments.ConfigPath = ConfigurationManager.AppSettings[KEY_ConfigPath]; GetInstruments.ConnectionConfigFileName = ConfigurationManager.AppSettings[KEY_ConnectionConfigFileName]; GetInstruments.InstrumentInfoListFileName = ConfigurationManager.AppSettings[KEY_InstrumentInfoListFileName]; GetInstruments.Load(); GetInstruments.Connect(); if(!GetInstruments.WaitConnectd(10*1000)) { Log.Info("连接超时退出"); GetInstruments.Disconnect(); return; } GetInstruments.ReqQryInstrument(); // 这个超时是否过短?因为在LTS模拟中可能要5分钟 if(GetInstruments.WaitIsLast(60*1000)) { Log.Info("一共查询到 {0} 条合约", GetInstruments.InstrumentInfoList.Count); if(GetInstruments.InstrumentInfoList.Count>0) { GetInstruments.Save(); Log.Info("另存合约列表到 {0}", GetInstruments.InstrumentInfoListFileName); } } else { Log.Info("查询合约超时"); } GetInstruments.Disconnect(); }
static void Main(string[] args) { Logger Log = LogManager.GetCurrentClassLogger(); GetInstruments GetInstruments = new GetInstruments(); GetInstruments.ConfigPath = ConfigurationManager.AppSettings[KEY_ConfigPath]; GetInstruments.ConnectionConfigFileName = ConfigurationManager.AppSettings[KEY_ConnectionConfigFileName]; GetInstruments.InstrumentInfoListFileName = ConfigurationManager.AppSettings[KEY_InstrumentInfoListFileName]; GetInstruments.Load(); GetInstruments.Connect(); if (!GetInstruments.WaitConnectd(10 * 1000)) { Log.Info("连接超时退出"); GetInstruments.Disconnect(); return; } GetInstruments.ReqQryInstrument(); // 这个超时是否过短?因为在LTS模拟中可能要5分钟 if (GetInstruments.WaitIsLast(60 * 1000)) { Log.Info("一共查询到 {0} 条合约", GetInstruments.InstrumentInfoList.Count); if (GetInstruments.InstrumentInfoList.Count > 0) { GetInstruments.Save(); Log.Info("另存合约列表到 {0}", GetInstruments.InstrumentInfoListFileName); } } else { Log.Info("查询合约超时"); } GetInstruments.Disconnect(); }