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 for that expiry as of the timestamp.
Every strike resolver has the same
resolve(...) signature:
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.
Resolve the expiry firstA strike resolver needs an
expiration_date to know which smile to search, so resolve the expiry
before the strike. The premade structures do this in order for you.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
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.
min_dte filters, then nth countsmin_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
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”.
How the two fit together
Resolving a leg is always expiry then strike: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 wrap exactly this pattern so you skip the
per-leg plumbing.
Related: DataFeed and market data · Structures ·
Architecture and the pulse loop
