static void Main(string[] args) { SqlConnection connection = new SqlConnection("Data Source=WIN-K69N1L1NJDB;Initial Catalog=smartcom;User ID=sa;Password=WaNo11998811mssql;Asynchronous Processing=True;ConnectRetryInterval=5"); //connection.Open(); SmartCom sc = new SmartCom("mx.ittrade.ru", 8443, "BP12800", "8GVZ7Z"); Console.WriteLine(sc.Login); sc.SmartC.Connected += () => { Console.WriteLine("CONNECTED3!!!!"); sc.SmartC.GetSymbols(); }; sc.SmartC.AddSymbol += (int row, int nrows, string symbol, string short_name, string long_name, string type, int decimals, int lot_size, double punkt, double step, string sec_ext_id, string sec_exch_name, DateTime expiry_date, double days_before_expiry, double strike) => { if (symbol.ToUpper().StartsWith("RTS-9.14_FT")) { Console.WriteLine("{0} => {1}", row, symbol); sc.SmartC.AddTick += (string symbol1, DateTime datetime, double price, double volume, string tradeno, StOrder_Action action) => { DateTime dt = DateTime.Now; string nowTime = dt.Hour.ToString() + ":" + dt.Minute.ToString() + ":" + dt.Second.ToString() + "." + dt.Millisecond.ToString(); Console.WriteLine("{0} => {1} => {2} => {3}", price, volume, allCount += (int)volume, nowTime); }; sc.SmartC.ListenTicks(symbol); } }; sc.ConnectDataSource(); Console.ReadLine(); }
private void timer_callback(object ot, ElapsedEventArgs e) { TimeSpan currentTime = DateTime.Now.TimeOfDay; if (currentTime < timeOfStart && OnBeforeStart != null) { OnBeforeStart(currentTime.Subtract(timeOfStart)); } else { timer.Stop(); SmartWindow.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { SmartWindow.Label1.Content = "Старт! " + DateTime.Now.TimeOfDay.ToString(); smartCom = new SmartCom("mx.ittrade.ru", 8443, login, password); //smartCom = new SmartCom("st1.ittrade.ru", 8090, login, password); smartCom.SmartC.Connected += new SmartCOM3Lib._IStClient_ConnectedEventHandler(this.ShowConnected); smartCom.SmartC.Disconnected += new SmartCOM3Lib._IStClient_DisconnectedEventHandler(this.ShowDisconnected); smartCom.SmartC.AddSymbol += new SmartCOM3Lib._IStClient_AddSymbolEventHandler(this.AddSymbol); smartCom.ConnectDataSource(); } ); } }
public void SmartCom_GetServerConfigurationString_test() { Assert.AreEqual("logFilePath=C:\\Logs\\;logLevel=3", SmartCom.GetServerConfigurationString()); }
public void SmartCom_GetClientLogLevelConfigurationString_test() { Assert.AreEqual("logLevel=2", SmartCom.GetClientLogLevelConfigurationString()); }
public void SmartCom_GetClientLogFilePathConfigurationString_test() { Assert.AreEqual("logFilePath=C:\\Logs\\", SmartCom.GetClientLogFilePathConfigurationString()); }
public void SmartCom_GetServerLogLevelConfigurationString_test() { Assert.AreEqual("logLevel=3", SmartCom.GetServerLogLevelConfigurationString()); }