# Trouble understanding the historical bars API

**URL:** <https://forum.alpaca.markets/t/trouble-understanding-the-historical-bars-api/12301>\
**Category:** Alpaca Market Data\
**Created:** [April 30, 2023, 7:15am UTC](https://forum.alpaca.markets/t/trouble-understanding-the-historical-bars-api/12301 "2023-04-30T07:15:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cda](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/cda/32/5346_2.png) [@cda](https://forum.alpaca.markets/u/cda)\
**Post date:** [April 30, 2023, 7:15am UTC](https://forum.alpaca.markets/t/trouble-understanding-the-historical-bars-api/12301/1 "2023-04-30T07:15:41Z")

</div>

If I request a 2 hour bar for PGNY starting at 14:30, the response comes back with the bar starting at 16:00.

I assumed that the bars can only start at multiples of the time frame, but then I tried to get a 7 hour bar starting at 14:00 and the bar that came back had a timestamp of 18:00.

I tried requesting 30 minute bars and aggregating them manually, and it seems to generally work for dates at least 1 month ago, but some bars are completely missing for more recent dates. For example, COKE returns no bar from 20:30 to 21:00 on 03/27.

The API documentation doesn’t seem to give any clarity around what’s going on here. Are there any guidelines around how to use the historical bars API effectively?
