quantlab.label.predefined.fret.Return#
- class quantlab.label.predefined.fret.Return(factor_config)[source]#
Bases:
_OpenToOpenLabelForward n-bar open-to-open return label.
At signal timestamp
tthe label isadjOpen[t + n + 1] / adjOpen[t + 1] - 1: the position is entered at the next bar’s adjusted open and exitednbars later at the adjusted open. It is aForwardlabel withspan = nanddelay = 1, solookahead_bars()isn + 1. The label is NaN where either open is missing and at timestamps withoutn + 1later bars in the dataset.The output column is
ret_{n}.- Parameters:
- factor_configFactorConfig
The KunQuant factor config of the trailing return. Set
data_columnsto["adjOpen"]andkwargs["n_forward_periods"]to the horizonn;file_pathis wherebuildwrites the trailing return.
Examples
>>> label = Return(FactorConfig( ... warmup_bars=5, dataset=dataset, mode="batch", ... data_columns=["adjOpen"], kwargs={"n_forward_periods": 5}, ... file_path="ret.zarr", ... )) >>> label.lookahead_bars(), label.span_bars(), label.get_factor_names() (6, 5, ('ret_5',))