"""Compare endpoint momentum.

The denominator is the earlier price, not the later price.
All inputs are synthetic teaching examples. Run: python 27_rate-of-change.py
"""
from tv_math import *

p=[100,102,105,110]
roc=p[-1]/p[0]-1
assert abs(roc-.1)<1e-12
print(roc)
