public async Task <decimal?> GetQuoteAsync(QuoteRequest quoteRequest) { var candle = await _externalFinancialService.GetCandleAsync(quoteRequest.Symbol, quoteRequest.Date); if (candle == null) { throw new ApiException(HttpStatusCode.NotFound, $"Quote data not found [{quoteRequest.Symbol}/{quoteRequest.Date:yyyy-MM-dd}]."); } const string marketCurrencySymbol = "USD"; string regionCurrencySymbol = _globalizationService.GetCurrencySymbol(quoteRequest.Region); if (regionCurrencySymbol.Equals(marketCurrencySymbol, StringComparison.InvariantCultureIgnoreCase)) { return(await Task.FromResult(candle.Close)); } decimal marketExchangeRate = await _exchangeRateService.GetExchangeRateAsync(marketCurrencySymbol, quoteRequest.Date); decimal regionExchangeRate = await _exchangeRateService.GetExchangeRateAsync(regionCurrencySymbol, quoteRequest.Date); decimal?quote = candle.Close * marketExchangeRate / regionExchangeRate; return(await Task.FromResult(quote)); }