> ## 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.

# Twin Spread

> systematica.api.signal_models.twin_spread

## `TwinSpread`

```python theme={null}
TwinSpread()
```

Generate trading signals based on twin spread strategy.

This class implements a twin spread-based signal generation where long and
short positions are determined based on the relationship between two
indicators.

As opposed to `Spread`, both exit condition should be met. For example,
both assets should cross their respective threshold at the same time.

Method generated by attrs for class TwinSpread.

### Ancestors

* `systematica.signals.base.BaseSignal`
* `abc.ABC`

### Static methods

#### `run`

```python theme={null}
run(
    model_output: numpy.ndarray,
    long_entries: float,
    long_exits: float,
    short_entries: float,
    short_exits: float,
    clean: bool = True,
) ‑> systematica.signals.base.Signals
```

Run the twin spread signal generation.

**Parameters**:

| Name            | Type       | Default | Description                                    |
| --------------- | ---------- | ------- | ---------------------------------------------- |
| `model_output`  | `tp.Array` | `--`    | The model output containing the spread values. |
| `long_entries`  | `float`    | `--`    | The threshold for long entry signals.          |
| `long_exits`    | `float`    | `--`    | The threshold for long exit signals.           |
| `short_entries` | `float`    | `--`    | The threshold for short entry signals.         |
| `short_exits`   | `float`    | `--`    | The threshold for short exit signals.          |
| `clean`         | `bool`     | `to`    | `True` Clean signals. Defaults to `True`.      |

**Returns**:

| Type      | Description                                                      |
| --------- | ---------------------------------------------------------------- |
| `Signals` | The generated trading signals based on the twin spread strategy. |
