Barset after and untill usage

Hi,
I am using alpaca bar set as below,
spy = api.get_barset('SPY', 'day',1000,after = index_sim,until=end_date+ "T00:00:00-00:00").df
index_sim is Timestamp(‘2016-12-29 00:00:00-0500’, tz=‘America/New_York’)
end_date = "2020-08-01"
The bar set df should have been filtered after index_sim data to end_date, but i get the dataframe as below,
SPY
open high low close volume
time
2016-08-10 00:00:00-04:00 218.30 218.4038 217.230 217.640 45610104
2016-08-11 00:00:00-04:00 218.26 218.9400 217.950 218.650 48188152
2016-08-12 00:00:00-04:00 218.29 218.7100 217.990 218.450 41815620
2016-08-15 00:00:00-04:00 218.90 219.5000 218.880 219.125 38942460
2016-08-16 00:00:00-04:00 218.58 218.6800 217.960 217.980 46004375
… … … … …
2020-07-24 00:00:00-04:00 320.95 321.9900 319.246 320.860 117984836
2020-07-27 00:00:00-04:00 321.63 323.4100 320.775 323.180 42586195
2020-07-28 00:00:00-04:00 322.43 323.6400 320.850 321.200 89313354
2020-07-29 00:00:00-04:00 322.12 325.7300 322.075 325.090 87237532
2020-07-30 00:00:00-04:00 321.90 324.4100 319.640 323.980 106103025

[1000 rows x 5 columns]

I am wondering how to correctly use the bar set filters here?
Please let me know if some one has solved this already.
Thanks.

Hi, this is the correct way to use the get_barset() function:

import pandas as pd
NY = 'America/New_York'
start=pd.Timestamp('2020-08-01', tz=NY).isoformat()
end=pd.Timestamp('2020-08-30', tz=NY).isoformat()
print(api.get_barset(['AAPL', 'GOOG'], 'day', start=start, end=end).df)

# Minute data example
start=pd.Timestamp('2020-08-28 9:30', tz=NY).isoformat()
end=pd.Timestamp('2020-08-28 16:00', tz=NY).isoformat()
print(api.get_barset(['AAPL', 'GOOG'], 'minute', start=start, end=end).df)