Error when using get_stock_bars

Hi
I am getting the following error:
HTTPError: 403 Client Error: Forbidden for url: https://data.alpaca.markets/v2/stocks/bars

When I run the following Script:
request_params = StockBarsRequest(
symbol_or_symbols=tradable_symbols,
timeframe=TimeFrame(10, TimeFrameUnit.Minute),
start=lookup_open,
end=lookup_close
)

I realized that, I can’t request last 15 mins data. Whe I try, it gives this error. How can I get the last 15 mins data?

Thanks

@huseyin One needs to subscribe to the paid Market Data subscription to be able to fetch real-time full market SIP data (ie the most recent 15 minutes). However, for testing one can access a subset of data from the IEX exchange. Set feed=DataFeed.IEX. Ensure you import DataFeed first. You should then not get the 403 error.

from alpaca.data.enums import DataFeed

request_params = StockBarsRequest(
  symbol_or_symbols=tradable_symbols,
  timeframe=TimeFrame(10, TimeFrameUnit.Minute),
  start=lookup_open,
  end=lookup_close,
  feed=DataFeed.IEX
  )

Do you mean that the data is not correct in this Data Feed?

@huseyin The IEX feed only represents trades and quotes which executed on the IEX exchange. It’s not full market data and can sometimes be quite different. It really shouldn’t typically be used for making trading decisions. The use case is primarily for testing and debug.