Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save quantra-go-algo/67e2ae0e6b620690e7b20657a7c4bd08 to your computer and use it in GitHub Desktop.
Save quantra-go-algo/67e2ae0e6b620690e7b20657a7c4bd08 to your computer and use it in GitHub Desktop.
def get_Daily_Volatility(df,span0=20):
# simple percentage returns
df0=df['Close'].pct_change()
# 20 days, a month EWM's std as boundary
df0=df0.ewm(span = span0, adjust = False).std()
# Round the column values to six decimals
df0 = df0.round(6)
return df0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment