public async Task InformationAboutFreeKeyTest() { _apiKeyServiceMock.Setup(q => q.GetKey()).Returns(demoKey); //_requestCompositorReal = new RequestCompositor(_apiCallValidatorMock.Object); var response = await _connectorReal.RequestApiAsync <InformationDto>( ApiFunctions.TIME_SERIES_WEEKLY, new Dictionary <ApiParameters, string> { { ApiParameters.Symbol, _testSymbol } } ); var informationDto = response.Data; var demoMessage = "The **demo** API key is for demo purposes only. Please claim your free API key at (https://www.alphavantage.co/support/#api-key) to explore our full API offerings. It takes fewer than 20 seconds"; Assert.True(informationDto?.Information.Contains(demoMessage)); }
/// <inheritdoc cref="IAlphaVantageService.GetIntradaySeriesAsync"/> public async Task <List <SampleDto> > GetIntradaySeriesAsync(string symbol, Enums.Intervals interval, OutputSize outputSize = OutputSize.Full) { if (string.IsNullOrEmpty(symbol)) { throw new ArgumentNullException(nameof(symbol)); } if (outputSize == OutputSize.None) { throw new ArgumentException(nameof(outputSize)); } if (interval == Enums.Intervals.Unknown) { throw new ArgumentException(nameof(interval)); } var function = ApiFunctions.TIME_SERIES_INTRADAY; var parameters = new Dictionary <ApiParameters, string> { { ApiParameters.Symbol, symbol }, { ApiParameters.Interval, Intervals.Values[interval] }, { ApiParameters.OutputSize, outputSize.ToLower() }, }; var response = await _connector.RequestApiAsync <Dictionary <DateTime, SampleAlphaDto> >(function, parameters); return(response.Data.Select(q => (SampleDto)q).ToList()); }