# Barset after and untill usage

**URL:** https://forum.alpaca.markets/t/barset-after-and-untill-usage/2595
**Category:** Getting Started with Alpaca
**Created:** [September 10, 2020, 12:45am UTC](https://forum.alpaca.markets/t/barset-after-and-untill-usage/2595 "2020-09-10T00:45:20Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![tvdevelop1](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@tvdevelop1](https://forum.alpaca.markets/u/tvdevelop1)
#### Post date: [September 10, 2020, 12:45am UTC](https://forum.alpaca.markets/t/barset-after-and-untill-usage/2595/1 "2020-09-10T00:45:20Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Shlomik](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/shlomik/32/793_2.png) [@Shlomik](https://forum.alpaca.markets/u/Shlomik)
#### Post date: [September 14, 2020, 12:32pm UTC](https://forum.alpaca.markets/t/barset-after-and-untill-usage/2595/2 "2020-09-14T12:32:12Z")

</div>

Hi, this is the correct way to use the get\_barset() function:

```auto
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)

```
