예제 #1
0
        public async Task <IEXResponse <IEnumerable <NewsResponse> > > HistoricalNewsAsync(TimeSeriesRange?range = null, int?limit = null)
        {
            const string urlPattern = "time-series/news";
            var          qsb        = GetQueryString(range, limit);
            var          pathNvc    = GetPathNvc(null);

            return(await executor.ExecuteAsync <IEnumerable <NewsResponse> >(urlPattern, pathNvc, qsb));
        }
예제 #2
0
        public async Task <IEXResponse <IEnumerable <CurrencyRateResponse> > > LatestRatesAsync(string symbols)
        {
            var nvc = new NameValueCollection();
            var qsb = new QueryStringBuilder();

            qsb.Add("symbols", symbols);

            return(await executor.ExecuteAsync <IEnumerable <CurrencyRateResponse> >("fx/latest", nvc, qsb));
        }
예제 #3
0
        public async Task <IEXResponse <IEnumerable <StatsHistoricalSummaryResponse> > > StatsHistoricalSummaryAsync(DateTime?date = null)
        {
            const string urlPattern = "stats/historical";
            var          qsb        = new QueryStringBuilder();

            qsb.Add("date", date == null ? DateTime.Now.ToString("yyyyMM") : ((DateTime)date).ToString("yyyyMM"));
            var pathNvc = new NameValueCollection();

            return(await executor.ExecuteAsync <IEnumerable <StatsHistoricalSummaryResponse> >(urlPattern, pathNvc, qsb));
        }
예제 #4
0
        public async Task <IEXResponse <MetadataResponse> > MetadataAsync()
        {
            const string urlPattern = "account/metadata";

            var qsb = new QueryStringBuilder();

            var pathNVC = new NameValueCollection();

            return(await executor.ExecuteAsync <MetadataResponse>(urlPattern, pathNVC, qsb, forceUseSecretToken : true));
        }
예제 #5
0
        public async Task <IEXResponse <Dictionary <string, IEnumerable <HISTResponse> > > > HISTAsync()
        {
            const string urlPattern = "hist";

            var qsb = new QueryStringBuilder();

            var pathNvc = new NameValueCollection();

            return(await _executor.ExecuteAsync <Dictionary <string, IEnumerable <HISTResponse> > >(urlPattern, pathNvc, qsb));
        }
예제 #6
0
        public async Task <IEXResponse <IEnumerable <OptionResponse> > > OptionsAsync(string symbol, string expiration)
        {
            const string urlPattern = "stock/[symbol]/options/[expiration]";

            var qsb     = new QueryStringBuilder();
            var pathNvc = new NameValueCollection {
                { "symbol", symbol }, { "expiration", expiration }
            };

            return(await executor.ExecuteAsync <IEnumerable <OptionResponse> >(urlPattern, pathNvc, qsb));
        }
예제 #7
0
        public async Task <IEXResponse <IEnumerable <SentimentMinuteResponse> > > SentimentByMinuteAsync(string symbol, string date)
        {
            const string urlPattern = "stock/[symbol]/sentiment/minute/[date]";

            var qsb     = new QueryStringBuilder();
            var pathNvc = new NameValueCollection {
                { "symbol", symbol }, { "date", date }
            };

            return(await executor.ExecuteAsync <IEnumerable <SentimentMinuteResponse> >(urlPattern, pathNvc, qsb));
        }
예제 #8
0
        public async Task <IEXResponse <IEnumerable <SearchResponse> > > SearchAsync(string fragment)
        {
            const string urlPattern = "search/[fragment]";

            var pathNvc = new NameValueCollection
            {
                { "fragment", fragment },
            };

            return(await _executor.ExecuteAsync <IEnumerable <SearchResponse> >(urlPattern, pathNvc, null));
        }
예제 #9
0
        public async Task <IEXResponse <IEnumerable <BonusIssueResponse> > > BonusIssueAsync(
            string symbol, TimeSeriesRange?range, bool calendar = false, int?last = null, string refId = null)
        {
            string urlPattern = "time-series/advanced_bonus/[symbol]";

            urlPattern = GetBaseUrl(urlPattern, symbol);
            var qsb     = GetQueryString(range, calendar, last, refId);
            var pathNvc = GetPathNvc(symbol);

            return(await executor.ExecuteAsync <IEnumerable <BonusIssueResponse> >(urlPattern, pathNvc, qsb));
        }
예제 #10
0
        public async Task <IEXResponse <IEnumerable <StatsHisoricalDailyResponse> > > StatsHistoricalDailyByDateAsync(string date)
        {
            const string urlPattern = "stats/historical/daily";

            var qsb = new QueryStringBuilder();

            qsb.Add("date", date);

            var pathNvc = new NameValueCollection();

            return(await executor.ExecuteAsync <IEnumerable <StatsHisoricalDailyResponse> >(urlPattern, pathNvc, qsb));
        }
