Does anyone have example code to share that computes the daily VWAP using minute bars, across a universe of securities?
Presently, I'm using the code below (which isn't daily VWAP), but I'd like to try using daily VWAP values instead.
prices = data.history(context.stocks, 'price', 390*context.N, '1m').dropna(axis=1)
context.stocks = list(prices.columns.values)
prices = prices.ewm(com=390).mean().as_matrix(context.stocks)
The computation looks pretty straightforward (e.g. see http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:vwap_intraday ), but I'm lazy and perhaps someone has some efficient code to share (and it is a little messy, since one has to deal with the pandas datetime stamps, and chunk the data by trading day).