quantlab.core.config.FrozenConfig#
- class quantlab.core.config.FrozenConfig[source]#
Bases:
objectBase of the frozen dataset, factor and model configs.
A list given to a tuple-typed field is stored as a tuple, so a config rebuilt from JSON, where every tuple was written as a list, equals the one that was saved.
Examples
>>> from quantlab.dataset.config import BaseDatasetConfig >>> cfg = BaseDatasetConfig(zarr_file_path="stock.zarr", symbols=["AAPL"]) >>> cfg.symbols ('AAPL',) >>> cfg.symbols = ("MSFT",) Traceback (most recent call last): dataclasses.FrozenInstanceError: cannot assign to field 'symbols'
- to_dict()[source]#
Return the config as a plain dict, each component as its own config.
The fields declared with
quantlab.core.component.componenthold their components’get_config(); seequantlab.core.component.config_to_dict.Examples
>>> from quantlab.dataset.config import BaseDatasetConfig >>> sorted(BaseDatasetConfig(zarr_file_path="stock.zarr").to_dict()) ['end_date', 'kwargs', 'name', 'resample_freq', 'resample_how', 'start_date', 'symbols', 'zarr_file_path']