# How to get data from 16 minutes ago?

**URL:** <https://forum.alpaca.markets/t/how-to-get-data-from-16-minutes-ago/11144>\
**Category:** Alpaca Integration Applications\
**Created:** [November 22, 2022, 7:33pm UTC](https://forum.alpaca.markets/t/how-to-get-data-from-16-minutes-ago/11144 "2022-11-22T19:33:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Koen\_ter\_Heegde](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/koen_ter_heegde/32/4446_2.png) [@Koen\_ter\_Heegde](https://forum.alpaca.markets/u/Koen_ter_Heegde)\
**Post date:** [November 22, 2022, 7:33pm UTC](https://forum.alpaca.markets/t/how-to-get-data-from-16-minutes-ago/11144/1 "2022-11-22T19:33:44Z")

</div>

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?:

```auto
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

```

---

<div class="post-metadata">

**Author:** ![jamesfulford](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/jamesfulford/32/3538_2.png) [@jamesfulford](https://forum.alpaca.markets/u/jamesfulford)\
**Post date:** [November 29, 2022, 7:38pm UTC](https://forum.alpaca.markets/t/how-to-get-data-from-16-minutes-ago/11144/2 "2022-11-29T19:38:12Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![Koen\_ter\_Heegde](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/koen_ter_heegde/32/4446_2.png) [@Koen\_ter\_Heegde](https://forum.alpaca.markets/u/Koen_ter_Heegde)\
**Post date:** [November 29, 2022, 9:25pm UTC](https://forum.alpaca.markets/t/how-to-get-data-from-16-minutes-ago/11144/3 "2022-11-29T21:25:34Z")

</div>

Hi,

This is the error that I get:

```auto
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.

---

<div class="post-metadata">

**Author:** ![rock](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/rock/32/4872_2.png) [@rock](https://forum.alpaca.markets/u/rock)\
**Post date:** [November 29, 2022, 11:20pm UTC](https://forum.alpaca.markets/t/how-to-get-data-from-16-minutes-ago/11144/4 "2022-11-29T23:20:52Z")

</div>

You need purchase subscription.

---

<div class="post-metadata">

**Author:** ![jamesfulford](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/jamesfulford/32/3538_2.png) [@jamesfulford](https://forum.alpaca.markets/u/jamesfulford)\
**Post date:** [November 29, 2022, 11:28pm UTC](https://forum.alpaca.markets/t/how-to-get-data-from-16-minutes-ago/11144/5 "2022-11-29T23:28:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Koen\_ter\_Heegde](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/koen_ter_heegde/32/4446_2.png) [@Koen\_ter\_Heegde](https://forum.alpaca.markets/u/Koen_ter_Heegde)\
**Post date:** [November 30, 2022, 7:10am UTC](https://forum.alpaca.markets/t/how-to-get-data-from-16-minutes-ago/11144/6 "2022-11-30T07:10:47Z")

</div>

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.
