/// <summary> /// Instantiates a <see cref="MarketDataSubscription"/> /// </summary> /// <param name="logger">The logger</param> /// <param name="repositoryFactory">The repository to store and retrieve market data</param> /// <param name="marketDataProvider">The provider for refreshing market data</param> /// <param name="stockListProvider">The provider for lists of stocks for which to retrieve data</param> /// <param name="quotesPublisher"></param> /// <param name="subscriptionData">The subscriptionData data for determining</param> public MarketDataSubscription(ILog logger, IMarketDataRepositoryFactory repositoryFactory, IMarketDataProvider marketDataProvider, IStockListProvider stockListProvider, IPublisher<NewQuotesData> quotesPublisher, Subscription subscriptionData) { // perform null checks if (logger == null) throw new ArgumentNullException("logger"); if (repositoryFactory == null) throw new ArgumentNullException("repositoryFactory"); if (marketDataProvider == null) throw new ArgumentNullException("marketDataProvider"); if (subscriptionData == null) throw new ArgumentNullException("subscriptionData"); // set dependencies _logger = logger; _repositoryFactory = repositoryFactory; _marketDataProvider = marketDataProvider; _stockListProvider = stockListProvider; _quotesPublisher = quotesPublisher; _subscriptionData = subscriptionData; // set up timer _timer = new Timer(obj => GetLatestQuotes()); // status initialized to idle Status = SubscriptionStatus.Idle; }
/// <summary> /// Instantiates a <see cref="MarketDataSubscription"/> /// </summary> /// <param name="logger">The logger</param> /// <param name="repositoryFactory">The repository to store and retrieve market data</param> /// <param name="marketDataProvider">The provider for refreshing market data</param> /// <param name="stockListProvider">The provider for lists of stocks for which to retrieve data</param> /// <param name="quotesPublisher"></param> /// <param name="subscriptionData">The subscriptionData data for determining</param> public MarketDataSubscription(ILog logger, IMarketDataRepositoryFactory repositoryFactory, IMarketDataProvider marketDataProvider, IStockListProvider stockListProvider, IPublisher <NewQuotesData> quotesPublisher, Subscription subscriptionData) { // perform null checks if (logger == null) { throw new ArgumentNullException("logger"); } if (repositoryFactory == null) { throw new ArgumentNullException("repositoryFactory"); } if (marketDataProvider == null) { throw new ArgumentNullException("marketDataProvider"); } if (subscriptionData == null) { throw new ArgumentNullException("subscriptionData"); } // set dependencies _logger = logger; _repositoryFactory = repositoryFactory; _marketDataProvider = marketDataProvider; _stockListProvider = stockListProvider; _quotesPublisher = quotesPublisher; _subscriptionData = subscriptionData; // set up timer _timer = new Timer(obj => GetLatestQuotes()); // status initialized to idle Status = SubscriptionStatus.Idle; }