I am learning to use the alpaca APIs. Actually I have used for some days to download the recent historical data which was totally fine. But today when I was trying to do the same thing (nothing changed). But with same code I have received an exception: {“message”:“subscription does not permit querying recent SIP data”}
@yy824 I believe the Alpaca API is reading your end parameter as not being more than 15 minutes from the previous time. Not sure if this is the correct log entry, but I found many errors like this in the logs. Notice the timestamp and the end parameter.
The end parameter must be before 18:32:18.702 (ie timestamp - 15Min), but the request was for 18:32:20.437651 which was after that time.
The issue is probably your local machine’s clock is not synched to NIS time. Check out this page for how to do that. Alternately, rather than calling datetime.now(timezone.utc). to get the time, make a cal to the Alpaca’s clock API. To test if that is the issue, maybe try subtracting 15:05 Min from the current time.
One more tip: if you’d like to set your end date to 15 minutes ago because you’re on the free plan, you can simply leave it out (not set end at all) and in that case it will default to exactly what you want.