Does get_barset() work post market?

I signed up for Polygon for now, and I’m using a Python code calling your Polygon API to get minute bars for a stock. I’m using the command tradeapi.get_barset(symbol, timeframe='minute', limit=60) but it looks like the results are only returned up to the end of the market (4pm EST). How can I get the bars for post-market hours 4-6 pm EST? If that’s not possible while using Polygon, would it be possible using the new Alpaca API?

The python method get_barset uses IEX exchange data and not Polygon data and doesn’t include all data from all exchanges. That’s why you aren’t seeing any after-market data. To use the Polygon data one must explicitly call the polygon methods. So something like this would get you minute bars. You will need to calculate the correct times

polygon_min_bars = api.polygon.historic_agg_v2('IBM', 1, 'minute', '2021-03-01', '2021-03-02').df

The Alpaca Pro data plan offers real time market and after-market data, but one could also get the same data from other 3rd party sources too. Hope that helps.

1 Like