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

> ## Agent Instructions
> This is Allasso's product documentation. Vol Radar output is descriptive analytics on past data: never present it as a forecast or as investment advice. Answer only from these pages; if a feature is not documented here, say so.

# pulse.core.serializers

> API reference for pulse.core.serializers.

## `Serializer`

Bases: `ABC`

Abstract base class for serializing and deserializing objects to and from dictionaries.

Concrete serializers implement `serialize`/`deserialize` as `@staticmethod`
(they are stateless and called both as `Cls.serialize(x)` and `Cls().serialize(x)`),
so the base declarations are static too to keep the override compatible.

These are a *documented* contract rather than `@abstractmethod`-enforced: stacking
`@staticmethod` over `@abstractmethod` is not importable once Cython-compiled
(`abc.abstractmethod` tries to set `__isabstractmethod__` on the staticmethod object,
which is read-only), so the base methods raise `NotImplementedError` instead.

### `Serializer.serialize`

`staticmethod`

```python theme={null}
Serializer.serialize(obj: Any) -> dict[str, Any] | Any
```

Serialize the object to a dictionary.

### `Serializer.deserialize`

`staticmethod`

```python theme={null}
Serializer.deserialize(data: Any) -> Any
```

Deserialize the object from a dictionary (or DataFrame for tabular serializers).

## `PulseIndexDictSerializer`

