How to get data from 16 minutes ago?

Hello,

I’m facing a problem regarding the fact that you are not allowed to get data from the last 15 minutes. I have a free account and don’t want to upgrade yet. I want to get the code from 16 minutes ago, but this doesn’t seem to possible either. Here is my code, what am I doing wrong?:

dataframe = client.get_stock_bars(StockBarsRequest(symbol_or_symbols=[ticker], timeframe=TimeFrame.Minute, start =datetime.strptime("17/11/22 17:00", "%d/%m/%y %H:%M"), end=datetime.now()-timedelta(minutes=16))).df

What ticker, and what do you see? (Error? Missing data?) And is it always last ~20m or can it not be reproduced? (more details would help anyone trying to help)

Hi,

This is the error that I get:

alpaca.common.exceptions.APIError: {"code":42210000,"message":"your subscription does not permit querying data from the past 15 minutes"

It gaves the same error message when I put 60 minutes instead of 16 minutes. If I want data from more than a day ago, it’s no problem but I want to have the most recent data as possible. I don’t really know what you mean with ticker, so hopefully this clears it up a bit.

You need purchase subscription.

For the 16m problem, sounds like a timezone or a time sync problem. It sounds like the API thinks you’re asking for something you don’t mean to ask for, so try printing the date before you send it and if it matches what you’re thinking

Yes, if I try the line of code
print(datetime.now())
I get exactly the same time as I my current time, so it’s not a timezone problem I think.