How to "listen" for 15 minute bar updates?

Hi, I am wondering how one might convert minute updates into 15 minute bars. I want to run my logic over the 15 minute time scale but obvs only minute/day are available. I am relatively new to this as you may tell, so go easy on me!

Thanks in advance

Hi,
you could use the websocket subscription with AM (aggregated minutes), and then test if 15 minutes past since your last operation.
then you could take the 15 1 minute bars and resample them to 1, 15 minute bar.
if you save them in a dataframe you could do it like this:

df.resample('15T').agg(dict(
                    open='first',
                    high='max',
                    low='min',
                    close='last',
                    volume='sum',
                ))

if you save them as bars, just do the operations described manually

Hello,

thanks for your reply!
I am a bit confused however; The 15 minute bars I create using this method will not be consistent with the 15 minute bars found on the exchanges/trading view unless I start the 15 minute period at the same time they do. Can you help me understand this please

thanks

e

as you said, you need to use the same time window, starting at the same time.

do you happen to know at what time the 15 minute bars are generated across exchanges?
Thanks again Shlomik

just use this endpoint https://alpaca.markets/docs/api-documentation/api-v2/market-data/bars/
get 15 minute bars (historic) and build your streamer accordingly

Pretty sure it’s just every quarter hour. So 10:00, 10:15, 10:30, 10:45, etc