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

# Package dataclasses

The dataclasses package provides the `@dataclass` decorator for declaring simple data record classes.

> [!NOTE]
>
> See description in the [official Python docs](https://docs.python.org/3.10/library/dataclasses.html).

> [!NOTE]
>
> See also: [`@dataclass()`](https://takeprofit.com/docs/indie/Library-reference/package-dataclasses#decor_dataclass)

***

## Decorators

### `@dataclass()`

*decorator*

**1. Overloads**

@dataclass

() -> None

Decorates a class, turning it into a simple data record. A positional `__init__` constructor is generated automatically from the class-level field annotations, so the fields are passed as constructor arguments in declaration order. Supported field types are the same as for a regular field of a user-defined class: `int`, `float`, `bool`, `str`, `Optional[T]`, `list[T]` and user-defined class types.

```py Example theme={null}
@dataclass
class MyData:
    signal: float
    confidence: int

@indicator('Dataclass example')
def Main(self):
    data = MyData(self.close[0], 1)
    return data.signal
```

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.