I am receiving the following error when trying to access hourly chart information in python. I have referenced the “Missing hourly data” forum post and a couple of other sites that use an hour timeframe.
I tried the following reference code from the forum post above to see if it was just my code, but I get the following error.
Error:
“alpaca_trade_api.rest.APIError: your subscription does not permit querying data from the past 15 minutes”
Code Test:
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(bars)
# Display the count per day
display(hour_bars_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])
Does this mean, hourly bar chart data is not available on the free subscription?? Or does the market need to be open for the timeframe to work?
Thank you