Research Reference¶
Research workflow tracking, preprocessing, and portfolio construction tools.
Strategy research workflow helpers.
FeatureSet ¶
Executable feature definitions for research pipelines.
Pipeline ¶
Sequential train/test-safe research transformer pipeline.
get_params ¶
get_params() -> dict[str, Any]
Return serializable pipeline parameters for tracking artifacts.
Transformer ¶
Allocator ¶
Build portfolio weights from scores with object-style components.
Constraints ¶
EqualWeight ¶
RiskfolioOptimizer ¶
RiskfolioWeight ¶
Riskfolio-backed long-only minimum-variance allocation.
Scores select assets only. Returns must be a strictly historical finite matrix; no expected return, transaction-cost or turnover model is inferred.
TopK ¶
ResearchResult
dataclass
¶
ResearchRun ¶
Context manager that records tracked research function calls.
preprocess ¶
Static-method convenience facade for tracked preprocess functions.
record_step ¶
record_step(
name: str, category: str, params: dict[str, Any]
) -> None
Append a recorded step.
register ¶
register(name: str, component: Any) -> Any
Register an external definition; this does not imply execution.
call ¶
call(
name: str, method: str, *args: Any, **kwargs: Any
) -> Any
Execute and record a registered component, including failures.
Use this explicitly for sklearn and external objects. Merely entering the context never instruments arbitrary external fit/predict calls.
finish ¶
finish(
*,
features: Any | None = None,
target: Any | None = None,
selected_features: Sequence[str] | None = None,
model: Any | None = None,
scores: Any | None = None,
selected: Any | None = None,
weights: Any | None = None,
artifacts: dict[str, Any] | None = None,
) -> ResearchResult
Build the final structured result.
ResearchStep
dataclass
¶
A recorded research operation.
ModelScorer ¶
tracked ¶
tracked(
category: str, name: str | None = None
) -> Callable[[Callable[..., Any]], Callable[..., Any]]
Decorate a function so calls inside ResearchRun are recorded.
split_bars ¶
split_bars(
bars: DataFrame | Series,
*,
split: Any,
level: str | int | None = None,
) -> pd.DataFrame | pd.Series
Return bar data on or after split for test-period backtests.
This keeps research workflows explicit: full bars can be used to build factors and fit preprocessing, while only the test period enters backtest performance statistics.
time_split ¶
time_split(
data: DataFrame | Series,
*,
split: Any,
level: str | int | None = None,
) -> tuple[
pd.DataFrame | pd.Series, pd.DataFrame | pd.Series
]
Split time-indexed data into train/test sets.
The split point belongs to the test set: train < split and
test >= split. MultiIndex panels use the first datetime-like level
unless level is provided.