//use for subscribing internal EventMarket(EventType evtType, CorrelationID corr, IEnumerable<Subscription> subscriptions) { this._messages = new List<Message>(); switch (evtType) { case EventType.SESSION_STATUS: base._type = evtType; MessageMarketSessionOpened msgSessionOpened = new MessageMarketSessionOpened(); this._messages.Add(msgSessionOpened); break; case EventType.SERVICE_STATUS: base._type = evtType; MessageMarketServiceStatus msgServiceStatus = new MessageMarketServiceStatus(corr); this._messages.Add(msgServiceStatus); break; case EventType.SUBSCRIPTION_STATUS: base._type = evtType; foreach (var item in subscriptions) { bool securityError = Types.Rules.IsSecurityError(item.Security); if (securityError) { MessageMarketSubscriptionFailure msgError = new MessageMarketSubscriptionFailure(item); this._messages.Add(msgError); } else { MessageMarketSubscriptionStarted msgSubStatus = new MessageMarketSubscriptionStarted(item); this._messages.Add(msgSubStatus); } } break; case EventType.SUBSCRIPTION_DATA: base._type = evtType; foreach (var item in subscriptions) { bool securityError = Types.Rules.IsSecurityError(item.Security); if (!securityError) { MessageMarketSubscriptionData msgSubData = new MessageMarketSubscriptionData(item, EventMarket.GenerateFakeMessageData(item)); this._messages.Add(msgSubData); } } break; default: throw new NotImplementedException(string.Format("BEmu.MarketDataRequest.EventMarket.EventMarket: doesn't expect EventType {0}", evtType.ToString())); } }
internal EventMarket(EventType evtType, CorrelationID corr, IEnumerable <Subscription> subscriptions) //use for subscribing { this._messages = new List <Message>(); switch (evtType) { case EventType.SESSION_STATUS: base._type = evtType; MessageMarketSessionOpened msgSessionOpened = new MessageMarketSessionOpened(); this._messages.Add(msgSessionOpened); break; case EventType.SERVICE_STATUS: base._type = evtType; MessageMarketServiceStatus msgServiceStatus = new MessageMarketServiceStatus(corr); this._messages.Add(msgServiceStatus); break; case EventType.SUBSCRIPTION_STATUS: base._type = evtType; foreach (var item in subscriptions) { MessageMarketSubscriptionStarted msgSubStatus = new MessageMarketSubscriptionStarted(item); this._messages.Add(msgSubStatus); } break; case EventType.SUBSCRIPTION_DATA: base._type = evtType; foreach (var item in subscriptions) { MessageMarketSubscriptionData msgSubData = new MessageMarketSubscriptionData(item, EventMarket.GenerateFakeMessageData(item)); this._messages.Add(msgSubData); } break; default: throw new NotImplementedException(string.Format("BEmu.MarketDataRequest.EventMarket.EventMarket: doesn't expect EventType {1}", evtType.ToString())); } }