Data.alpaca.markets returns quotes from incorrect dates

I’m using PHP and doing the following:

$stocksOfInterest=array(‘SPY’);

$stockString=implode(",",$stocksOfInterest);
//2019-04-15T09:30:00-04:00’
$timeStart = date(“Y-m-d”) . “T” . date(“H:i:sP”);
echo “timestart: $timeStart
”;
$pricesOfStocks=$alpaca->getBars(‘minute’, $stockString,1,$timeStart);

I have this polling once a minute, every 3rd or 4th minute the Alpaca API returns data from two weeks ago. I’ve started using the $timeStart variable after I saw this behavior without the ‘start’ variable, but even adding the ‘start’ variable, I still get quotes from 2 weeks ago.

Why is this happening?

example:

using this call: =$alpaca->getBars(‘minute’, $stockString,10,$timeStart);

for Stock: SPY
timestart of: 2020-03-18T19:57:16+00:00

the data returned is:

Array ( [0] => Array ( [t] => 1584560040 [o] => 233.37 [h] => 233.66 [l] => 232.77 [c] => 233.08 [v] => 19771 ) [1] => Array ( [t] => 1584560100 [o] => 233.12 [h] => 233.12 [l] => 232.18 [c] => 232.495 [v] => 19779 ) [2] => Array ( [t] => 1584560220 [o] => 232.49 [h] => 232.69 [l] => 231.72 [c] => 231.85 [v] => 17878 ) [3] => Array ( [t] => 1584560340 [o] => 231.21 [h] => 231.735 [l] => 231.03 [c] => 231.49 [v] => 19243 ) [4] => Array ( [t] => 1584560460 [o] => 232.42 [h] => 233.03 [l] => 231.95 [c] => 232.8 [v] => 13162 ) [5] => Array ( [t] => 1584560520 [o] => 232.9 [h] => 234.05 [l] => 232.81 [c] => 234.05 [v] => 14271 ) [6] => Array ( [t] => 1584560640 [o] => 233.45 [h] => 234.17 [l] => 233.16 [c] => 233.89 [v] => 36657 ) [7] => Array ( [t] => 1584560760 [o] => 233.39 [h] => 233.95 [l] => 232.84 [c] => 233.08 [v] => 18258 ) [8] => Array ( [t] => 1584560880 [o] => 233.34 [h] => 233.99 [l] => 232.93 [c] => 233.99 [v] => 17128 ) [9] => Array ( [t] => 1584560940 [o] => 234.275 [h] => 235.72 [l] => 233.35 [c] => 235.63 [v] => 32013 ) )

I had specified a start of: 2020-03-18T19:57:16+00:00
but got quotes from: March 18, 2020, 19:34 pm

I’m getting a similar issue using R:
My request:
https://data.alpaca.markets/v1/bars/5Min?symbols=FB,NFLX,AMZN,MSFT&limit=1000&start=2020-02-05T09:30:00-0500&end=2020-02-24T14:45:00-0500
Returns data from the following time range:
"2020-03-02 09:50:00 EST" to "2020-03-18 15:55:00 EDT"

I’m going to post in the Data topic forum and tag an admin.
Here’s the post

This should be resolved by now (see the other post) but thanks for the report and let us know if you still see the issue.