What is the equivalent of get_barset in alpaca-py?

Hi all,

I want to get the latest price info for a stock.
I found that get_barset() was doing it with the old API.
What is the equivalent of get_barset() in alpaca-py?

Thanks

@huseyin Use the get_stock_bars method to get bars using the alpaca-py SDK. Maybe like this

symbol_or_symbols = 'WCEO'

end = pd.to_datetime('now', utc=True).tz_convert('America/New_York')
start = end - pd.Timedelta('20Day')

# Fetch today and yesterday's data and convert to dataframe
bars = data_client.get_stock_bars(StockBarsRequest(
                                  symbol_or_symbols=symbol_or_symbols,
                                  timeframe=TimeFrame(5, TimeFrameUnit.Minute),
                                  start=start,
                                  end=end,
                                  feed=DataFeed.SIP,
                                  )).df

However, a better way to get the latest bar is to use the get_latest_bar method. That way you do not need to deal with times. You should check the bar datetime if doing that. It may be quite old.