Given a 1-D float array of n positive closing prices, return the 1-D array of n-1 continuously-compounded (log) returns log(p[t] / p[t-1]).
n
n-1
log(p[t] / p[t-1])
Input
[100. 105. 103. 110.]
Output
[ 0.04879016 -0.01923136 0.06575138]
This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.
solve(...)