quantlab.utils.returns#
One-bar returns of a price panel: price[t] / price[t - 1] - 1.
one_bar_returns is the one copy of the formula the factor, risk and
portfolio layers share, so they agree on its rule: the first bar has no
return, and a bar where either price is missing has none either (NaN, never
0). A caller that wants a halt to show as a zero return forward-fills the
prices first.
Functions
Return |