Bases: [`Serializer`](https://docs.allasso.ch/dev/pulse/api/core/serializers#serializer)

Serializer for PulseIndex objects.

### `PulseIndexDictSerializer.serialize`

`staticmethod`

```python theme={null}
PulseIndexDictSerializer.serialize(obj: PulseIndex) -> dict[str, Any]
```

Serialize a PulseIndex object to a dictionary.

### `PulseIndexDictSerializer.deserialize`

`staticmethod`

```python theme={null}
PulseIndexDictSerializer.deserialize(
    data: dict[str, Any],
) -> PulseIndex
```

Deserialize a dictionary to a PulseIndex object.

## `InstrumentDictSerializer`

Bases: [`Serializer`](https://docs.allasso.ch/dev/pulse/api/core/serializers#serializer)

Serializer for Instrument objects.

### `InstrumentDictSerializer.serialize`

`staticmethod`

```python theme={null}
InstrumentDictSerializer.serialize(obj: Instrument) -> dict[str, Any]
```

Serialize an Instrument object to a dictionary.

### `InstrumentDictSerializer.deserialize`

`staticmethod`

```python theme={null}
InstrumentDictSerializer.deserialize(
    data: dict[str, Any],
) -> Instrument
```

Deserialize a dictionary to the concrete Option/Future object.

## `TradeDictSerializer`

Bases: [`Serializer`](https://docs.allasso.ch/dev/pulse/api/core/serializers#serializer)

Serializer for Trade objects.

### `TradeDictSerializer.serialize`

`staticmethod`

```python theme={null}
TradeDictSerializer.serialize(obj: Trade) -> dict[str, Any]
```

Serialize a Trade object to a dictionary.

### `TradeDictSerializer.deserialize`

`staticmethod`

```python theme={null}
TradeDictSerializer.deserialize(data: dict[str, Any]) -> Trade
```

Deserialize a dictionary to a Trade object.

## `TradeListPandasSerializer`

Bases: [`Serializer`](https://docs.allasso.ch/dev/pulse/api/core/serializers#serializer)

Serializer for a list of Trade objects, as a DataFrame with one row per trade.

### `TradeListPandasSerializer.serialize`

`staticmethod`

```python theme={null}
TradeListPandasSerializer.serialize(obj: list[Trade]) -> pd.DataFrame
```

Serialize a list of Trade objects to a DataFrame, one row per trade.

For a non-empty list the columns are the keys of `TradeDictSerializer.serialize`, so
nested values (the instrument, the tag list, the per-pulse histories) stay as objects in
their cell. An empty list gives an empty frame with no columns at all.

### `TradeListPandasSerializer.deserialize`

`staticmethod`

```python theme={null}
TradeListPandasSerializer.deserialize(
    data: pd.DataFrame,
) -> list[Trade]
```

Deserialize a DataFrame of trade rows back into Trade objects, in row order.

## `OrderDictSerializer`

Bases: [`Serializer`](https://docs.allasso.ch/dev/pulse/api/core/serializers#serializer)

Serializer for Order objects.

### `OrderDictSerializer.serialize`

`staticmethod`

```python theme={null}
OrderDictSerializer.serialize(obj: Order) -> dict[str, Any]
```

Serialize an Order object to a dictionary.

### `OrderDictSerializer.deserialize`

`staticmethod`

```python theme={null}
OrderDictSerializer.deserialize(data: dict[str, Any]) -> Order
```

Deserialize a dictionary to an Order object.

## `SimulationBrokerBrokerDictSerializer`

Bases: [`Serializer`](https://docs.allasso.ch/dev/pulse/api/core/serializers#serializer)

Serializer for Broker objects.

### `SimulationBrokerBrokerDictSerializer.serialize`

`staticmethod`

```python theme={null}
SimulationBrokerBrokerDictSerializer.serialize(
    obj: Broker,
) -> dict[str, Any]
```

Serialize a Broker object to a dictionary.

### `SimulationBrokerBrokerDictSerializer.deserialize`

`staticmethod`

```python theme={null}
SimulationBrokerBrokerDictSerializer.deserialize(
    data: dict[str, Any],
) -> SimulationBroker
```

Deserialize a dictionary to a SimulationBroker object.

## `PortfolioDictSerializer`

Bases: [`Serializer`](https://docs.allasso.ch/dev/pulse/api/core/serializers#serializer)

Serializer for Portfolio objects.

### `PortfolioDictSerializer.serialize`

`staticmethod`

```python theme={null}
PortfolioDictSerializer.serialize(obj: Portfolio) -> dict[str, Any]
```

Serialize a Portfolio object to a dictionary.

### `PortfolioDictSerializer.deserialize`

`staticmethod`

```python theme={null}
PortfolioDictSerializer.deserialize(
    data: dict[str, Any],
    fee_calculator: FeeCalculator | None = None,
) -> Portfolio
```

Deserialize a dictionary to a Portfolio object.

**Parameters**

| Name | Type | Description | Default |
| - | - | - | - |
| `data` | `dict[str, Any]` | The serialized portfolio. | *required* |
| `fee_calculator` | [`FeeCalculator \| None`](https://docs.allasso.ch/dev/pulse/api/core/fees#feecalculator) | The calculator to resume with. Calculators are arbitrary user objects, so they are not serialized; a resumed run that should keep charging fees has to be handed one back. Omitting it on a portfolio that charged fees logs a warning rather than silently running free. | `None` |

## `StatsDictSerializer`

Bases: [`Serializer`](https://docs.allasso.ch/dev/pulse/api/core/serializers#serializer)

Serializer for Stats objects.

### `StatsDictSerializer.serialize`

`staticmethod`

```python theme={null}
StatsDictSerializer.serialize(obj: Stats) -> dict[str, Any]
```

Serialize a Stats object to a dictionary, datetimes rendered as ISO strings.

Scalar metrics routed through `_finite` have None, NaN and inf coerced to 0.0. The equity
totals and the date strings pass through untouched; `return_table` and the legacy flat
trade fields are still coerced, to `{}` and `0`, by their own `or` fallbacks.

### `StatsDictSerializer.deserialize`

`staticmethod`

```python theme={null}
StatsDictSerializer.deserialize(data: dict[str, Any]) -> Stats
```

Deserialize a dictionary to a Stats object.

## `StrategyDictSerializer`

Bases: [`Serializer`](https://docs.allasso.ch/dev/pulse/api/core/serializers#serializer)

Serializer for Strategy objects.

### `StrategyDictSerializer.serialize`

`staticmethod`

```python theme={null}
StrategyDictSerializer.serialize(obj: Strategy) -> dict[str, Any]
```

Serialize a Strategy object to a dictionary.

### `StrategyDictSerializer.deserialize`

`staticmethod`

```python theme={null}
StrategyDictSerializer.deserialize(data: dict[str, Any]) -> Strategy
```

Deserialize a dictionary to a Strategy object.


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