qis.InstrumentLeg

class qis.InstrumentLeg(instrument_type, underlying_id, quantity, multiplier=1.0, strike=None)[source]

Bases: object

A signed primitive valued in its underlying’s quote currency.

Variables:
  • instrument_type (qis.portfolio.stress.instruments.InstrumentType) – Primitive enum.

  • underlying_id (str) – Actual quote ID in the portfolio registry.

  • quantity (float) – Signed number of units; negative means short.

  • multiplier (float) – Positive contract multiplier.

  • strike (float | None) – Nonnegative option strike; absent for funded assets and futures.

Parameters:
__init__(instrument_type, underlying_id, quantity, multiplier=1.0, strike=None)
Parameters:
Return type:

None

Methods

__init__(instrument_type, underlying_id, ...)

get_payoff(quotes, spot0)

Evaluate signed model value locally, before currency conversion.

get_quote_delta(spot0, kink_policy)

Return current local derivative with respect to the actual quote.

Attributes

instrument_type: InstrumentType
underlying_id: str
quantity: float
multiplier: float = 1.0
strike: float | None = None
get_payoff(quotes, spot0)[source]

Evaluate signed model value locally, before currency conversion.

Parameters:
  • quotes (Series) – Scenario quotes indexed by scenario ID.

  • spot0 (float) – Baseline quote, used as the futures reference level.

Returns:

Local-currency model values with the supplied index.

Return type:

Series

get_quote_delta(spot0, kink_policy)[source]

Return current local derivative with respect to the actual quote.

For an option the call slope is one above the strike and zero below; the put slope is the call slope minus one. kink_policy sets the call slope only when spot0 == strike exactly, with no tolerance.

Parameters:
  • spot0 (float) – Quote at which the derivative is taken: the baseline quote for current risk, or a scenario quote for scenario-local bands.

  • kink_policy (KinkPolicy) – Common one-sided derivative policy for this holding.

Returns:

Signed units including multiplier and intrinsic exercise state.

Return type:

float