quantlab.label.predefined.fret#
Forward-return labels over the adjusted open, computed with KunQuant.
A label is the value a model learns to predict. Here it is the return a
position opened after bar t would earn over the next n bars.
Return is the regression target (that return itself) and
BinaryReturn the classification target (1.0 when the return is
positive, 0.0 when it is not, NaN when it is missing). Both read
adjOpen, the split- and dividend-adjusted open price, and take the
horizon n from config.kwargs["n_forward_periods"].
KunQuant, the library that computes the graph, compiles formulas to native
code and can only look backwards in time. Each label therefore wraps a
private factor computing the trailing return adjOpen[t] / adjOpen[t - n] -
1 in a Forward label with span = n and delay = 1, which shifts
it n + 1 bars earlier. The label at t is then adjOpen[t + n + 1] /
adjOpen[t + 1] - 1: a position entered at the next bar’s open, because a
signal formed at bar t cannot trade before then.
Volatility follows the same conventions over the same opens: the
sample standard deviation of the one-bar open-to-open returns inside the
n-bar window, times sqrt(n), so a Return and a Volatility
of the same n describe the same holding period.
Classes
Forward n-bar open-to-open direction label. |
|
Forward n-bar open-to-open return label. |
|
Forward n-bar open-to-open volatility label. |