"""Measure downside deviation against a target.

The denominator averages squared shortfalls across all observations, including zero shortfalls.
All inputs are synthetic teaching examples. Run: python 09_sortino-target.py
"""
from tv_math import *

s=sortino([-.02,.02,.03],0,1)
assert abs(s-(.01/(.02/math.sqrt(3))))<1e-12
print(s)
