Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
VWAP Standard Deviation

New to quantopian, how would I go about creating standard deviation bars for the VWAP?

Thanks

1 response

Do you want the code or logic ?

Logic: I think it's simple. Just like Bollinger Bands. Check if there is a built-in func, to find the std dev. It would probably take the input - Vwap, Close, period.
I found this:
from statistics import stdev

Importing statistics module

import statistics

creating a sample list

sample = (1, 1.3, 1.2, 1.9, 2.5, 2.2)

calculating the mean of sample set

m = statistics.mean(sample)

xbar is nothing but stores

the mean of the sample set

calculating the variance of sample set

print("Standard Deviation of Sample set is % s"
%(statistics.stdev(sample, xbar = m)))

Now sample would be the rolling close price. (just like moving avg)
M = vwap of the sample