示例#1
0
 internal static Event EventFactory(Request request, bool isLastRequest)
 {
     Event result;
     if (request is HistoricalDataRequest.RequestHistoric)
     {
         result = new HistoricalDataRequest.EventHistoric((HistoricalDataRequest.RequestHistoric)request);
         result._type = isLastRequest ? EventType.RESPONSE : EventType.PARTIAL_RESPONSE;
         return result;
     }
     else if (request is ReferenceDataRequest.RequestReference)
     {
         result = new ReferenceDataRequest.EventReference((ReferenceDataRequest.RequestReference)request);
         result._type = isLastRequest ? EventType.RESPONSE : EventType.PARTIAL_RESPONSE;
         return result;
     }
     else if (request is IntradayTickRequest.RequestIntradayTick)
     {
         result = new IntradayTickRequest.EventIntradayTick((IntradayTickRequest.RequestIntradayTick)request);
         result._type = isLastRequest ? EventType.RESPONSE : EventType.PARTIAL_RESPONSE;
         return result;
     }
     else if (request is IntradayBarRequest.RequestIntradayBar)
     {
         result = new IntradayBarRequest.EventIntradayBar((IntradayBarRequest.RequestIntradayBar)request);
         result._type = isLastRequest ? EventType.RESPONSE : EventType.PARTIAL_RESPONSE;
         return result;
     }
     else
     {
         throw new NotImplementedException(string.Format("Request type {0} is not implemented", request.GetType()));
     }
 }
示例#2
0
        internal static Event EventFactory(Request request, bool isLastRequest)
        {
            Event result;

            if (request is HistoricalDataRequest.RequestHistoric)
            {
                result       = new HistoricalDataRequest.EventHistoric((HistoricalDataRequest.RequestHistoric)request);
                result._type = isLastRequest ? EventType.RESPONSE : EventType.PARTIAL_RESPONSE;
                return(result);
            }
            else if (request is ReferenceDataRequest.RequestReference)
            {
                result       = new ReferenceDataRequest.EventReference((ReferenceDataRequest.RequestReference)request);
                result._type = isLastRequest ? EventType.RESPONSE : EventType.PARTIAL_RESPONSE;
                return(result);
            }
            else if (request is IntradayTickRequest.RequestIntradayTick)
            {
                result       = new IntradayTickRequest.EventIntradayTick((IntradayTickRequest.RequestIntradayTick)request);
                result._type = isLastRequest ? EventType.RESPONSE : EventType.PARTIAL_RESPONSE;
                return(result);
            }
            else if (request is IntradayBarRequest.RequestIntradayBar)
            {
                result       = new IntradayBarRequest.EventIntradayBar((IntradayBarRequest.RequestIntradayBar)request);
                result._type = isLastRequest ? EventType.RESPONSE : EventType.PARTIAL_RESPONSE;
                return(result);
            }
            else
            {
                throw new NotImplementedException(string.Format("Request type {0} is not implemented", request.GetType()));
            }
        }