Beispiel #1
0
 internal static string GetTimeSeriesUrl(TIME_SERIES series, string symbol, TIME_INTERVALS interval = TIME_INTERVALS.OneMin)
 {
     if (series == TIME_SERIES.TIME_SERIES_INTRADAY)
     {
         return($"{alphaVantageUri}/query?function={series}&symbol={symbol}&interval={GetDescription(interval).ToLower()}&apikey={apiKey}");
     }
     return($"{alphaVantageUri}/query?function={series}&symbol={symbol}&apikey={apiKey}");
 }
Beispiel #2
0
        internal static string GetDescription(TIME_INTERVALS enumerationValue)
        {
            var memberInfo = enumerationValue.GetType().GetMember(enumerationValue.ToString());

            if (memberInfo.Length > 0)
            {
                var attrs = memberInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);

                if (attrs.Length > 0)
                {
                    return(((DescriptionAttribute)attrs[0]).Description);
                }
            }
            return(enumerationValue.ToString());
        }
Beispiel #3
0
        internal static string GetSMAUrl(string symbol, int timePeriod, string interval)
        {
            TIME_INTERVALS timeInterval = (TIME_INTERVALS)Enum.Parse(typeof(TIME_INTERVALS), interval, true);

            return($"{alphaVantageUri}/query?function=SMA&symbol={symbol}&interval={GetDescription(timeInterval).ToLower()}&time_period={timePeriod}&series_type=close&apikey={apiKey}");
        }