1

Based on this answer: Pandas Efficient VWAP Calculation

I see how one can efficiently make a vwap on a period of candles.

df['vwap_pandas'] = (df.v*(df.h+df.l)/2).cumsum() / df.v.cumsum()

However, what if I had a dataset with hundreds of days with one-minute candles and I want to calculate the VWAP on a per-day basis. I have a column which is the day, e.g. "2000-01-01". How could I do a group by day, and apply the above vwap function?

jdkealy
  • 4,807
  • 6
  • 34
  • 56
  • Did you find a solution? I have the exact same problem, trying to calculate the vwap per group: Minute. – Baobab Jun 10 '22 at 13:51

0 Answers0