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

# Structures

> Recipes for building common option structures inside a Strategy. Each recipe shows the two ways pulse lets you resolve the legs:

Recipes for building common option structures inside a `Strategy`. Each recipe shows the **two ways**
pulse lets you resolve the legs:

> [tab] Manual
>
> Resolve each leg yourself from the `DataFeed` and the resolvers - an expiry via
> `resolver.expiry.relative` and a strike via `resolver.strike.delta` - then build the `Option`
> and place the order. Most explicit; you see every strike.
>
> ```python theme={null}
> expiry = self.resolver.expiry.relative(
>     underlying_id=self.underlying_id[0], as_of_time=self.last_pulse,
>     period_type=PeriodType.MONTH, instrument_type=PUT,
>     nth=1, period_id=PeriodID.ALL, min_dte=30,
> )[0]
> put_strike = self.resolver.strike.delta.resolve(
>     underlying_id=self.underlying_id[0], as_of_time=self.last_pulse,
>     expiration_date=expiry, instrument_type=PUT, strike_value=0.20,
> )
> leg = Option(self.underlying_id[0], PUT, put_strike, expiry)
> self.broker.create_order(self.pulse_index, leg, -size, is_lots=True)
> ```

> [tab] Helper
>
> Use a \[`structures`]\[pulse.structures] resolver. One call returns a named tuple of ready-to-trade
> `Option` legs, so you skip the per-leg expiry/strike plumbing.
>
> ```python theme={null}
> from pulse import structures
>
> legs = structures.strangle_by_delta(
>     self.resolver, self.underlying_id[0], self.last_pulse,
>     call_delta=0.20, put_delta=0.20, min_dte=30,
> )
> self.broker.create_order(self.pulse_index, legs.put,  -size, is_lots=True)
> self.broker.create_order(self.pulse_index, legs.call, -size, is_lots=True)
> ```

Both paths resolve to the **same strikes** - the helper is just a thin wrapper over the resolvers.
Reach for the helper when a structure exists; drop to manual when you need a leg the helpers don't
cover or want full control.

> [!NOTE]
>
> **Shared conventions in these recipes**
>
> * `self.underlying_id` is a **list** - recipes use `self.underlying_id[0]`.
> * Strikes are picked by **delta** (e.g. `0.20` ≈ 20-delta); expiries are the `nth` monthly with at
>   least `min_dte` days left. See [Resolvers](https://docs.allasso.ch/dev/pulse/concepts/resolvers.md) for the full grammar.
> * Orders are sized to whole **contracts** (`is_lots=True`) and fill on the **next pulse**.
> * `+quantity` buys, `-quantity` sells.

The recipes on the family pages show just the **leg resolution + orders** (the part that differs per
structure). They assume the imports and helpers below.

> [accordion] Full runnable scaffold (the boilerplate every recipe shares)
>
> ```python theme={null}
> from pulse import (
>     InstrumentType, Option, PeriodID, PeriodType, Strategy, run_sequentially, structures,
> )
>
> CALL, PUT = InstrumentType.CALL, InstrumentType.PUT
>
>
> class MyStructure(Strategy):
>     def __init__(self, underlying_id, min_dte=30, equity_percentage=0.2):
>         super().__init__(name="My structure", underlying_id=underlying_id)
>         self._min_dte = min_dte
>         self._equity_percentage = equity_percentage
>
>     def on_update(self) -> None:
>         if self.has_open_trades:        # one structure at a time
>             return
>         u = self.underlying_id[0]
>
>         # --- leg resolution + orders go here (see each recipe) ---
>
>     def _size(self, leg: Option) -> int:
>         """Whole contracts for a fixed % of equity."""
>         price = self.datafeed.instrument.last(leg, self.last_pulse).underlying_price
>         lot = self.datafeed.reference.contract_size(
>             underlying_id=self.underlying_id[0], instrument_type=leg.instrument_type
>         )
>         return round(self.current_equity * self._equity_percentage / price / lot)
>
>
> if __name__ == "__main__":
>     strat = MyStructure("COM.BRN", min_dte=7)
>     print(run_sequentially([strat], initial_equity=1_000_000)[0].strategy.stats)
> ```
>
> In the snippets below, `u = self.underlying_id[0]` and `size = self._size(<a leg>)`.

## Catalogue

| Family | Structures |
| - | - |
| [Single-leg](https://docs.allasso.ch/dev/pulse/structures/single-leg.md) | long/short call, long/short put |
| [Verticals](https://docs.allasso.ch/dev/pulse/structures/verticals.md) | bull/bear call spread, bull/bear put spread |
| [Volatility](https://docs.allasso.ch/dev/pulse/structures/volatility.md) | long/short straddle, long/short strangle |
| [Skew, term & ratio](https://docs.allasso.ch/dev/pulse/structures/skew-term-ratio.md) | risk reversal, calendar & diagonal call spread, ratio & zero-cost call spread |
| [Butterflies](https://docs.allasso.ch/dev/pulse/structures/butterflies.md) | long/short call & put butterfly, (short) broken-wing |
| [Ladders](https://docs.allasso.ch/dev/pulse/structures/ladders.md) | call/put ladder, short call/put ladder |
| [Three-leg skew](https://docs.allasso.ch/dev/pulse/structures/three-leg-skew.md) | jade lizard / short jade lizard, seagull / short seagull |

The helper resolvers (and exotic variants - condors, iron condors/butterflies, albatross, pterodactyl)
are listed in the \[`structures` API reference]\[pulse.structures].


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