예제 #1
0
        public async Task GetSmaTest()
        {
            var key = _realKeySrvice.GetKey();

            _apiKeyServiceMock.Setup(q => q.GetKey()).Returns(key);
            var result = await _alphaVantageServiceReal.GetSmaAsync(_testSymbol, AlphaVantageConnector.Enums.Intervals.FiveMin, 60, SeriesType.Close);

            Assert.NotNull(result);
            Assert.True(result.Any());
        }
        public async Task <IActionResult> GetSmaAsync(string symbol, Intervals interval, int timePeriod, SeriesType seriesType)
        {
            var result = await _alphaVantageService.GetSmaAsync(symbol, interval, timePeriod, seriesType);

            return(Ok(new
            {
                symbol,
                interval = interval.ToString(),
                timePeriod,
                seriesType = seriesType.ToString(),
                Data = result
            }));
        }