Bloomberg BQL - can anyone spot the error

Hmm, OK. Again, I have not used bbg in a while. So why not just download daily volume data and aggregate on your own? Very simple.
A lot of data to handle across 100,000 entries. I found out how to do it using BQL.
 
I want to change this formula so it returns just one figure = average 30 day volume for at specific date.

How should the formula look like to achieve that?

Heres a few options. I know you said you figured it out but just in case other people want to know. Ive spent the past few months learning the ins and outs of BQL because I dont want to use helpdesk as a crutch.

Hit me up if you have any q's. I dont work for them.

Avg for past 30 days:
avg(dropna(px_volume(dates=range(-30d, 0d))))/1M

Avg for 30 days, for a given startdate/enddate:
avg(dropna(px_volume(dates=range(2022-01-01, 2022-01-31))))/1M

You can also use a startdate or enddate with a range:
avg(dropna(px_volume(dates=range(2022-01-01, +30d))))/1M
or
avg(dropna(px_volume(dates=range(-30d, 2022-01-31))))/1M

On a rolling basis
rolling(avg(dropna(px_volume(dates=range(0d, 30d))))/1M, iterationdates=range(2022-01-01, 2022-01-02))

or range(-1Y, 0D).

I used dropna() because you want to drop out the non-trading days. If you want to count non-trading days as zero use znav().
 
Heres a few options. I know you said you figured it out but just in case other people want to know. Ive spent the past few months learning the ins and outs of BQL because I dont want to use helpdesk as a crutch.

Hit me up if you have any q's. I dont work for them.

Avg for past 30 days:
avg(dropna(px_volume(dates=range(-30d, 0d))))/1M

Avg for 30 days, for a given startdate/enddate:
avg(dropna(px_volume(dates=range(2022-01-01, 2022-01-31))))/1M

You can also use a startdate or enddate with a range:
avg(dropna(px_volume(dates=range(2022-01-01, +30d))))/1M
or
avg(dropna(px_volume(dates=range(-30d, 2022-01-31))))/1M

On a rolling basis
rolling(avg(dropna(px_volume(dates=range(0d, 30d))))/1M, iterationdates=range(2022-01-01, 2022-01-02))

or range(-1Y, 0D).

I used dropna() because you want to drop out the non-trading days. If you want to count non-trading days as zero use znav().
Wauu thank you!
 
Back
Top