public StockRepository(IUnitOfWork unitOfWork, IMapper mapper, ISoldInstrumentsRepository soldInstrumentsRepository, IHttpClientFactory httpClientFactory, IOptions <YahooFinanceApiSettings> yahooFinanceApiSettings, IOptions <ExchangeRateStorageApiSettings> exchangeRateApiSettings) { _unitOfWork = unitOfWork ?? throw new ArgumentNullException(nameof(unitOfWork)); _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); _soldInstrumentsRepository = soldInstrumentsRepository ?? throw new ArgumentNullException(nameof(soldInstrumentsRepository)); _httpClientFactory = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory)); _yahooFinanceApiSettings = yahooFinanceApiSettings.Value ?? throw new ArgumentNullException(nameof(yahooFinanceApiSettings)); _exchangeRateApiSettings = exchangeRateApiSettings.Value ?? throw new ArgumentNullException(nameof(exchangeRateApiSettings)); client = _httpClientFactory.CreateClient(_yahooFinanceApiSettings.ClientName); client.DefaultRequestHeaders.Add(_yahooFinanceApiSettings.GetApiHostHeader, _yahooFinanceApiSettings.GetApiHostHeaderValue); client.DefaultRequestHeaders.Add(_yahooFinanceApiSettings.GetApiKeyHeader, _yahooFinanceApiSettings.GetApiKeyHeaderValue); }
public SoldInstrumentsService(ISoldInstrumentsRepository soldInstrumentsRepository) { _soldInstrumentsRepository = soldInstrumentsRepository ?? throw new ArgumentNullException(nameof(soldInstrumentsRepository)); }