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); }
private static void AssertTechIndicatorResultValid( TechIndicatorTimeSeries timeSeries, Interval interval, TechIndicatorType indicatorType, int expectedParamsCount) { timeSeries.Should().NotBeNull() .And.Match <TechIndicatorTimeSeries>(ti => ti.Interval == interval && ti.IndicatorType == indicatorType); timeSeries.MetaData.Should().NotBeNull() .And.HaveCountGreaterThan(1); timeSeries.DataPoints.Should().NotBeNull() .And.HaveCountGreaterThan(1) .And.NotContainNulls() .And.OnlyContain(dp => IsDataPointValid(dp, expectedParamsCount)); }