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

> API reference for pulse.core.fees.

## `FeeEventType`

Bases: `str`, `Enum`

The lifecycle stage at which a fee-bearing transaction event occurred.

## `FeeEvent`

`dataclass`

```python theme={null}
FeeEvent(
    trade: Trade,
    quantity_units: float,
    price: float,
    event_type: FeeEventType,
)
```

A single fee-bearing transaction event collected during a pulse.

**Attributes**

| Name | Type | Description |
| - | - | - |
| `trade` | [`Trade`](https://docs.allasso.ch/dev/pulse/api/core/trade#trade) | The trade being transacted. |
| `quantity_units` | `float` | Signed quantity in units (lots already expanded via the `Trade.units` property). Positive for buys, negative for sells. |
| `price` | `float` | The fill price of the transaction. |
| `event_type` | [`FeeEventType`](https://docs.allasso.ch/dev/pulse/api/core/fees#feeeventtype) | The lifecycle stage of the event (`ENTRY`, `REBALANCE` or `EXIT`). |

## `FeeCalculator`

Bases: `ABC`

Computes fees for the batch of transaction events collected on a single pulse.

Subclasses receive every entry/rebalance/exit event that occurred during the
pulse and return one non-negative fee per event (same order, same length).
Receiving the full batch lets implementations apply schemes that depend on
inter-event relationships, for example block-trade pricing where the side with the
larger notional is charged and the other side is rebated to zero.

### `FeeCalculator.calculate`

`abstractmethod`

```python theme={null}
FeeCalculator.calculate(
    events: list[FeeEvent],
    datafeed: DataFeed,
) -> list[float]
```

Compute the per-event fees for the events collected this pulse.

**Parameters**

| Name | Type | Description | Default |
| - | - | - | - |
| `events` | [`list[FeeEvent]`](https://docs.allasso.ch/dev/pulse/api/core/fees#feeevent) | The transaction events in collection order. May be empty. | *required* |
| `datafeed` | `DataFeed` | The datafeed for the current pulse (e.g. for contract metadata or market data lookups). | *required* |

**Returns**

| Type | Description |
| - | - |
| `list[float]` | list\[float]: One non-negative fee per event, in the same order as |
| `list[float]` | `events`. |

## `NoFeeCalculator`

Bases: [`FeeCalculator`](https://docs.allasso.ch/dev/pulse/api/core/fees#feecalculator)

Default zero-fee calculator. Preserves existing portfolio behavior.

### `NoFeeCalculator.calculate`

```python theme={null}
NoFeeCalculator.calculate(
    events: list[FeeEvent],
    datafeed: DataFeed,
) -> list[float]
```

Return a zero fee for each event.

**Parameters**

| Name | Type | Description | Default |
| - | - | - | - |
| `events` | [`list[FeeEvent]`](https://docs.allasso.ch/dev/pulse/api/core/fees#feeevent) | The transaction events in collection order. | *required* |
| `datafeed` | `DataFeed` | The datafeed for the current pulse (unused). | *required* |

**Returns**

| Type | Description |
| - | - |
| `list[float]` | list\[float]: `0.0` for every event. |

## `FixedFeeCalculator`

```python theme={null}
FixedFeeCalculator(per_unit: float)
```

Bases: [`FeeCalculator`](https://docs.allasso.ch/dev/pulse/api/core/fees#feecalculator)

Flat fee per unit traded (e.g. per contract).

Initialize a FixedFeeCalculator.

**Parameters**

| Name | Type | Description | Default |
| - | - | - | - |
| `per_unit` | `float` | Non-negative fee charged per unit traded. | *required* |

**Raises**

| Type | Description |
| - | - |
| `ValueError` | If `per_unit` is negative. |

### `FixedFeeCalculator.calculate`

```python theme={null}
FixedFeeCalculator.calculate(
    events: list[FeeEvent],
    datafeed: DataFeed,
) -> list[float]
```

Charge `per_unit * |quantity_units|` for each event.

**Parameters**

| Name | Type | Description | Default |
| - | - | - | - |
| `events` | [`list[FeeEvent]`](https://docs.allasso.ch/dev/pulse/api/core/fees#feeevent) | The transaction events in collection order. | *required* |
| `datafeed` | `DataFeed` | The datafeed for the current pulse (unused). | *required* |

**Returns**

| Type | Description |
| - | - |
| `list[float]` | list\[float]: Per-event fees in the same order as `events`. |

## `PercentageFeeCalculator`

```python theme={null}
PercentageFeeCalculator(rate: float)
```

Bases: [`FeeCalculator`](https://docs.allasso.ch/dev/pulse/api/core/fees#feecalculator)

Percentage-of-notional fee (`rate * |quantity_units| * |price|`).

Initialize a PercentageFeeCalculator.

**Parameters**

| Name | Type | Description | Default |
| - | - | - | - |
| `rate` | `float` | Non-negative fee rate applied to traded notional. | *required* |

**Raises**

| Type | Description |
| - | - |
| `ValueError` | If `rate` is negative. |

### `PercentageFeeCalculator.calculate`

```python theme={null}
PercentageFeeCalculator.calculate(
    events: list[FeeEvent],
    datafeed: DataFeed,
) -> list[float]
```

Charge `rate * |quantity_units| * |price|` for each event.

**Parameters**

| Name | Type | Description | Default |
| - | - | - | - |
| `events` | [`list[FeeEvent]`](https://docs.allasso.ch/dev/pulse/api/core/fees#feeevent) | The transaction events in collection order. | *required* |
| `datafeed` | `DataFeed` | The datafeed for the current pulse (unused). | *required* |

**Returns**

| Type | Description |
| - | - |
| `list[float]` | list\[float]: Per-event fees in the same order as `events`. |


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