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

# Returns

> systematica.preprocessing.returns

## `get_returns`

```python theme={null}
get_returns(
    close: pandas.core.series.Series,
) ‑> pandas.core.series.Series
```

Compute log returns from a pandas Series of closing prices.

Log returns are calculated as the difference of the natural logarithm
of consecutive prices.

**Parameters**:

| Name    | Type        | Default | Description                                        |
| ------- | ----------- | ------- | -------------------------------------------------- |
| `close` | `pd.Series` | `--`    | A pandas Series representing asset closing prices. |

**Returns**:

| Type        | Description              |
| ----------- | ------------------------ |
| `pd.Series` | A Series of log returns. |

## `get_returns_nb`

```python theme={null}
get_returns_nb(
    close: numpy.ndarray,
) ‑> numpy.ndarray
```

Compute log returns using a Numba-compiled function.

This function calculates log returns by taking the difference
of the natural logarithm of consecutive prices.

**Parameters**:

| Name    | Type         | Default | Description                                      |
| ------- | ------------ | ------- | ------------------------------------------------ |
| `close` | `tp.Array2d` | `--`    | A NumPy array representing asset closing prices. |

**Returns**:

| Type         | Description                   |
| ------------ | ----------------------------- |
| `tp.Array2d` | A NumPy array of log returns. |

## `get_cumulative_returns`

```python theme={null}
get_cumulative_returns(
    close: numpy.ndarray,
) ‑> numpy.ndarray
```

Compute cumulative log returns from a pandas Series of closing prices.

Cumulative returns are obtained by computing the cumulative sum
of log returns.

**Parameters**:

| Name    | Type        | Default | Description                                        |
| ------- | ----------- | ------- | -------------------------------------------------- |
| `close` | `pd.Series` | `--`    | A pandas Series representing asset closing prices. |

**Returns**:

| Type        | Description                         |
| ----------- | ----------------------------------- |
| `pd.Series` | A Series of cumulative log returns. |

## `get_cumulative_returns_nb`

```python theme={null}
get_cumulative_returns_nb(
    close: numpy.ndarray,
) ‑> numpy.ndarray
```

Compute cumulative log returns using a Numba-compiled function.

This function calculates cumulative returns by computing the
cumulative sum of log returns.

**Parameters**:

| Name    | Type         | Default | Description                                          |
| ------- | ------------ | ------- | ---------------------------------------------------- |
| `close` | `tp.Array2d` | `--`    | A 2-D NumPy array representing asset closing prices. |

**Returns**:

| Type         | Description                              |
| ------------ | ---------------------------------------- |
| `tp.Array2d` | A NumPy array of cumulative log returns. |
