Premium problem166. RiskMetrics EWMA Volatility

Medium Locked

Return the array of volatilities sqrt(v), the same length as returns:

  • v[t] = lam * v[t-1] + (1 - lam) * returns[t-1]**2
  • seed with v[0] = var(returns), population variance

Input

returns = [ 0.01  -0.02   0.015 -0.005]
lam = 0.94

Output

[0.01369306 0.0135     0.01397551 0.01403909]

Premium problem

This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.

Implement solve(...)