예제 #11
0
        public async Task <IEXResponse <IEnumerable <HistoricalPriceResponse> > > HistoricalPriceAsync(string symbol,
                                                                                                       ChartRange range = ChartRange.OneMonth, QueryStringBuilder qsb = null)
        {
            const string urlPattern = "stock/[symbol]/chart/[range]";

            var pathNvc = new NameValueCollection
            {
                { "symbol", symbol },
                { "range", range.GetDescriptionFromEnum() },
            };

            return(await executor.ExecuteAsync <IEnumerable <HistoricalPriceResponse> >(urlPattern, pathNvc, qsb));
        }
예제 #12
0
        public async Task <IEXResponse <SocialSentimentDailyResponse> > SocialSentimentDailyAsync(string symbol, DateTime?date = null)
        {
            const string urlPattern = "stock/[symbol]/sentiment/daily/[date]";

            var qsb = new QueryStringBuilder();

            var pathNvc = new NameValueCollection
            {
                { "symbol", symbol },
                { "date", date == null?DateTime.Now.ToString("yyyyMMdd") : ((DateTime)date).ToString("yyyyMMdd") }
            };

            return(await _executor.ExecuteAsync <SocialSentimentDailyResponse>(urlPattern, pathNvc, qsb));
        }
예제 #13
0
        public async Task <IEXResponse <BatchBySymbolLegacyResponse> > BatchBySymbolAsync(string symbol, IEnumerable <BatchType> types,
                                                                                          string range = "", int last = 1)
        {
            if (types?.Count() < 1)
            {
                throw new ArgumentNullException(nameof(types));
            }

            const string urlPattern = "stock/[symbol]/batch";

            var qsType = new List <string>();

            foreach (var x in types)
            {
                switch (x)
                {
                case BatchType.Quote:
                    qsType.Add("quote");
                    break;

                case BatchType.News:
                    qsType.Add("news");
                    break;

                case BatchType.Chart:
                    qsType.Add("chart");
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(types));
                }
            }

            var qsb = new QueryStringBuilder();

            qsb.Add("types", string.Join(",", qsType));
            if (!string.IsNullOrWhiteSpace(range))
            {
                qsb.Add("range", range);
            }

            qsb.Add("last", last);

            var pathNvc = new NameValueCollection {
                { "symbol", symbol }
            };

            return(await executor.ExecuteAsync <BatchBySymbolLegacyResponse>(urlPattern, pathNvc, qsb));
        }
예제 #14
0
        public async Task <IEXResponse <EstimatesResponse> > EstimatesAsync(string symbol, Period period = Period.Quarter, int last = 1)
        {
            const string urlPattern = "stock/[symbol]/estimates/[last]";

            var qsb = new QueryStringBuilder();

            qsb.Add("period", period.GetDescriptionFromEnum());

            var pathNvc = new NameValueCollection
            {
                { "symbol", symbol },
                { "last", last.ToString() }
            };

            return(await executor.ExecuteAsync <EstimatesResponse>(urlPattern, pathNvc, qsb));
        }
예제 #15
0
        public async Task <IEXResponse <IEnumerable <AdvancedDividendResponse> > > DividendsAsync(string symbol,
                                                                                                  TimeSeriesRange range = TimeSeriesRange._this__quarter, bool calendar = false, int?last = null, string refid = null)
        {
            if (symbol == null)
            {
                throw new ArgumentNullException("Support for calls without symbol is not yet supported. Please submit a pull request on GitHub if you would like to add it.");
            }
            if (calendar)
            {
                throw new ArgumentException("Support for 'calendar' parameter is not yet supported. Please submit a pull request on GitHub if you would like to add it.");
            }
            if (last != null)
            {
                throw new ArgumentException("Support for 'last' parameter is not yet supported. Please submit a pull request on GitHub if you would like to add it.");
            }
            if (refid != null)
            {
                throw new ArgumentException("Support for 'refid' parameter is not yet supported. Please submit a pull request on GitHub if you would like to add it.");
            }

            const string urlPattern = "time-series/advanced_dividends/[symbol]";

            var qsb = new QueryStringBuilder();

            qsb.Add("range", range.ToString().ToLower().Replace("__", "-").Replace("_", string.Empty));

            var pathNvc = new NameValueCollection {
                { "symbol", symbol }
            };

            return(await executor.ExecuteAsync <IEnumerable <AdvancedDividendResponse> >(urlPattern, pathNvc, qsb));
        }
예제 #16
0
        public async Task <IEXResponse <IEnumerable <AdvancedFundamentalsResponse> > > AdvancedFundamentalsAsync(string symbol, TimeSeriesPeriod period = TimeSeriesPeriod.Quarterly, TimeSeries timeSeries = null)
        {
            const string urlPattern = "time-series/fundamentals/[symbol]/[period]";

            var qsb = new QueryStringBuilder();

            timeSeries?.AddTimeSeriesQueryParams(qsb);

            var pathNvc = new NameValueCollection
            {
                { "symbol", symbol },
                { "period", period.GetDescriptionFromEnum() }
            };

            return(await executor.ExecuteAsync <IEnumerable <AdvancedFundamentalsResponse> >(urlPattern, pathNvc, qsb));
        }
