> ## Documentation Index
> Fetch the complete documentation index at: https://systematica.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Models

> systematica.portfolio.composers.models

## `Composer`

```python theme={null}
Composer(
    model_name: str,
    signal_params=_Nothing.NOTHING,
    portfolio_params: Dict[str, Any] = _Nothing.NOTHING,
    model_params: Dict[str, Any] = _Nothing.NOTHING,
)
```

Run single pipeline from trial.

A composer that executes a single pipeline using the model class.

Method generated by attrs for class BaseComposer.

### Ancestors

* `systematica.portfolio.composers.base.BaseComposer`

### Methods

#### `run`

```python theme={null}
run(
    self,
    data: vectorbtpro.data.base.Data,
    s1: str,
    s2: str,
    use_close: bool = True,
) ‑> systematica.portfolio.analyzers.base.PortfolioAnalyzer
```

Execute the pipeline with the given data and symbols.

**Parameters**:

| Name        | Type       | Default | Description                                        |
| ----------- | ---------- | ------- | -------------------------------------------------- |
| `data`      | `vbt.Data` | `--`    | Input data for the pipeline.                       |
| `s1`        | `str`      | `--`    | First symbol.                                      |
| `s2`        | `str`      | `--`    | Second symbol.                                     |
| `use_close` | `bool`     | `True`  | Whether to use 'Close' prices. Defaults to `True`. |

**Returns**:

| Type                | Description                                          |
| ------------------- | ---------------------------------------------------- |
| `PortfolioAnalyzer` | Portfolio analyzer object with the pipeline results. |

## `SignalComposer`

```python theme={null}
SignalComposer(
    model_name: str,
    signal_params=_Nothing.NOTHING,
    portfolio_params: Dict[str, Any] = _Nothing.NOTHING,
    model_params: Dict[str, Any] = _Nothing.NOTHING,
)
```

Combine trial strategies via concat signals.

A composer that combines multiple trial strategies by concatenating
their signals.

Method generated by attrs for class BaseComposer.

### Ancestors

* `systematica.portfolio.composers.base.BaseComposer`

### Methods

#### `run`

```python theme={null}
run(
    self,
    data: vectorbtpro.data.base.Data,
    s1: str,
    s2: str,
    use_close: bool = True,
) ‑> systematica.portfolio.analyzers.base.PortfolioAnalyzer
```

Execute and combine multiple strategies by concatenating their signals.

**Parameters**:

| Name        | Type       | Default | Description                                      |
| ----------- | ---------- | ------- | ------------------------------------------------ |
| `data`      | `vbt.Data` | `--`    | Input data for the pipeline.                     |
| `s1`        | `str`      | `--`    | First symbol.                                    |
| `s2`        | `str`      | `--`    | Second symbol.                                   |
| `use_close` | `bool`     | `True`  | Whether to use 'Close' prices (default is True). |

**Returns**:

| Type                | Description                                               |
| ------------------- | --------------------------------------------------------- |
| `PortfolioAnalyzer` | Portfolio analyzer object with combined strategy results. |

## `ColumnStackComposer`

```python theme={null}
ColumnStackComposer(
    model_name: str,
    signal_params=_Nothing.NOTHING,
    portfolio_params: Dict[str, Any] = _Nothing.NOTHING,
    model_params: Dict[str, Any] = _Nothing.NOTHING,
)
```

Combine trial strategies via colum\_stack method.

A composer that combines multiple trial strategies using the column\_stack
method from vectorbtpro.

Method generated by attrs for class BaseComposer.

### Ancestors

* `systematica.portfolio.composers.base.BaseComposer`

### Methods

#### `run`

```python theme={null}
run(
    self,
    data: vectorbtpro.data.base.Data,
    s1: str,
    s2: str,
    group_by: bool = True,
    use_close: bool = True,
) ‑> systematica.portfolio.analyzers.base.PortfolioAnalyzer
```

Execute and combine multiple strategies using column stacking.

