Intro
Due to the limitations of the Bars
GET request at 1000 bars, I’m attempting to build a function that when start & end (or after / until) is a duration larger than 1000 bars will construct multiple requests and combine the resulting data to complete the request.
Specific Question
I’m noticing that the bars data returned by the API is of inconsistent intervals when extracting timeframe’s of less than 1 day.
Reprex
Here’s the request URL:
https://data.alpaca.markets/v1/bars/15Min?symbols=TLRY,BYND,AMZN&limit=1000&start=2019-05-13T15:02:04-0400&end=2019-08-05T15:02:04-0400
The TLRY data goes back to 2019-06-07 15:30:00 EDT, the BYND data goes back to it’s IPO date 2019-06-14 09:30:00 EDT, an the AMZN data goes back to 2019-05-30 13:30:00 EDT.
Is this expected behavior? This makes it quite difficult to build predictive models that assume the interval between each data point is the same, as the intervals appear to be quite random.
I was planning on using the Calendar
GET request to determine the intervals for forming the Bars
request, but given the inconsistent intervals it seems I might just need to iterate over the data for each ticker, extract the earliest date returned, use that as the end
of the next request, and form each new request until all of the data back to the original from
are returned.