예제 #17
0
        BatchBySymbolAsync(string symbol, IEnumerable <BatchType> types,
                           IReadOnlyDictionary <string, string> optionalParameters = null)
        {
            if (string.IsNullOrEmpty(symbol))
            {
                throw new ArgumentNullException(nameof(symbol));
            }
            else if (types?.Count() < 1)
            {
                throw new ArgumentNullException(nameof(types));
            }

            if (optionalParameters != null && optionalParameters.ContainsKey("types"))
            {
                throw new ArgumentException(
                          paramName: nameof(optionalParameters),
                          message: $"types key in {nameof(optionalParameters)} argument with value \"{optionalParameters["types"]}\" is in conflict with the {nameof(types)} argument. Remove it from the collection");
            }

            const string urlPattern = "stock/[symbol]/batch";

            var qsType = new List <string>();

            foreach (var type in types)
            {
                qsType.Add(type.GetDescriptionFromEnum());
            }

            var qsb = new QueryStringBuilder();

            qsb.Add("types", string.Join(",", qsType));

            if (optionalParameters != null)
            {
                foreach (var parameter in optionalParameters)
                {
                    qsb.Add(parameter.Key, parameter.Value);
                }
            }

            var pathNvc = new NameValueCollection {
                { "symbol", symbol }
            };

            return(await executor.ExecuteAsync <BatchResponse>(urlPattern, pathNvc, qsb));
        }
예제 #18
0
        public async Task <IEXResponse <ExchangeRateResponse> > ExchangeRateAsync(string from, string to)
        {
            const string urlPattern = "fx/rate/[from]/[to]";

            var qsb = new QueryStringBuilder();

            var pathNvc = new NameValueCollection {
                { "from", from }, { "to", to }
            };

            return(await _executor.ExecuteAsync <ExchangeRateResponse>(urlPattern, pathNvc, qsb));
        }
예제 #19
0
        public async Task <IEXResponse <IEnumerable <HistoricalPriceResponse> > > HistoricalPriceAsync(string symbol,
                                                                                                       ChartRange range = ChartRange._1m, QueryStringBuilder qsb = null)
        {
            const string urlPattern = "stock/[symbol]/chart/[range]";

            var pathNvc = new NameValueCollection
            {
                { "symbol", symbol },
                { "range", range.ToString().Replace("_", string.Empty) },
            };

            return(await executor.ExecuteAsync <IEnumerable <HistoricalPriceResponse> >(urlPattern, pathNvc, qsb));
        }
예제 #20
0
        BatchBySymbolAsync(string symbol, IEnumerable <BatchType> types,
                           string range = "", int last = 1)
        {
            if (string.IsNullOrEmpty(symbol))
            {
                throw new ArgumentNullException(nameof(symbol));
            }
            else if (types?.Count() < 1)
            {
                throw new ArgumentNullException(nameof(types));
            }

            const string urlPattern = "stock/[symbol]/batch";

            var qsType = new List <string>();

            foreach (var type in types)
            {
                qsType.Add(type.GetDescriptionFromEnum());
            }

            var qsb = new QueryStringBuilder();

            qsb.Add("types", string.Join(",", qsType));
            if (!string.IsNullOrWhiteSpace(range))
            {
                qsb.Add("range", range);
            }

            qsb.Add("last", last);

            var pathNvc = new NameValueCollection {
                { "symbol", symbol }
            };

            return(await executor.ExecuteAsync <BatchResponse>(urlPattern, pathNvc, qsb));
        }
예제 #21
0
        public async Task <IEXResponse <IEnumerable <Quote> > > CollectionsAsync(CollectionType collection,
                                                                                 string collectionName)
        {
            const string urlPattern = "stock/market/collection/[collectionType]";
            var          qsb        = new QueryStringBuilder();

            qsb.Add("collectionName", collectionName);
            var pathNvc = new NameValueCollection {
                { "collectionType", collection.GetDescriptionFromEnum() }
            };

            return(await executor.ExecuteAsync <IEnumerable <Quote> >(urlPattern, pathNvc, qsb));
        }
예제 #22
0
        public async Task <IEXResponse <BalanceSheetResponse> > BalanceSheetAsync(string symbol, Period period = Period.Quarter,
                                                                                  int last = 1)
        {
            const string urlPattern = "stock/[symbol]/balance-sheet/[last]";

            var qsb = new QueryStringBuilder();

            qsb.Add("period", period.ToString().ToLower());

            var pathNvc = new NameValueCollection
            {
                { "symbol", symbol },
                { "last", last.ToString() }
            };

            return(await executor.ExecuteAsync <BalanceSheetResponse>(urlPattern, pathNvc, qsb));
        }