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

> API reference for pulse.core.broker.

## `Broker`

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

Bases: `ABC`

Broker class that serves as a base for different broker implementations.
Brokers are responsible for managing orders and executing them into trades.
Pulse method should return the trades that were executed during the pulse.

### `Broker.open_orders`

`property`

```python theme={null}
Broker.open_orders: list[Order]
```

Returns the list of open orders.

### `Broker.orders`

`property`

```python theme={null}
Broker.orders: list[Order]
```

Returns the list of all orders.

### `Broker.pulse`

`abstractmethod`

```python theme={null}
Broker.pulse(pulse_index: PulseIndex) -> list[Trade] | None
```

Pulsing the broker will fill all open orders and return the trades.

### `Broker.create_order`

`abstractmethod`

```python theme={null}
Broker.create_order(
    pulse_index: PulseIndex,
    instrument: Instrument,
    quantity: float,
    tags: list[str] | None = None,
    fill_price: float | None = None,
    is_lots: bool = False,
    source_id: str | None = None,
) -> None
```

Create a market order.

The order is queued and filled when the broker is next pulsed. With the default
`SimulationBroker` that happens during the broker step of the same pulse, at that
pulse's market data (no execution delay and no slippage).

**Parameters**

| Name | Type | Description | Default |
| - | - | - | - |
| `pulse_index` | [`PulseIndex`](https://docs.allasso.ch/dev/pulse/api/core/time#pulseindex) | The pulse index for the order. In strategy use `self.pulse_index` to get the current pulse index. | *required* |
| `instrument` | `Instrument` | The instrument to trade. | *required* |
| `quantity` | `float` | The quantity of the instrument to trade. | *required* |
| `source_id` | `str \| None` | Optional originating strategy / sleeve id, carried onto the resulting trade for per-sleeve provenance. `None` by default. | `None` |

## `SimulationBroker`

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

Bases: [`Broker`](https://docs.allasso.ch/dev/pulse/api/core/broker#broker)

Backtest broker that fills every open order in full on the pulse it is stepped on.

Orders are filled at that pulse's market data, so there is no execution delay, no partial fill
and no slippage: a trade's `open_datetime` is the pulse its order was placed on. Only market
orders exist; pass `fill_price` to `create_order` to model a haircut.

### `SimulationBroker.create_order`

```python theme={null}
SimulationBroker.create_order(
    pulse_index: PulseIndex,
    instrument: Instrument,
    quantity: float,
    tags: list[str] | None = None,
    fill_price: float | None = None,
    is_lots: bool = False,
    source_id: str | None = None,
) -> None
```

Queue a market order, filled in full the next time the broker is pulsed.

**Parameters**

| Name | Type | Description | Default |
| - | - | - | - |
| `pulse_index` | [`PulseIndex`](https://docs.allasso.ch/dev/pulse/api/core/time#pulseindex) | The pulse index for the order; its `last_pulse` becomes the order's open datetime. In a strategy use `self.pulse_index`. | *required* |
| `instrument` | `Instrument` | The instrument to trade. | *required* |
| `quantity` | `float` | Signed quantity: positive buys, negative sells. | *required* |
| `tags` | `list[str] \| None` | Tags to carry onto the resulting trade. Copied, not aliased. | `None` |
| `fill_price` | `float \| None` | Price to open the trade at instead of the pulse's settlement price, to model a haircut. `None` (the default) opens it at the settlement price. | `None` |
| `is_lots` | `bool` | Treat `quantity` as lots rather than as raw units. | `False` |
| `source_id` | `str \| None` | Optional originating strategy / sleeve id, carried onto the resulting trade for per-sleeve provenance. `None` by default. | `None` |

**Raises**

| Type | Description |
| - | - |
| `ValueError` | If `quantity` is zero. |

### `SimulationBroker.pulse`

```python theme={null}
SimulationBroker.pulse(pulse_index: PulseIndex) -> list[Trade] | None
```

Pulsing the broker will fill all open orders and return the trades.


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