Skip to content

Composite positions

Multi-leg positions: pairs, baskets, option structures.

Start with the topic guide for worked examples. Signatures below show the available arguments.

basket(symbols: List[str], weights: List[float], *, group_id: Optional[str] = None) -> _CompositeHandle

Supply a nonempty symbol list and an equally sized list of signed per-unit quantity multipliers. Buying Q composite units requests Q times each multiplier; these are not money weights. Optional group_id identifies the group. See composites.

calendar_spread(chain, **kw)

Requires an option chain containing distinct expiries. The built-in selector describes a short front-expiry call and long back-expiry call near spot. Requested DTE chooses the nearest available expiry rather than guaranteeing that date; selecting the same expiry for both raises ValueError.

Built-in selector arguments: calendar_spread(chain, *, dte_front=30, dte_back=60, today=None). today is an optional Python date; otherwise the current bar date is used when available.

iron_condor(chain, **kw)

Requires an option chain. The built-in selector combines short call/put delta-selected legs with long wings selected near a fixed strike distance. wing_width is in strike-price units. Available contracts can differ from the requested spacing.

Built-in selector arguments: iron_condor(chain, *, short_delta=0.16, wing_width=5.0, dte=45, today=None). today is an optional Python date; otherwise the current bar date is used when available.

pair(a: str, b: str, *, ratio: float = 1.0, group_id: Optional[str] = None) -> _CompositeHandle

Build a grouped two-leg quantity relationship: buying one unit is long one a and short ratio units of b; selling reverses it. Default ratio is 1. group_id distinguishes the group; the default is deterministic. Actions need supported grouped execution. See composites.

straddle(chain, **kw)

Requires an option chain. The built-in selector uses the expiry nearest the requested days-to-expiry and call/put strikes nearest spot. Its descriptor's default legs are short call and short put; handle direction controls the resulting trade. Check the provider and grouped-execution contract before using it.

Built-in selector arguments: straddle(chain, *, dte=45, today=None). today is an optional Python date; otherwise the current bar date is used when available.

strangle(chain, **kw)

Requires an option chain and uses the expiry nearest the requested days-to-expiry. The built-in selector chooses call/put contracts by their requested deltas, with short call/put descriptor legs. Delta numbers are selection inputs, not allocation fractions.

Built-in selector arguments: strangle(chain, *, call_delta=0.16, put_delta=-0.16, dte=45, today=None). today is an optional Python date; otherwise the current bar date is used when available.