public void Setup() { this.stServerSingleton = new StServerMockSingleton(); this.stServer = this.stServerSingleton.Instance; this.handlers = new SmartComHandlersDatabase(); this.handlers.Add <_IStClient_ConnectedEventHandler>(ConnectedHandler); this.handlers.Add <_IStClient_DisconnectedEventHandler>(DisconnectedHandler); this.binder = new SmartComBinder(this.stServer, this.handlers, new NullLogger()); this.connector = new SmartComConnector(this.stServer, this.handlers, new NullLogger()); this.subscriber = new SmartComSubscriber(this.stServer, new NullLogger()); this.subscriber.Portfolios.Add("ST88888-RF-01"); this.subscriber.Ticks.Add("RTS-6.13_FT"); this.subscriber.Quotes.Add("RTS-6.13_FT"); this.subscriber.BidsAndAsks.Add("RTS-6.13_FT"); this.trader = new SmartComAdapter(this.connector, this.handlers, this.binder, this.subscriber, this.stServerSingleton, new NullLogger(), 1); Assert.AreEqual(0, this.subscriber.SubscriptionsCounter); }
public void MockSmartCom_Is_Singleton() { StServer s = MockSmartCom.Instance; StServer s2 = MockSmartCom.Instance; Assert.AreSame(s, s2); }
public void SetUp() { this.stServerSingleton = new StServerMockSingleton(); this.stServer = this.stServerSingleton.Instance; this.handlers = new SmartComHandlersDatabase(); this.binder = new SmartComBinder(this.stServerSingleton.Instance, this.handlers, new NullLogger()); }
public SmartComAdapter(IConnector connector, SmartComHandlersDatabase handlers, IBinder binder, ISubscriber subscriber, IGenericSingleton <StServer> stServerSingleton, ILogger logger, int monitorTimeoutSeconds = 20) { this.stServerSingleton = stServerSingleton; this.stServer = this.stServerSingleton.Instance; this.handlers = handlers; this.binder = binder; this.subscriber = subscriber; this.logger = logger; this.connector = connector; this.monitorTimeoutSeconds = monitorTimeoutSeconds; this.defaultAdapterHandlers = new AdapterHandlers(); this.seconds = AppSettings.GetValue <int>("SecondsBetweenConnectionAwaitingAttempts"); this.handlers.Add <_IStClient_ConnectedEventHandler>(SmartComTraderConnected); this.handlers.Add <_IStClient_DisconnectedEventHandler>(SmartComTraderDisconnected); this.dataFlowMonitorTimer = new Timer(MonitorDataFlow, null, this.monitorTimeoutSeconds * 1000, 1000 * this.seconds); this.connectionMonitorTimer = new Timer(MonitorConnection, null, this.monitorTimeoutSeconds * 1000, 1000 * this.seconds); }
public void Setup() { this.stServer = new StServerClassMock(); this.handlers = new SmartComHandlersDatabase(); this.binder = new SmartComBinder(this.stServer, this.handlers, new NullLogger()); this.connector = new SmartComConnector(this.stServer, this.handlers, new NullLogger()); this.binder.Bind(); }
public QuoteSourceServer(List <string> symbols, StServer smartCom, string endpoint) { server = smartCom; socket = new PublisherSocket(); server.UpdateQuote += OnUpdateQuote; server.AddTick += OnAddTick; }
public SmartComSubscriber(StServer stServer, ILogger logger) { this.stServer = stServer; this.logger = logger; this.Ticks = new HashSet <string>(); this.Portfolios = new HashSet <string>(); this.BidsAndAsks = new HashSet <string>(); this.Quotes = new HashSet <string>(); }
private void InitializeServer() { SmartComServer = new StServer(); SmartComServer.Connected += new _IStClient_ConnectedEventHandler(SmartComServerConnected); SmartComServer.Disconnected += new _IStClient_DisconnectedEventHandler(SmartComServerDisconnected); SmartComServer.AddTick += new _IStClient_AddTickEventHandler(SmartComServerTickAdded); //SmartComServer.UpdateQuote += new _IStClient_UpdateQuoteEventHandler(SmartComServerUpdateQuote); SmartComServer.AddBar += new _IStClient_AddBarEventHandler(SmartComServer_AddBar); SmartComServer.ConfigureClient(SmartComParams); }
public SmartComConnector(StServer stServer, SmartComHandlersDatabase handlers, ILogger logger) { this.stServer = stServer; this.handlers = handlers; this.logger = logger; this.cc = new ConnectionCredentials(); this.handlers.Add <_IStClient_ConnectedEventHandler>(ConnectionSucceed); this.handlers.Add <_IStClient_DisconnectedEventHandler>(ConnectorDisconnected); }
public static void Reset(this StServer stServer) { if (stServer == null) { return; } if (stServer is StServerClass) { Marshal.ReleaseComObject(stServer); } stServer = null; }
public TickerInfoServer(StServer smartCom, string endpoint) { symbols = new SortedDictionary <string, TickerInfo>(); server = smartCom; this.endpoint = endpoint; poller = new NetMQPoller(); socket = new ResponseSocket(); socket.Bind(endpoint); socket.ReceiveReady += (s, a) => { List <string> parts = a.Socket.ReceiveMultipartStrings(1); string msg = parts[0]; handleMessage(msg, a.Socket); }; server.AddSymbol += Server_AddSymbol; }
private void InitializeServer() { SmartComServer = new StServer(); SmartComServer.Connected += new _IStClient_ConnectedEventHandler(SmartComServerConnected); SmartComServer.Disconnected += new _IStClient_DisconnectedEventHandler(SmartComServerDisconnected); SmartComServer.UpdatePosition += new _IStClient_UpdatePositionEventHandler(SmartComServerUpdatePosition); SmartComServer.UpdateOrder += new _IStClient_UpdateOrderEventHandler(SmartComServerUpdateOrder); SmartComServer.SetMyOrder += new _IStClient_SetMyOrderEventHandler(SmartComServerSetMyOrder); SmartComServer.OrderSucceeded += new _IStClient_OrderSucceededEventHandler(SmartComServerOrderSucceeded); SmartComServer.OrderFailed += new _IStClient_OrderFailedEventHandler(SmartComServerOrderFailed); SmartComServer.OrderCancelFailed += new _IStClient_OrderCancelFailedEventHandler(SmartComServerOrderCancelFailed); SmartComServer.OrderCancelSucceeded += new _IStClient_OrderCancelSucceededEventHandler(SmartComServerOrderCancelSucceeded); SmartComServer.OrderMoveSucceeded += new _IStClient_OrderMoveSucceededEventHandler(SmartComServerOrderMoveSucceded); SmartComServer.OrderMoveFailed += new _IStClient_OrderMoveFailedEventHandler(SmartComServerOrderMoveFailed); SmartComServer.UpdateQuote += new _IStClient_UpdateQuoteEventHandler(SmartComServerUpdateQuote); SmartComServer.AddBar += new _IStClient_AddBarEventHandler(SmartComServer_AddBar); SmartComServer.ConfigureClient(SmartComParams); }
public HistoryProviderServer(StServer smartCom, string endpoint) { data = new List <Bar>(); dataSemaphore = new SemaphoreSlim(0, 1); server = smartCom; hpEndpoint = endpoint; poller = new NetMQPoller(); socket = new ResponseSocket(); socket.Bind(endpoint); socket.ReceiveReady += (s, a) => { List <string> parts = a.Socket.ReceiveMultipartStrings(1); string msg = parts[0]; handleMessage(msg, a.Socket); }; poller.Add(socket); server.AddBar += Server_AddBar; }
public void Factory_Makes_New_StServer() { this.first = this.factory.Instance; Assert.IsTrue(this.first != null); }
public SmartComBinder(StServer stServer, SmartComHandlersDatabase handlers, ILogger logger) { this.logger = logger; this.stServer = stServer; this.handlers = handlers; }
public static void Bind <T>(this StServer stServer, T method) where T : class { if (!IsSmartComEvent <T>()) { return; } if (method is _IStClient_AddBarEventHandler) { stServer.AddBar += method as _IStClient_AddBarEventHandler; } if (method is _IStClient_AddPortfolioEventHandler) { stServer.AddPortfolio += method as _IStClient_AddPortfolioEventHandler; } if (method is _IStClient_AddSymbolEventHandler) { stServer.AddSymbol += method as _IStClient_AddSymbolEventHandler; } if (method is _IStClient_AddTickEventHandler) { stServer.AddTick += method as _IStClient_AddTickEventHandler; } if (method is _IStClient_AddTickHistoryEventHandler) { stServer.AddTickHistory += method as _IStClient_AddTickHistoryEventHandler; } if (method is _IStClient_AddTradeEventHandler) { stServer.AddTrade += method as _IStClient_AddTradeEventHandler; } if (method is _IStClient_ConnectedEventHandler) { stServer.Connected += method as _IStClient_ConnectedEventHandler; } if (method is _IStClient_DisconnectedEventHandler) { stServer.Disconnected += method as _IStClient_DisconnectedEventHandler; } if (method is _IStClient_OrderCancelFailedEventHandler) { stServer.OrderCancelFailed += method as _IStClient_OrderCancelFailedEventHandler; } if (method is _IStClient_OrderCancelSucceededEventHandler) { stServer.OrderCancelSucceeded += method as _IStClient_OrderCancelSucceededEventHandler; } if (method is _IStClient_OrderFailedEventHandler) { stServer.OrderFailed += method as _IStClient_OrderFailedEventHandler; } if (method is _IStClient_OrderMoveFailedEventHandler) { stServer.OrderMoveFailed += method as _IStClient_OrderMoveFailedEventHandler; } if (method is _IStClient_OrderMoveSucceededEventHandler) { stServer.OrderMoveSucceeded += method as _IStClient_OrderMoveSucceededEventHandler; } if (method is _IStClient_OrderSucceededEventHandler) { stServer.OrderSucceeded += method as _IStClient_OrderSucceededEventHandler; } if (method is _IStClient_SetMyClosePosEventHandler) { stServer.SetMyClosePos += method as _IStClient_SetMyClosePosEventHandler; } if (method is _IStClient_SetMyOrderEventHandler) { stServer.SetMyOrder += method as _IStClient_SetMyOrderEventHandler; } if (method is _IStClient_SetMyTradeEventHandler) { stServer.SetMyTrade += method as _IStClient_SetMyTradeEventHandler; } if (method is _IStClient_SetPortfolioEventHandler) { stServer.SetPortfolio += method as _IStClient_SetPortfolioEventHandler; } if (method is _IStClient_SetSubscribtionCheckReultEventHandler) { stServer.SetSubscribtionCheckReult += method as _IStClient_SetSubscribtionCheckReultEventHandler; } if (method is _IStClient_UpdateBidAskEventHandler) { stServer.UpdateBidAsk += method as _IStClient_UpdateBidAskEventHandler; } if (method is _IStClient_UpdateOrderEventHandler) { stServer.UpdateOrder += method as _IStClient_UpdateOrderEventHandler; } if (method is _IStClient_UpdatePositionEventHandler) { stServer.UpdatePosition += method as _IStClient_UpdatePositionEventHandler; } if (method is _IStClient_UpdateQuoteEventHandler) { stServer.UpdateQuote += method as _IStClient_UpdateQuoteEventHandler; } }