Paper account data query denied

I am testing on a paper account and using the free data plan now. By default, it should get data from IEX. The way I get the stock data is:

api = StockHistoricalDataClient(key, secret, paper=True)

request_parameters = {some request parameters}

api.get_stock_bars(request_parameters).

It has been calling IEX for a long time but suddenly it seems to be routed to SIP now. and I got error {“message”:“subscription does not permit querying recent SIP data”}. All the strategy code cannot proceed because of this.

What do I miss in the python code so it didn’t route to the IEX data?Did we make some new data API change during the weekend? It has been working for the past months.

Can someone help me with this? I am using this account as a demo account for my clients and It is causing concern on my client side about the stability of the platform now.

@wuxiangtrading There haven’t been API changes recently which should impact the historical data feed used.

A ‘best practice’ when fetching historical data is to always explicitly include a feed parameter as below

sip_request_params = StockTradesRequest(
                                  symbol_or_symbols='AAPL',
                                  start=pd.to_datetime('2024-01-02T19:15:24.000Z'),
                                  end=pd.to_datetime('2024-01-02T19:15:24.999Z'),
                                  feed='sip')

iex_request_params = StockTradesRequest(
                                  symbol_or_symbols='AAPL',
                                  start=pd.to_datetime('2024-01-02T19:15:24.000Z'),
                                  end=pd.to_datetime('2024-01-02T19:15:24.999Z'),
                                  feed='iex'

This ensures one always knows exactly which data is being provided. IEX data is really intended for testing and debug and typically should not be used to make live trading decisions.

If one has a paid market data subscription then generally always specify SIP. A paid subscription has access to both historical and ‘real time’ full market SIP data. However, if one is using the free market data then only historical SIP data can be fetched and only IEX ‘real time’ data is available. ‘Real time’ in this case is anything more current than the past 15 minutes.

So, if one has a free market data subscription and one wants full market ‘historical’ data 1) specify feed=SIP and 2) ensure the end time is not more current than the previous 15 minutes. Note that the end time defaults to ‘now’, so not specifying it will often cause an “subscription does not permit querying recent SIP data” error.