Bloomberg BQL - can anyone spot the error

Discussion in 'Strategy Building' started by Maverick2608, Oct 8, 2022.

  1. Only current.
     
    #11     Oct 10, 2022
  2. M.W.

    M.W.

    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.

     
    #12     Oct 10, 2022
  3. A lot of data to handle across 100,000 entries. I found out how to do it using BQL.
     
    #13     Oct 10, 2022
    M.W. likes this.
  4. Sorted

    Sorted

    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().
     
    #14     Nov 4, 2022
    Maverick2608 likes this.
  5. Wauu thank you!
     
    #15     Nov 4, 2022