コード例 #1
0
        internal MarketEvent(EventType evtType, CorrelationID corr, IEnumerable <Subscription> subscriptions) //use for subscribing
        {
            this._messages = new List <Message>();

            switch (evtType)
            {
            case EventType.SESSION_STATUS:
                base._type = evtType;
                MarketMessageSessionOpened msgSessionOpened = new MarketMessageSessionOpened();
                this._messages.Add(msgSessionOpened);
                break;

            case EventType.SERVICE_STATUS:
                base._type = evtType;
                MarketMessageServiceStatus msgServiceStatus = new MarketMessageServiceStatus(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)
                    {
                        MarketMessageSubscriptionFailure msgError = new MarketMessageSubscriptionFailure(item);
                        this._messages.Add(msgError);
                    }
                    else
                    {
                        MarketMessageSubscriptionStarted msgSubStatus = new MarketMessageSubscriptionStarted(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)
                    {
                        MarketMessageSubscriptionData msgSubData = new MarketMessageSubscriptionData(item, MarketEvent.GenerateFakeMessageData(item));
                        this._messages.Add(msgSubData);
                    }
                }
                break;

            default:
                throw new NotImplementedException(string.Format("BEmu.MarketDataRequest.EventMarket.EventMarket: doesn't expect EventType {0}", evtType.ToString()));
            }
        }
コード例 #2
0
 internal MarketElementServiceStatus(MarketMessageServiceStatus arg)
 {
     this._serviceName = (MarketElementString)arg.Elements.First();
 }