# Alpaca Bar set not reflecting data correctly

**URL:** <https://forum.alpaca.markets/t/alpaca-bar-set-not-reflecting-data-correctly/388>\
**Category:** Alpaca Market Data\
**Created:** [October 25, 2019, 3:08pm UTC](https://forum.alpaca.markets/t/alpaca-bar-set-not-reflecting-data-correctly/388 "2019-10-25T15:08:31Z")\
**Posts on this page:** 6\
**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:** [October 25, 2019, 3:08pm UTC](https://forum.alpaca.markets/t/alpaca-bar-set-not-reflecting-data-correctly/388/1 "2019-10-25T15:08:31Z")

</div>

Hi  
I was cross checking some of the barset data pulled using alpaca api.barset for every 1min and 5min for CIDM stock, this is what i get. Any ideas what would be the problem here. Or “Alpaca please fix this”  
I am expecting all the enteries for OCT 25, below rows are my latest data  
time open high low close volume  
2019-10-09 10:20:00-04:00 1 1 1 1 100  
2019-10-16 10:00:00-04:00 0.8401 0.8401 0.8401 0.8401 300  
2019-10-16 10:05:00-04:00 0.8401 0.8401 0.8401 0.8401 100  
2019-10-21 15:20:00-04:00 1.02 1.02 1.01 1.01 200

---

<div class="post-metadata">

**Author:** ![hitoshi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/hitoshi/32/69_2.png) [@hitoshi](https://forum.alpaca.markets/u/hitoshi)\
**Post date:** [October 25, 2019, 5:30pm UTC](https://forum.alpaca.markets/t/alpaca-bar-set-not-reflecting-data-correctly/388/2 "2019-10-25T17:30:18Z")

</div>

Please keep in mind that not all ticker symbols at every minute has the price bar. If the name was not traded during the time window, the bar data isn’t generated. CIDM is small volume stock and it is possible that bars are sparse.

---

<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:** [October 25, 2019, 5:48pm UTC](https://forum.alpaca.markets/t/alpaca-bar-set-not-reflecting-data-correctly/388/3 "2019-10-25T17:48:07Z")

</div>

Thanks Hitoshi. I understand, i cross checked with yahoo stocks, which showed there were some price changes which made me think barsets did not populate correctly. See screenshot below:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/alp/original/1X/ac9f054fc3074ac94f45a3f247c04be001065ee6.png)

---

<div class="post-metadata">

**Author:** ![jimboski93](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@jimboski93](https://forum.alpaca.markets/u/jimboski93)\
**Post date:** [December 26, 2019, 6:07pm UTC](https://forum.alpaca.markets/t/alpaca-bar-set-not-reflecting-data-correctly/388/4 "2019-12-26T18:07:08Z")

</div>

Adding on to this old thread -  
I’ve noticed a lot of gaps in data.

I’m pulling the last 10 minutes of trades for DIS, one of the largest cap, most traded stocks.

The barset is clearly incomplete / missing data (see below), with a two minute gap, a five minute gap, and a six minute gap.

Is this data from IEX only the trades and volumes on IEX (versus market trades and market volume)?

```
DIS

```

open high low close volume  
time   
2019-12-26 12:28:00-05:00 145.235 145.235 145.235 145.235 100  
2019-12-26 12:29:00-05:00 145.270 145.270 145.270 145.270 6  
2019-12-26 12:30:00-05:00 145.210 145.210 145.200 145.200 309  
2019-12-26 12:32:00-05:00 145.225 145.230 145.210 145.210 900  
2019-12-26 12:37:00-05:00 145.345 145.345 145.345 145.345 10  
2019-12-26 12:38:00-05:00 145.380 145.380 145.380 145.380 100  
2019-12-26 12:39:00-05:00 145.400 145.400 145.390 145.395 500  
2019-12-26 12:45:00-05:00 145.425 145.430 145.425 145.430 147  
2019-12-26 12:47:00-05:00 145.450 145.450 145.450 145.450 100  
2019-12-26 12:50:00-05:00 145.480 145.480 145.480 145.480 20

---

<div class="post-metadata">

**Author:** ![josh\_t](https://avatars.discourse-cdn.com/v4/letter/j/c6cbf5/32.png) [@josh\_t](https://forum.alpaca.markets/u/josh_t)\
**Post date:** [January 3, 2020, 2:31am UTC](https://forum.alpaca.markets/t/alpaca-bar-set-not-reflecting-data-correctly/388/5 "2020-01-03T02:31:23Z")

</div>

Yes, that’s the issue with IEX. They have a lot of free data, but the price data is only what is traded through them.

> IEX Cloud provides real time prices, volume, and quotes for **all** [NMS](https://www.finra.org/filing-reporting/oats/oats-reportable-securities-list) US securities; sourced from the Investors Exchange.

---

<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:** [January 3, 2020, 6:35pm UTC](https://forum.alpaca.markets/t/alpaca-bar-set-not-reflecting-data-correctly/388/6 "2020-01-03T18:35:44Z")

</div>

You can use polygon to get the trades volume which are pulled from various other exchanges  
Here is how to do that:

```
import datetime
ENDPOINT ='https://api.alpaca.markets'
api = alpaca.REST(KEYID, SECRETKEY, ENDPOINT)
df = api.polygon.historic_agg_v2('AAPL', 1, 'day', '2014-10-28',str(datetime.date.today()),False,limit=10).df

```

This returns a dataframe with last 10 transactions. You can also have dataframe pulled based on the from and to dates only:

```
    df = api.polygon.historic_agg_v2('AAPL', 1, 'day', '2014-10-28', '2015-10-28', False).df

```

To use polygon you must have alpaca’s live trading account. Here is the detailed information listed here : [https://github.com/alpacahq/alpaca-trade-api-python](https://github.com/alpacahq/alpaca-trade-api-python)

Hope this helps.
