quantlab.core.component.walk_components#
- quantlab.core.component.walk_components(root, path='')[source]#
Yield every component under
rootwith its path, depth first,rootexcluded.The tree follows the declared component fields (see
component) of each component’sconfig. A path joins the field names with., and an item of a many-field adds its index or key, so the price dataset of a backtester is"price_dataset"and the dataset of its model’s first factor"model.factors.0.dataset". A component held in several places is yielded at each of them.- Parameters:
- rootComponent
The component to walk.
- pathstr, optional
The path of
rootitself, prefixed to every path yielded.
- Yields:
- tuple[str, Component]
A path and the component found there.
Examples
With
labelaForwardlabel over a factor over a dataset:>>> [path for path, _ in walk_components(label)] ['factor', 'factor.dataset']