Missing hourly data

I was playing a around with hourly and daily data. I observe SPY is up to date with the daily data… but is missing 2 months of hourly data. And the hourly data only has 1 or 2 months of historical data.

@King_Coffee Which API are you using? Are you using the older ‘v1’ APIs? The ‘v2’ APIs contain complete data. You will need to subscribe to the ‘Unlimited’ data plan otherwise you will only have access to IEX exchange data which is not full consolidated data (similar to the v1 data).

Checking for 2021 it looks like there are 16 hour bars for each trading day (which would be expected). This is the code I used

symbol = 'SPY'
start_date = '2021-01-01'
end_date = '2021-05-25'

bars = api.get_bars(symbol, TimeFrame.Hour, start=start_date, end=end_date, adjustment='raw').df
bars.index = bars.index.tz_convert('America/New_York')

# Add a day column and count the number of hour bars per day.
bars['day'] = bars.index.date
hour_bars_per_day = bars.groupby('day').close.count()

# Display the bars

# Display the count per day

# Display those days where the count is less than 16
display('days with less than 16 hour bars: ', hour_bars_per_day[hour_bars_per_day < 16])

Here is the result. Notice the days where there are less than 16 bars is empty.

I’m using the C# toolkit and I think this is the relevant code snippets

public Task<IPage> ListHistoricalBarsAsync(
HistoricalBarsRequest request,
CancellationToken cancellationToken = default) =>
_httpClient.GetAsync<IPage, JsonBarsPage>(

internal UriBuilder GetUriBuilder(
HttpClient httpClient) =>
new UriBuilder(httpClient.BaseAddress!)
Path = $“v2/stocks/{Symbol}/{LastPathSegment}”,
Query = AddParameters(Pagination.QueryBuilder
.AddParameter(“start”, TimeInterval.From, “O”)
.AddParameter(“end”, TimeInterval.Into, “O”)
.AddParameter(“limit”, 10000))

I request 9 months of hourly bars as follows (into is the current date)

DateTime from = into.AddMonths(-9);
IPage barSet = group.alpacaDataClient.ListHistoricalBarsAsync(
new HistoricalBarsRequest(symbol, from, into, BarTimeFrame.Hour)).Result;
IReadOnlyList bars = barSet.Items;

List tmp = new();
foreach (IBar bar in bars)
DateTime dt = DateTimeHelper.UTCToESTZone((DateTime)bar.TimeUtc);
CustomTick tick = new()
Close = bar.Close,
High = bar.High,
Low = bar.Low,
Open = bar.Open,
TimeStamp = dt,
Volume = bar.Volume

I only get bars between the following to timestamps

“TimeStamp”: “2020-08-27T04:00:00”
“TimeStamp”: “2020-09-14T16:00:00”

PS: I’m using the free Base Plan

Hi Dan Whitnable,

It appears that I am using the V2 API. However, I’m currently in the development phase of a project.
So, if you can also run your ‘SPY’ historical data test with the free Basic Plan to see if the results are the same. I would greatly appreciate the feedback.