/// <inheritdoc /> public Task <IHistoricalItems <IAgg> > ListAggregatesAsync( AggregatesRequest request, CancellationToken cancellationToken = default) => _httpClient.GetAsync <IHistoricalItems <IAgg>, JsonHistoricalItems <IAgg, JsonPolygonAgg> >( request.EnsureNotNull(nameof(request)).Validate().GetUriBuilder(this), cancellationToken);
/// <summary> /// Gets list of historical minute bars for single asset from Polygon's v2 REST API endpoint. /// </summary> /// <param name="request">Day aggregates request parameter.</param> /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param> /// <returns>Read-only list of day bars for specified asset.</returns> public Task <IHistoricalItems <IAgg> > ListAggregatesAsync( AggregatesRequest request, CancellationToken cancellationToken = default) { request.EnsureNotNull(nameof(request)).Validate(); var unixFrom = DateTimeHelper.GetUnixTimeMilliseconds(request.TimeInterval.From ?? default); var unixInto = DateTimeHelper.GetUnixTimeMilliseconds(request.TimeInterval.Into ?? default); var builder = new UriBuilder(_httpClient.BaseAddress) { Path = $"v2/aggs/ticker/{request.Symbol}/range/{request.Period.ToString()}/{unixFrom}/{unixInto}", Query = getDefaultPolygonApiQueryBuilder() .AddParameter("unadjusted", request.Unadjusted ? Boolean.TrueString : Boolean.FalseString) }; return(_httpClient.GetSingleObjectAsync <IHistoricalItems <IAgg>, JsonHistoricalItems <IAgg, JsonPolygonAgg> >( FakeThrottler.Instance, builder, cancellationToken)); }