Ejemplo n.º 1
0
        public async Task <Dictionary <string, IEnumerable <HISTResponse> > > HISTAsync()
        {
            const string urlPattern = "hist";

            var qsb = new QueryStringBuilder();

            var pathNvc = new NameValueCollection();

            return(await _executor.ExecuteAsyncLegacy <Dictionary <string, IEnumerable <HISTResponse> > >(urlPattern, pathNvc, qsb));
        }
Ejemplo n.º 2
0
        public async Task <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.ExecuteAsyncLegacy <IEnumerable <StatsHistoricalSummaryResponse> >(urlPattern, pathNvc, qsb));
        }
Ejemplo n.º 3
0
        public async Task <MetadataResponse> MetadataAsync()
        {
            const string urlPattern = "account/metadata";

            var qsb = new QueryStringBuilder();

            qsb.Add("token", _sk);

            var pathNVC = new NameValueCollection();

            return(await _executor.ExecuteAsyncLegacy <MetadataResponse>(urlPattern, pathNVC, qsb));
        }
        public async Task <IEnumerable <StatsHisoricalDailyResponse> > StatsHistoricalDailyByDateAsync(string date)
        {
            const string urlPattern = "stats/historical/daily";

            var qsb = new QueryStringBuilder();

            qsb.Add("token", _pk);
            qsb.Add("date", date);

            var pathNvc = new NameValueCollection();

            return(await _executor.ExecuteAsyncLegacy <IEnumerable <StatsHisoricalDailyResponse> >(urlPattern, pathNvc, qsb));
        }
Ejemplo n.º 5
0
        public async Task <BatchBySymbolV1Response> 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.ExecuteAsyncLegacy <BatchBySymbolV1Response>(urlPattern, pathNvc, qsb));
        }
Ejemplo n.º 6
0
        public async Task <IEnumerable <InternationalSymbolResponse> > InternationalExchangeSymbolsAsync(string exchange)
        {
            const string urlPattern = "ref-data/exchange/[exchange]/symbols";

            var qsb = new QueryStringBuilder();

            qsb.Add("token", _pk);

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

            return(await _executor.ExecuteAsyncLegacy <IEnumerable <InternationalSymbolResponse> >(urlPattern, pathNvc, qsb));
        }
Ejemplo n.º 7
0
        public async Task <SocialSentimentDailyResponse> SocialSentimentDailyAsync(string symbol, DateTime?date = null)
        {
            const string urlPattern = "stock/[symbol]/sentiment/daily/[date]";

            var qsb = new QueryStringBuilder();

            qsb.Add("token", _pk);

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

            return(await _executor.ExecuteAsyncLegacy <SocialSentimentDailyResponse>(urlPattern, pathNvc, qsb));
        }
Ejemplo n.º 8
0
        public async Task <ExchangeRateResponse> ExchangeRateAsync(string from, string to)
        {
            const string urlPattern = "fx/rate/[from]/[to]";

            var qsb = new QueryStringBuilder();

            qsb.Add("token", _pk);

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

            return(await _executor.ExecuteAsyncLegacy <ExchangeRateResponse>(urlPattern, pathNvc, qsb));
        }
Ejemplo n.º 9
0
        public async Task <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("token", pk);
            qsb.Add("period", period.ToString().ToLower());

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

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