예제 #1
0
 /// <summary>
 /// Creates a new instance
 /// </summary>
 private LiveDelistingEventProviderEnumerator(ITimeProvider timeProvider, SubscriptionDataConfig dataConfig,
                                              SecurityCache securityCache, DelistingEventProvider delistingEventProvider, MapFile mapFile)
 {
     _dataConfig             = dataConfig;
     _timeProvider           = timeProvider;
     _securityCache          = securityCache;
     _dataToEmit             = new Queue <BaseData>();
     _delistingEventProvider = delistingEventProvider;
     _delistingEventProvider.Initialize(dataConfig, null, mapFile, DateTime.UtcNow);
 }
예제 #2
0
        /// <summary>
        /// Helper method to create a new instance.
        /// Knows which security types should create one and determines the appropriate delisting event provider to use
        /// </summary>
        public static bool TryCreate(SubscriptionDataConfig dataConfig, ITimeProvider timeProvider, IDataQueueHandler dataQueueHandler,
                                     SecurityCache securityCache, IMapFileProvider mapFileProvider, out IEnumerator <BaseData> enumerator)
        {
            enumerator = null;
            var securityType = dataConfig.SecurityType;

            if (securityType == SecurityType.FutureOption || securityType == SecurityType.Future ||
                securityType == SecurityType.Option || securityType == SecurityType.Equity)
            {
                var mapfile = mapFileProvider.Get(dataConfig.Symbol.ID.Market).ResolveMapFile(dataConfig.Symbol, dataConfig.Type);
                var delistingEventProvider = new DelistingEventProvider();
                if (securityType == SecurityType.Equity)
                {
                    delistingEventProvider = new LiveDataBasedDelistingEventProvider(dataConfig, dataQueueHandler);
                }
                enumerator = new LiveDelistingEventProviderEnumerator(timeProvider, dataConfig, securityCache, delistingEventProvider, mapfile);
                return(true);
            }
            return(false);
        }