Skip to content
DeepForgeby svx
All problems
EasyTime Seriests-283

Annualized Realized Volatility

Problem

Compute realized volatility from a return list and annualize it: sqrt(sum of squared returns) * sqrt(periods_per_year).

Return 0.0 when periods_per_year is not positive or the return list is empty.

Hint

Realized volatility scales with the square root of the number of periods in a year.

Test cases

case 1
in: [[0.01,-0.02,0.03],252]
expected: 0.5939696961967
case 2
in: [[0.1],4]
expected: 0.2
case 3
in: [[0,0],252]
expected: 0
case 4
in: [[],252]
expected: 0
Starter codePython
def annualized_realized_volatility(returns, periods_per_year):
    # Your code here
    pass

4 test cases · run your code against them in the editor