Feature
Descendants
systematica.generic.base.Model
Instance variables
-
symbols: List[str]: Symbols. -
loader_name: str: Loader name. -
frequency: str: Frequency. -
optuna_metadata: Dict: Metadata for Optuna study tracking. Returns dictionary containing key configuration parameters excluding runtime objects (tracker, sampler, pruner, etc.). -
callbacks: Iterable[Callable[[optuna.study.study.Study, optuna.trial._frozen.FrozenTrial], None]] | None: List of callback functions that are invoked at the end of each trial. Each function must accept two parameters with the following types in this order: Study and FrozenTrial. -
catch: Iterable[Type[Exception]] | Type[Exception]: A study continues to run even when a trial raises one of the exceptions specified in this argument. Default is an empty tuple, i.e. the study will stop for any exception except for TrialPruned. -
clean: bool: Clean signals. Defaults toTrue. -
close: vectorbtpro.data.base.Data: -
data: vectorbtpro.data.base.Data: -
data_symbols: vectorbtpro.data.base.Data: -
direction: str | List[str]: Optimization objective, eitherminimizeormaximize, default ismaximize. -
end: str: The end date for the data in string format (e.g.,YYYY-MM UTC). If None, usedatetie.utcnow()to fetch the latest data possible. Default toNone. -
end_date: str: -
freq: str: Frequency of the data. Used whencross_validateis True. Defaults toNone. -
gc_after_trial: bool: Flag to determine whether to automatically run garbage collection after each trial. Set toTrueto run the garbage collection,Falseotherwise. It runs a full collection by internally callinggc.collect. If you see an increase in memory consumption over several trials, try setting this flag toTrue. Defaults toFalse. -
high: vectorbtpro.data.base.Data: -
id: str: Custom searchable id. -
load_if_exists: bool: Flag to control the behavior to handle a conflict of study names. In the case where a study named study_name already exists in the storage, a DuplicatedStudyError is raised if load_if_exists is set to False. Otherwise, the creation of the study is skipped, and the existing one is returned. -
loader_or_data: Callable: Default loader or data. If loader, it must accept timeframe as retriever. More information indata/loader. Defaults toload_clean_data. -
long_entries: float: Long entry signals. -
long_exits: float: Long exit signals. -
low: vectorbtpro.data.base.Data: -
metrics: str | List[str]: Performance metrics to compute. Defaults toNone. -
metrics_kwargs: Dict[str, Any]: Parameters for metric config. IfNone, uses default parameters based on the model type. This is used to specify parameters such aswindoworminpfor rolling metrics. If using cross-validation, this should be set toNoneas it is not applicable. If using rolling metrics, this should be set to a dictionary with parameters for the metric config. For example,{"window": 20}. Defaults toNone. -
model_params: Dict[str, Any]: A dictionary of optional keyword arguments needed to compute the model. -
n_completed_trials: int: The number of successfully completed trials before stopping the optimization. IfNone, it will run forn_trialstrials. TO be effective, the number of trials should be higher than the number of completed trials. default isNone. -
n_jobs: int: Number of parallel jobs for optimization (-1for using all availableCPUscores), default is-1. -
n_trials: int: The number of trials for the optimization. This is the maximum number of trials that will be run. Ifn_completed_trialsis set, the optimization will stop when the number of completed trials reaches this value. Ifn_completed_trialsis not set, the optimization will run forn_trialstrials. Ifn_trialsis set toNone, it will run indefinitely untiln_completed_trialsis reached. Ifn_trialsis set to0, it will not run any trials. Ifn_trialsis set to a negative value, it will run indefinitely untiln_completed_trialsis reached. Defaults to100. -
open: vectorbtpro.data.base.Data: -
portfolio_config: Dict[str, Any]: Default VectorBT portfolio parameters used in the systematica package. These parameters are used to define the portfolio simulation and its behavior. The default values are set to None or specific values as per the requirements of the systematica package. -
price: vectorbtpro.data.base.Data: -
pruner: optuna.pruners._base.BasePruner: Optuna Pruner. IfNone, defaults to Asynchronous Successive Halving Algorithm. Defaults toNone. -
s1: str: First symbol. -
s2: str: Second symbol. -
sampler: optuna.samplers._base.BaseSampler: Optuna Sampler. IfNone, defaults to TPE (Tree-structured Parzen Estimator) algorithm. Defaults toNone. -
select_symbols: str | int | List[str | int]: Symbol name (e.g.,BTCUSDTorETHUSDT) or column index (e.g.,0or1) to keep. If None, no filtering. -
short_entries: float: Short entry signals. -
short_exits: float: Short exit signals. -
show_progress_bar: bool: Flag to show progress bars or not. To show progress bar, set this True. Note that it is disabled when n_trials is None, timeout is not None, and n_jobs. -
signal_model: str: Signal model used for generating signals. -
start: str: The start date for the data in string format (e.g.,YYYY-MM UTC). Default toNone. -
start_date: Dict[str, Any]: -
storage: str | optuna.storages._base.BaseStorage: Database URL. If this argument is set to None,InMemoryStorageis used, and the Study will not be persistent. -
study_name: str: The name of the (optuna and tracker) study. -
suffix: str: Extension (suffix) of the file to load. Defaults toNone. -
timeframe: str: Timeframe of the file to be loaded. Defaults toNone. -
timeout: float: Stop study after the given number of second(s). None represents no limit in terms of elapsed time. The study continues to create trials until the number of trials reaches n_trials, timeout period elapses, stop() is called or, a termination signal such as SIGTERM or Ctrl+C is received. -
tracker: Type: Tracker instance for logging and monitoring the optimization process. IfNone, no tracking is performed. If you want to use a tracker, you can pass an instance of a tracker class that inherits fromBaseTracker. For example, you can useNeptuneTracker. This tracker will log the optimization process and metrics to the tracker service. Default to None. -
use_close: bool: Use close price if set to True. Otherwise, use open price. -
use_rolling: bool: Flag to use rolling method viaBaseWalkForwardRolling. Note that both rolling and cv models can be passed. Fallbacks toBaseWalkForwardCVif model is not usingfrom_rollingsplitter without error message. Defaults toFalse. -
verbose: bool: Whether to print Optuna logs during the optimization process. If True, prints logs to the console. Default isTrue.
Methods
check_direction
| Name | Type | Default | Description |
|---|---|---|---|
attribute | attrs.Attribute | -- | The attribute being validated. |
value | BaseStatArb | -- | The model instance. |
| Type | Description |
|---|---|
ValueError | If direction is not “maximize” or “minimize”. |
TypeError | If direction is not a string or a list |
check_metrics
| Name | Type | Default | Description |
|---|---|---|---|
attribute | attrs.Attribute | -- | The attribute being validated. |
value | BaseStatArb | -- | The model instance. |
| Type | Description |
|---|---|
TypeError | If metrics is not a string or list. |
ValueError | If metric has not been configured and is not tunable. |
asdict
| Type | Description |
|---|---|
Ttp.Kwargs | Feature dict. |
FeatureExpression
Instance variables
-
expr: str: Expression string. Must contain valid Python code and can be single-line or multi-line. -
include_pckg: Dict[str, Any]: External packages used in expr. -
kwargs: Dict[str, Any]: Additional key-word arguments used invbt.IF.from_expr
Model
Ancestors
systematica.generic.base.Feature
Descendants
systematica.walk_forward.base.BaseWalkForward
Instance variables
-
model_name: str: Model name. -
model: Any: Compute model, which defines the method to compute the feature. -
model_cls: Type: -
model_output: numpy.ndarray | pandas.core.frame.DataFrame | systematica.signals.base.Signals: -
preprocess_data: pandas.core.frame.DataFrame: -
preprocess_func: Callable: Preprocessing function applied to price data. If None, the model uses price data by default. Defaults to None.
Methods
updated_metrics_kwargs
| Name | Type | Default | Description |
|---|---|---|---|
attribute | attrs.Attribute | -- | The attribute being validated. |
value | BaseStatArb | -- | The model instance. |
| Type | Description |
|---|---|
TypeError | If metrics is not a string or list. |
ValueError | If metric has not been configured and is not tunable. |
get_model_output
| Name | Type | Default | Description |
|---|---|---|---|
to_numpy | bool | False | If True, converts output to a np.array. Default is False, returning a pd.DataFrame. |
| Type | Description |
|---|---|
np.ndarray or pd.DataFrame | Model output data. |
get_signals
| Name | Type | Default | Description |
|---|---|---|---|
validate_model | bool | True | Check if model parameters are valid. Defaults to True. |
| Type | Description |
|---|---|
Signals | Generated trading signals. |