**Parameters**:

| Name        | Type       | Default | Description                                      |
| ----------- | ---------- | ------- | ------------------------------------------------ |
| `data`      | `vbt.Data` | `--`    | Input data for the pipeline.                     |
| `s1`        | `str`      | `--`    | First symbol.                                    |
| `s2`        | `str`      | `--`    | Second symbol.                                   |
| `group_by`  | `bool`     | `True`  | Whether to group the results, by default True.   |
| `use_close` | `bool`     | `True`  | Whether to use 'Close' prices (default is True). |

**Returns**:

| Type                | Description                                                     |
| ------------------- | --------------------------------------------------------------- |
| `PortfolioAnalyzer` | Portfolio analyzer object with column-stacked strategy results. |

## `PortfolioComposer`

```python theme={null}
PortfolioComposer(
    feature_config: Dict[str, Any],
    model_params: Dict[str, Any],
)
```

Compose portfolio(s) from trials.

Method generated by attrs for class PortfolioComposer.

### Class variables

* `feature_config: Dict[str, Any]`: Configuration for a feature calculation.

* `model_params: Dict[str, Any]`: A dictionary of optional keyword arguments needed to compose the portfolio.

### Instance variables

* `all_params: Dict[str, Any]`: All parameters.

### Methods

#### `get_data`

```python theme={null}
get_data(
    self,
    loader: vectorbtpro.data.base.Data | Callable = None,
    loader_kwargs: Dict[str, Any] = None,
) ‑> vectorbtpro.data.base.Data
```

Get data.

**Parameters**:

| Name            | Type        | Default | Description                                                                                   |
| --------------- | ----------- | ------- | --------------------------------------------------------------------------------------------- |
| `loader`        | `vbt.Data`  | `--`    | \| tp.Callable, default None Data loader function or object. If None, uses `load_clean_data`. |
| `loader_kwargs` | `tp.Kwargs` | `None`  | Additional keyword arguments for the loader function. If None, uses `config.LOADER_PARAMS`.   |

**Returns**:

| Type        | Description  |
| ----------- | ------------ |
| `tp.Kwargs` | Data params. |

#### `get_compose_params`

```python theme={null}
get_compose_params(
    self,
) ‑> Dict[str, Any]
```

Get compose parameters.

**Returns**:

| Type        | Description     |
| ----------- | --------------- |
| `tp.Kwargs` | Compose params. |

#### `get_symbol_params`

```python theme={null}
get_symbol_params(
    self,
) ‑> Dict[str, Any]
```

Get symbol params.

**Returns**:

| Type        | Description     |
| ----------- | --------------- |
| `tp.Kwargs` | Symbol params.. |

#### `run`

```python theme={null}
run(
    self,
    column_stack: bool = True,
    group_by: bool = True,
    loader: vectorbtpro.data.base.Data | Callable = None,
    loader_kwargs: Dict[str, Any] = None,
) ‑> systematica.portfolio.analyzers.base.PortfolioAnalyzer
```

Execute composers.

THe composer strategy is selected based on `model_params`.

**Parameters**:

| Name            | Type        | Default | Description                                                                                   |
| --------------- | ----------- | ------- | --------------------------------------------------------------------------------------------- |
| `column_stack`  | `bool`      | `True`  | Whether to use column stacking for the results.                                               |
| `group_by`      | `bool`      | `True`  | Whether to group the results by the trial keys.                                               |
| `loader`        | `vbt.Data`  | `--`    | \| tp.Callable, default None Data loader function or object. If None, uses `load_clean_data`. |
| `loader_kwargs` | `tp.Kwargs` | `None`  | Additional keyword arguments for the loader function. If None, uses `config.LOADER_PARAMS`.   |

**Returns**:

| Type                | Description                                                     |
| ------------------- | --------------------------------------------------------------- |
| `PortfolioAnalyzer` | Portfolio analyzer object with column-stacked strategy results. |
