public async Task ReturnValidResult_IfRequestVwapForIntradayInterval(Interval interval) { using var client = new AlphaVantageClient(_apiKey); var symbol = "IBM"; var indicatorType = TechIndicatorType.VWAP; var result = await client.GetTechIndicatorTimeSeriesAsync(symbol, indicatorType, interval); AssertTechIndicatorResultValid(result, interval, indicatorType, 1); }
public async Task ThrowException_IfRequestVwapNotForIntradayInterval(Interval interval) { using var client = new AlphaVantageClient(_apiKey); var symbol = "IBM"; var indicatorType = TechIndicatorType.VWAP; await Assert.ThrowsAsync <AlphaVantageException>(async() => { await client.GetTechIndicatorTimeSeriesAsync(symbol, indicatorType, interval); }); }
public async Task ReturnValidResult_WithMultipleParameters(Interval interval) { using var client = new AlphaVantageClient(_apiKey); var symbol = "IBM"; var indicatorType = TechIndicatorType.BBANDS; var query = new Dictionary <string, string>() { { "time_period", "20" }, { "series_type", "close" } }; var result = await client.GetTechIndicatorTimeSeriesAsync(symbol, indicatorType, interval, query); AssertTechIndicatorResultValid(result, interval, indicatorType, 3); }
public static async Task TechIndicatorsDemo() { // use your AlphaVantage API key string apiKey = "6FQOAVODM8ZFCE3T"; // there are 5 more constructors available using var client = new AlphaVantageClient(apiKey); var symbol = "IBM"; var indicatorType = TechIndicatorType.SMA; var query = new Dictionary <string, string>() { { "time_period", "20" }, { "series_type", "close" } }; TechIndicatorTimeSeries result = await client.GetTechIndicatorTimeSeriesAsync(symbol, indicatorType, Interval.Min15, query); }