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

# Resolvers

> Strategies think in relative terms - "the 25-delta put on the front-month expiry" - but an order needs a concrete strike and a concrete expiry date. Resolvers do that translation.

You reach them through `self.resolver`, which holds a `strike` registry and an `expiry` registry.

## Strike resolvers

`self.resolver.strike` exposes one resolver per axis. Each turns a target value on its axis into the
closest available strike, by searching the [smile](https://docs.allasso.ch/dev/pulse/concepts/datafeed.md) for that expiry as of the timestamp.

| Resolver | `strike_value` means | Reach for it when |
| - | - | - |
| `delta` | option delta (e.g. `0.25` ≈ 25-delta) | you size legs by risk; the most common choice. |
| `quick_delta` | a fast delta proxy | you want a delta-like axis cheaper to compute than full `delta`. |
| `moneyness` | strike relative to spot | you anchor to how far in/out of the money a strike is. |
| `value` | option premium | you target a price point (e.g. "the leg near 5.00"). |
| `absolute_strike` | the literal strike price | you already know the exact strike (or want a leg equidistant from another). |

Every strike resolver has the same `resolve(...)` signature:

```python theme={null}
strike = self.resolver.strike.delta.resolve(
    underlying_id="COM.BRN",
    as_of_time=self.last_pulse,
    expiration_date=expiry,
    instrument_type=PUT,
    strike_value=0.25,
)
```

It returns a single `float` strike: the available strike whose value on that axis is closest to
`strike_value`. The comparison is on absolute values, so a put is targeted with a positive delta
(`strike_value=0.25` picks the 25-delta put) exactly like a call.

> [!NOTE]
>
> **Resolve the expiry first**
>
> A strike resolver needs an `expiration_date` to know which smile to search, so resolve the expiry
> before the strike. The premade [structures](https://docs.allasso.ch/dev/pulse/concepts/structures.md) do this in order for you.

> [!WARNING]
>
> **Strike resolvers are options-only**
>
> `delta`, `moneyness`, `value` and the rest only make sense for options and raise on a future. A
> future has no strike to resolve - reference it directly by its expiry.

## Expiry resolver

`self.resolver.expiry` has two methods, both returning a `list[datetime]`; take `[0]` for the single
matching expiry.

### `relative(...)` - the nth expiry past a floor

```python theme={null}
expiry = self.resolver.expiry.relative(
    underlying_id="COM.BRN",
    as_of_time=self.last_pulse,
    instrument_type=PUT,
    nth=1,
    min_dte=30,
    period_type=PeriodType.MONTH,   # default
    period_id=PeriodID.ALL,         # default
)[0]
```

The arguments compose to pin down one expiry:

| Argument | Role |
| - | - |
| `nth` | Pick the 1st, 2nd, ... matching expiry. `nth=1` is the front one. Must be >= 1. |
| `min_dte` | Drop expiries with fewer days to expiry than this before counting `nth`. **Required.** |
| `period_type` | The expiry cadence: `PeriodType.MONTH` (default), `QUARTER`, `HALF_YEAR`, `YEAR`, `SEASON`. |
| `period_id` | Which periods count: `PeriodID.ALL` (default), a month (`JANUARY` ...), a quarter (`QUARTER1` ...), a season (`SUMMER`, `WINTER`), or a list of them. Filters the candidate expiries. |

So `nth=1, min_dte=30` on the default monthly cadence reads as "the first monthly expiry with at least
30 days left". Bumping `nth` to `2` walks out to the next one; setting `period_id=PeriodID.QUARTER1`
restricts the candidates to first-quarter expiries.

> [!NOTE]
>
> **`min_dte` filters, then `nth` counts**
>
> `min_dte` is applied first, so `nth` counts only among expiries that already clear the day floor.
> `nth=1, min_dte=30` is not "the front month if it has 30 days" - it is "the first expiry that has
> 30 days", which may be a later month when the front one is close to expiring.

### `closest_to_dte(...)` - the nearest expiry to a target

```python theme={null}
expiry = self.resolver.expiry.closest_to_dte(
    underlying_id="COM.BRN",
    as_of_time=self.last_pulse,
    instrument_type=PUT,
    dte=45,
)[0]
```

Same `period_type` / `period_id` filters, but instead of a floor plus a count it takes a single `dte`
target and returns the expiry nearest to it, above or below. Reach for it when you want "roughly 45
days out" rather than "at least 30 days out".

> [!WARNING]
>
> **Both raise when nothing matches**
>
> A `min_dte` no expiry clears, or a `period_id` with no expiries in the snapshot, raises
> `LookupError` naming the underlying and the timestamp. Near the end of a dataset the front months
> run out first, so a long `min_dte` on a run that reaches the last snapshots is the usual cause.

## How the two fit together

Resolving a leg is always expiry then strike:

```python theme={null}
expiry = self.resolver.expiry.relative(..., instrument_type=PUT, nth=1, min_dte=30)[0]
strike = self.resolver.strike.delta.resolve(..., expiration_date=expiry, strike_value=0.25)
leg = Option(underlying_id, PUT, strike, expiry)
```

`Option` needs both, and `Future` needs an expiry too - neither has a "front contract" default, so a
leg is always resolved before it is built.

For multi-leg trades, the premade [structures](https://docs.allasso.ch/dev/pulse/concepts/structures.md) wrap exactly this pattern so you skip the
per-leg plumbing.

**Related:** [DataFeed and market data](https://docs.allasso.ch/dev/pulse/concepts/datafeed.md) · [Structures](https://docs.allasso.ch/dev/pulse/concepts/structures.md) ·
[Architecture and the pulse loop](https://docs.allasso.ch/dev/pulse/concepts/architecture.md)


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