kiyosi.instruments
Validated derivative contracts and autocallable presets.
Notes
Constructors validate terms and contractual calendars. Pricing checks valuation and prior history. Contract boundaries are inclusive. European vanilla and digital options permit pre-effective valuation with model coverage through expiry; other contracts require valuation within their life.
Barrier and touch contracts, range accruals, accumulators, and autocallables own their calendars. Constructors inherit an ObservationSchedule calendar; explicit calendars override it, and plain timestamp iterables default to weekdays. Raw autocallable note constructors require an explicit calendar because observation records carry no calendar. Pass calendar=schedule.calendar when building records from a schedule; presets inherit the schedule's calendar. Replacement inherits a supplied schedule's calendar, otherwise retaining the contract's calendar.
Explicit observations use exact timestamps; automatic observations require observation_clock_time. Autocallable daily knock-in owns its clock in KnockInObservation.every_trading_day; daily presets accept knock_in_observation_clock_time. Daily knock-in and accumulation include the effective instant; range accrual observations exclude it. Settlement adds no observation. Barrier and touch contracts use observation_schedule=None for continuous monitoring and a schedule or nonempty iterable for scheduled monitoring. Read observation_schedule to get the contractual times and calendar together, or None for continuous monitoring. Pass the same value as observation_schedule when constructing or replacing another contract. For direct reads, observation_mode reports the mode and observation_times returns a timestamp tuple or None. Forward the contract's calendar explicitly when passing a timestamp tuple.
Accumulators use knock_out_observation_schedule to read and replace the explicit knock-out schedule. An empty schedule disables early knock-out. None follows the daily rule, whose dates are available from accumulation_schedule.
Supplied history describes events strictly before the requested valuation. Observations exactly at valuation use current spot once. Bookkeeping owns event records, lifecycle and settlement progression, and consistency with valuation time and contract terms, including preventing stale-state or future-state misuse. Kiyosi neither checks state age nor reconstructs history. Missing history is unknown; explicit zero, false, untouched, and no-event states are known history. Range accruals accept prior hit counts; accumulators accept prior quantity and knock-out settlement state. Asian options accept the realized average for the elapsed averaging interval. Numerical time sensitivities hold supplied history fixed.
replace returns a validated copy. Omission or Ellipsis retains a field; None clears nullable fields to unknown. Terms and history are validated together, and each omitted history field retains its value independently.
Read and replace snowball knock-out terms through autocall_observations , whose records keep each observation time, knock-out level and coupon together. Phoenix uses separate KnockOutObservation and CouponObservation records, passed through knock_out_observations and coupon_observations. Each list is nonempty and strictly ordered; their times and thresholds are independent. knock_out_times and coupon_times provide direct timestamp queries. Knock-in monitoring is defined independently by knock_in_observation and knock_in_observation_schedule.
PhoenixOption accepts a finite signed coupon_per_period rate applied at each qualifying coupon observation without time accrual. A knock-out-only observation adds no coupon. Coincident knock-out and coupon barriers are assessed independently, and expiry adds no implicit observation. Principal redemption is per unit of original notional; scale the complete price and Greeks for position size.
The four Phoenix preset factories accept one autocall_times sequence and a lockout_periods count, defaulting to zero. They expand the entire sequence into coupon observations and omit the initial count from knock-out observations. The knock-out list must contain at least one observation. The contract owns both lists, and replacements edit either list directly. PhoenixOption.standard uses a constant knock-out barrier; PhoenixOption.step_down starts its absolute barrier ladder at the first generated knock-out observation. Both use daily knock-in and initial spot as the upper loss strike.
TouchOption pays on a touch with an up_and_in or down_and_in barrier, or when the barrier is never reached with up_and_out or down_and_out. Set payoff_type to cash or asset; cash settlement requires payout.
Examples
Edit a preset's observation and maturity coupons together:
>>> from datetime import datetime, time
>>> note = SnowballOption.standard(
... coupon_rate=0.12, initial_spot=100,
... knock_in_level=80, knock_out_level=110,
... effective_time=datetime(2025, 1, 2),
... expiry_time=datetime(2026, 1, 2),
... autocall_times=[datetime(2026, 1, 2)],
... knock_in_observation_clock_time=time(15),
... )
>>> edited = note.with_coupon(
... first_observation_coupon=0.15,
... quote_convention="shift_maturity_coupon",
... )
>>> first = edited.autocall_observations[0]
>>> round(first.coupon_rate, 6), round(edited.maturity_coupon_rate, 6)
(0.15, 0.15)
>>> note.maturity_coupon_rate
0.12Supply the realized average for an elapsed averaging interval, then price it:
>>> from datetime import datetime
>>> from kiyosi.market import BlackScholesMertonParameters, PricingContext
>>> from kiyosi.pricing import AnalyticGeometricAveragePriceEngine
>>> start = datetime(2025, 1, 1)
>>> average = GeometricAveragePriceOption(
... option_type="call", strike=100, effective_time=start,
... averaging_start_time=start, expiry_time=datetime(2026, 1, 1),
... )
>>> at = datetime(2025, 2, 1)
>>> seasoned = average.replace(realized_average=105)
>>> context = PricingContext(
... model_parameters=BlackScholesMertonParameters(
... risk_free_rate=0, dividend_yield=0, volatility=0),
... spot_price=105, valuation_time=at,
... )
>>> engine = AnalyticGeometricAveragePriceEngine()
>>> round(engine.price(seasoned, context), 6)
5.0Accumulator
Accumulator(*, strike, knock_out_level, daily_quantity, acceleration_factor, effective_time, expiry_time, observation_clock_time, accumulated_quantity=None, option_type='call', knock_out_observation_schedule=None, knock_out_settled=None, calendar=Ellipsis)Daily purchases or sales settled at scheduled knock-out or expiry.
Parameters
strike(float) — Positive finite purchase or sale strike.knock_out_level(float) — Positive inclusive knock-out threshold.daily_quantity(float) — Nonnegative finite quantity bought or sold on each trading timestamp.acceleration_factor(float) — Nonnegative multiplier below strike for calls or above strike for puts.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.observation_clock_time(datetime.time) — Required daily observation time, without timezone information.accumulated_quantity(float or None, optional) — Outstanding quantity strictly before valuation. None means unknown; zero means no units. Explicit history is required after any prior accumulation or knock-out observation. Pricing rejects positive quantity before a strictly prior accumulation unless already settled.option_type({'call', 'put'}, optional) — Call accumulates purchases (the default); put accumulates sales.knock_out_observation_schedule(ObservationSchedule or iterable, optional) — Accepts a schedule or iterable of datetime.datetime values. Strictly increasing, unique times within the inclusive contract life. None follows the daily accumulation schedule. An empty schedule disables early knock-out. Times need not include either contract endpoint.knock_out_settled(bool or None, optional) — Prior knock-out settlement history: None (default) is unknown, False means active, and True means settled. Required after a strictly prior knock-out observation. True requires a strictly prior knock-out; stored quantity is ignored and remaining value is zero.calendar(TradingCalendar, optional) — Explicit override. Omission or Ellipsis inherits a supplied ObservationSchedule calendar. Otherwise, construction defaults to weekdays and replacement defaults to the instance's calendar.
Raises
InvalidInputError— If strike or knock-out level is invalid, quantities are negative or non-finite, expiry precedes effective_time, or explicit times are invalid. Trading-timestamp compatibility is checked against the calendar on construction.
Notes
Daily accumulations occur at observation_clock_time on trading dates. Explicit knock-out observations occur independently at their supplied times. On a knock-out observation timestamp, calls knock out at or above the barrier and puts at or below it. Knock-out precedes accumulation and adds no units. Other trading times accumulate even beyond the barrier. At strike, the base quantity applies. Expiry settles after its event, whether or not it is a knock-out timestamp. Calls pay quantity * (settlement spot - strike); puts pay its negative. Intraday history includes that day's earlier accumulation. Record settled contracts with knock_out_settled=True. Long schedule validations release the GIL and poll Python signals.
acceleration_factor
Return the quantity multiplier below strike for calls or above it for puts.
accumulated_quantity
Return caller-asserted outstanding quantity strictly before valuation.
accumulation_schedule
Return an owned schedule of daily accumulation opportunities.
Includes the effective instant when it matches the contract clock and calendar; expiry adds no observation. Coincident knock-out can prevent accumulation. Long scans release the GIL and poll Python signals.
calendar
Return an owned copy of the contract's observation calendar.
daily_quantity
Return the nonnegative base quantity per trading timestamp.
effective_time
Return inclusive first contract timestamp.
expiry_time
Return inclusive expiry time.
knock_out_level
Return positive inclusive knock-out threshold.
knock_out_observation_schedule
Return the explicit knock-out schedule, or None for the daily rule.
An empty schedule disables early knock-out. Use accumulation_schedule for the dates used by the daily rule.
knock_out_settled
Return prior knock-out settlement history, or None if unknown.
observation_clock_time
Return the explicitly specified daily observation clock time.
option_type
Return call for purchases or put for sales.
replace
replace(self, /, *, option_type=Ellipsis, strike=Ellipsis, knock_out_level=Ellipsis, daily_quantity=Ellipsis, acceleration_factor=Ellipsis, accumulated_quantity=Ellipsis, effective_time=Ellipsis, expiry_time=Ellipsis, observation_clock_time=Ellipsis, knock_out_observation_schedule=Ellipsis, knock_out_settled=Ellipsis, calendar=Ellipsis)Return a validated replacement.
Omitted fields and fields set to Ellipsis default to the instance's values.
Parameters
option_type({'call', 'put'}, optional) — Call or put payoff direction.strike, knock_out_level, daily_quantity(float, optional) — Strike, inclusive knock-out threshold, and daily purchase or sale quantity.acceleration_factor(float, optional) — Nonnegative quantity multiplier below strike for calls or above strike for puts.accumulated_quantity(float or None, optional) — Quantity strictly before valuation; None clears to unknown.effective_time, expiry_time(datetime.datetime, optional) — Inclusive contract start and expiry timestamps.observation_clock_time(datetime.time, optional) — Daily observation clock, without timezone information.knock_out_observation_schedule(ObservationSchedule or iterable, optional) — Accepts a schedule or iterable of datetime.datetime values. Explicit knock-out schedule. None restores the daily rule and an empty schedule disables early knock-out.knock_out_settled(bool or None, optional) — Records a settled knock-out strictly before valuation; None clears to unknown.calendar(TradingCalendar, optional) — Explicit override. Omission or Ellipsis inherits a supplied ObservationSchedule calendar. Otherwise, construction defaults to weekdays and replacement defaults to the instance's calendar.
Returns
Accumulator— Validated copy of the same class.
Raises
KiyosiError— If the resulting contract fails core validation.TypeError— If a representation or field name is invalid.
Notes
Long schedule validations release the GIL and poll Python signals.
strike
Return the purchase or sale strike in underlying price units.
AmericanOption
AmericanOption(*, option_type, strike, effective_time, expiry_time)Vanilla option exercisable throughout its inclusive contract life.
Parameters
option_type({'call', 'put'}) — Call or put payoff direction.strike(float) — Positive finite strike price.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.
Raises
InvalidInputError— If strike is nonpositive or non-finite, or expiry precedes effective_time.
effective_time
Return inclusive first contract timestamp.
expiry_time
Return inclusive expiry time.
option_type
Return call or put payoff direction.
replace
replace(self, /, *, option_type=Ellipsis, strike=Ellipsis, effective_time=Ellipsis, expiry_time=Ellipsis)Return a validated copy with replacement fields.
Omitted fields and fields set to Ellipsis use the instance's values. None clears nullable fields. The class documentation describes the accepted type and meaning of each field.
Parameters
option_type(object, optional) — Replacement field.strike(object, optional) — Replacement field.effective_time(object, optional) — Replacement field.expiry_time(object, optional) — Replacement field.
Returns
object— Validated instance of the same class.
Raises
InvalidInputError— If fields fail constructor validation.TypeError— If a field name or representation is invalid.
strike
Return the strike price in underlying price units.
ArithmeticAveragePriceOption
ArithmeticAveragePriceOption(*, option_type, strike, effective_time, averaging_start_time, expiry_time, realized_average=None)Continuously monitored average-price Asian option.
Parameters
option_type({'call', 'put'}) — Call or put payoff direction.strike(float) — Positive finite strike price.effective_time(datetime.datetime) — Inclusive contract start.averaging_start_time(datetime.datetime) — First averaging timestamp, within the contract life.expiry_time(datetime.datetime) — Inclusive expiry time.realized_average(float or None, optional) — Positive finite prior average; defaults to None (unknown). Must be None at or before averaging starts, and supplied strictly after it; time consistency is checked at pricing. History covers averaging strictly before valuation; callers supply the applicable average.
Raises
InvalidInputError— If strike, realized_average, life times or the averaging window are invalid.
averaging_start_time
Return first averaging timestamp, within the contract life.
effective_time
Return inclusive first contract timestamp.
expiry_time
Return inclusive expiry time.
option_type
Return call or put payoff direction.
realized_average
Return the supplied historical average, or None if unknown.
replace
replace(self, /, *, option_type=Ellipsis, strike=Ellipsis, effective_time=Ellipsis, averaging_start_time=Ellipsis, expiry_time=Ellipsis, realized_average=Ellipsis)Return a validated copy with replacement fields.
Omitted fields and fields set to Ellipsis use the instance's values. None clears nullable fields. The class documentation describes the accepted type and meaning of each field.
Parameters
option_type(object, optional) — Replacement field.strike(object, optional) — Replacement field.effective_time(object, optional) — Replacement field.averaging_start_time(object, optional) — Replacement field.expiry_time(object, optional) — Replacement field.realized_average(object, optional) — Replacement field.
Returns
object— Validated instance of the same class.
Raises
InvalidInputError— If fields fail constructor validation.TypeError— If a field name or representation is invalid.
strike
Return the strike price in underlying price units.
AssetOrNothingOption
AssetOrNothingOption(*, option_type, strike, effective_time, expiry_time)European asset-or-nothing option paying only strictly in the money.
Parameters
option_type({'call', 'put'}) — Call or put payoff direction.strike(float) — Positive finite strike price.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.
Raises
InvalidInputError— If strike is nonpositive or non-finite, or expiry precedes effective_time.
effective_time
Return inclusive first contract timestamp.
expiry_time
Return inclusive expiry time.
option_type
Return call or put payoff direction.
replace
replace(self, /, *, option_type=Ellipsis, strike=Ellipsis, effective_time=Ellipsis, expiry_time=Ellipsis)Return a validated copy with replacement fields.
Omitted fields and fields set to Ellipsis use the instance's values. None clears nullable fields. The class documentation describes the accepted type and meaning of each field.
Parameters
option_type(object, optional) — Replacement field.strike(object, optional) — Replacement field.effective_time(object, optional) — Replacement field.expiry_time(object, optional) — Replacement field.
Returns
object— Validated instance of the same class.
Raises
InvalidInputError— If fields fail constructor validation.TypeError— If a field name or representation is invalid.
strike
Return the strike price in underlying price units.
BarrierOption
BarrierOption(*, option_type, strike, effective_time, expiry_time, barrier_level, barrier_type, rebate=0.0, rebate_timing='at_expiry', observation_schedule=None, touch_state=None, calendar=Ellipsis)Single-barrier vanilla option with inclusive barrier touches.
Parameters
option_type({'call', 'put'}) — Call or put payoff direction.strike(float) — Positive finite strike price.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.barrier_level(float) — Positive finite trigger level; equality counts as a touch.barrier_type({'up_and_in', 'up_and_out', 'down_and_in', 'down_and_out'}) — Trigger direction and knock-in or knock-out behavior.rebate(float, optional) — Nonnegative finite cash rebate; defaults to zero.rebate_timing({'at_hit', 'at_expiry'}, optional) — Payment timing; at-hit rebates are valid only for knock-outs.observation_schedule(ObservationSchedule or iterable, optional) — Accepts a schedule or iterable of datetime.datetime values. Nonempty, strictly increasing times within life; None selects continuous monitoring.touch_state({'untouched', 'touched'} or None, optional) — Strictly prior history. None means unknown; untouched means known no hit.calendar(TradingCalendar, optional) — Explicit override. Omission or Ellipsis inherits a supplied ObservationSchedule calendar. Otherwise, construction defaults to weekdays and replacement defaults to the instance's calendar.
Raises
InvalidInputError— If levels, rebate, life times, monitoring schedule, calendar or rebate timing are invalid. Trading-day compatibility is checked on construction; valuation-history checks occur at pricing.
barrier_level
Return positive finite trigger level; equality counts as a touch.
barrier_type
Return trigger direction and knock-in or knock-out behavior.
calendar
Return an owned copy of the contract's observation calendar.
effective_time
Return the inclusive contract start.
expiry_time
Return the inclusive expiry time.
observation_mode
Return continuous monitoring or observations on the supplied times.
observation_schedule
Return an owned schedule, or None for continuous monitoring.
observation_times
Return a copy of the contractual observation times.
option_type
Return call or put payoff direction.
rebate
Return nonnegative finite cash rebate; defaults to zero.
rebate_timing
Return payment timing; at-hit rebates are valid only for knock-outs.
replace
replace(self, /, *, option_type=Ellipsis, strike=Ellipsis, effective_time=Ellipsis, expiry_time=Ellipsis, barrier_level=Ellipsis, barrier_type=Ellipsis, rebate=Ellipsis, rebate_timing=Ellipsis, observation_schedule=Ellipsis, touch_state=Ellipsis, calendar=Ellipsis)Return a validated replacement.
Omitted fields and fields set to Ellipsis default to the instance's values.
Parameters
option_type({'call', 'put'}, optional) — Call or put payoff direction.strike(float, optional) — Positive finite strike price.effective_time, expiry_time(datetime.datetime, optional) — Inclusive contract start and expiry timestamps.barrier_level(float, optional) — Positive finite trigger level; equality counts as a touch.barrier_type(str, optional) — One of 'up_and_in', 'up_and_out', 'down_and_in', or 'down_and_out'. Barrier direction and knock-in or knock-out behavior.rebate(float, optional) — Nonnegative finite cash rebate.rebate_timing({'at_hit', 'at_expiry'}, optional) — Rebate payment timing; at-hit rebates require knock-out.observation_schedule(ObservationSchedule or iterable, optional) — Accepts a schedule or iterable of datetime.datetime values. The instance's monitoring is the default. None selects continuous monitoring. A nonempty iterable selects scheduled monitoring.touch_state({'untouched', 'touched'} or None, optional) — Strictly prior touch history; None clears it to unknown.calendar(TradingCalendar, optional) — Explicit override. Omission or Ellipsis inherits a supplied ObservationSchedule calendar. Otherwise, construction defaults to weekdays and replacement defaults to the instance's calendar.
Returns
BarrierOption— Validated copy of the same class.
Raises
KiyosiError— If the resulting contract fails core validation.TypeError— If a representation or field name is invalid.
strike
Return the strike price in underlying price units.
touch_state
Return strictly prior touch history, or None if unknown.
BinaryBarrierOption
BinaryBarrierOption(*, option_type, strike, effective_time, expiry_time, barrier_level, barrier_type, payoff_type, payout=None, observation_schedule=None, touch_state=None, calendar=Ellipsis)Cash-or-nothing or asset-or-nothing option with barrier monitoring.
Parameters
option_type({'call', 'put'}) — Terminal payoff direction; strike equality pays zero.strike(float) — Positive finite terminal exercise price.effective_time, expiry_time(datetime.datetime) — Inclusive contract life.barrier_level(float) — Positive finite trigger level.barrier_type({'up_and_in', 'up_and_out', 'down_and_in', 'down_and_out'}) — Trigger direction and knock-in or knock-out behavior.payoff_type({'cash', 'asset'}) — Explicit settlement choice.payout(float or None, optional) — Positive cash amount required for cash settlement; absent for asset settlement.observation_schedule(ObservationSchedule or iterable, optional) — Accepts a schedule or iterable of datetime.datetime values. Nonempty, strictly increasing times within life; None selects continuous monitoring.touch_state({'untouched', 'touched'} or None, optional) — Strictly prior touch history; defaults to unknown.calendar(TradingCalendar, optional) — Explicit override. Omission or Ellipsis inherits a supplied ObservationSchedule calendar. Otherwise, construction defaults to weekdays and replacement defaults to the instance's calendar.
Raises
InvalidInputError— If numeric terms, life, schedule or calendar compatibility are invalid.
Notes
Barrier equality touches; terminal strike equality pays zero.
barrier_level
Return positive finite trigger level; equality counts as a touch.
barrier_type
Return trigger direction and knock-in or knock-out behavior.
calendar
Return an owned copy of the contract's observation calendar.
effective_time
Return the inclusive contract start.
expiry_time
Return the inclusive expiry time.
observation_mode
Return continuous monitoring or observations on the supplied times.
observation_schedule
Return an owned schedule, or None for continuous monitoring.
observation_times
Return a copy of the contractual observation times.
option_type
Return call or put payoff direction.
payoff_type
Return cash or asset settlement as a choice string.
payout
Return the cash payout, or None for asset settlement.
replace
replace(self, /, *, option_type=Ellipsis, strike=Ellipsis, effective_time=Ellipsis, expiry_time=Ellipsis, barrier_level=Ellipsis, barrier_type=Ellipsis, observation_schedule=Ellipsis, touch_state=Ellipsis, payoff_type=Ellipsis, payout=Ellipsis, calendar=Ellipsis)Return a validated replacement.
Omitted fields and fields set to Ellipsis default to the instance's values.
Parameters
option_type({'call', 'put'}, optional) — Call or put payoff direction.strike(float, optional) — Positive finite strike price.effective_time, expiry_time(datetime.datetime, optional) — Inclusive contract start and expiry timestamps.barrier_level(float, optional) — Positive finite trigger level; equality counts as a touch.barrier_type(str, optional) — One of 'up_and_in', 'up_and_out', 'down_and_in', or 'down_and_out'. Barrier direction and knock-in or knock-out behavior.observation_schedule(ObservationSchedule or iterable, optional) — Accepts a schedule or iterable of datetime.datetime values. The instance's monitoring is the default. None selects continuous monitoring. A nonempty iterable selects scheduled monitoring.touch_state({'untouched', 'touched'} or None, optional) — Strictly prior touch history; None clears it to unknown.payoff_type({'cash', 'asset'}, optional) — Settlement kind, defaulting to the instance's kind.payout(float or None, optional) — A cash payoff requires a cash amount. Select the settlement kind with payoff_type.calendar(TradingCalendar, optional) — Explicit override. Omission or Ellipsis inherits a supplied ObservationSchedule calendar. Otherwise, construction defaults to weekdays and replacement defaults to the instance's calendar.
Returns
BinaryBarrierOption— Validated copy of the same class.
Raises
KiyosiError— If the resulting contract fails core validation.TypeError— If a representation or field name is invalid.
strike
Return the strike price in underlying price units.
touch_state
Return strictly prior touch history, or None if unknown.
BinarySnowballOption
BinarySnowballOption(*, maturity_coupon_rate, effective_time, expiry_time, autocall_observations, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar)Snowball with knock-out coupons and no knock-in or downside loss.
Parameters
maturity_coupon_rate(float) — Finite annual maturity coupon rate in decimal units.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.autocall_observations(iterable of SnowballObservation) — Nonempty, strictly ordered knock-out and coupon observations within life, with at most 4,194,304 records.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Events strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out; knocked_in means an outstanding knocked-in note; knocked_out means settled with no remaining value. The engine handles observations at valuation using current spot. Callers supply applicable state.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupons and losses.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar) — Required owned observation calendar. Records carry no calendar; pass schedule.calendar when constructing from a schedule. Controls contractual observations independently of PricingContext.
Raises
InvalidInputError— If coupons, principal, times or observations are invalid, or barrier_state is knocked_in; this contract has no knock-in barrier.
annual_rebate_rate
Return the annualized rebate rate accrued from effective time to exit.
autocall_observations
Return owned copies of the contractual knock-out and coupon observations.
Knock-in monitoring is available through knock_in_observation_schedule.
autocall_times
Return a copy of the contractual knock-out and coupon observation times.
Excludes independently scheduled knock-in monitoring.
barrier_state
Return strictly prior autocallable history, or None if unknown.
calendar
Return an owned copy of the contract's monitoring calendar.
effective_time
Return inclusive first contract timestamp.
expiry_time
Return inclusive expiry time.
knock_in_observation_schedule
Return an owned whole-life knock-in schedule, or None without knock-in.
Daily monitoring includes the effective instant at the contractual clock on open dates. Expiry-only monitoring returns just expiry. Observations for knock-out and coupons are supplied by the product observation lists. Long scans release the GIL and poll Python signals.
knock_out_coupon_rates
Return copied annual knock-out coupons in observation order.
knock_out_levels
Return copied knock-out thresholds in observation order.
maturity_coupon_rate
Return finite annual maturity coupon rate in decimal units.
principal_redemption_ratio
Return nonnegative normalized principal, independent of coupons and losses.
rebate_rate
Return the flat rebate proportion paid once at knock-out or maturity.
replace
replace(self, /, *, maturity_coupon_rate=Ellipsis, barrier_state=Ellipsis, principal_redemption_ratio=Ellipsis, rebate_rate=Ellipsis, annual_rebate_rate=Ellipsis, effective_time=Ellipsis, expiry_time=Ellipsis, autocall_observations=Ellipsis, calendar=Ellipsis)Return a validated replacement.
Omitted fields and fields set to Ellipsis default to the instance's values.
Parameters
maturity_coupon_rate(float, optional) — Finite annual maturity coupon rate in decimal units.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Strictly prior event history; None clears it to unknown.principal_redemption_ratio(float, optional) — Finite nonnegative principal redemption per unit of original notional.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional. Defaults to the instance's value.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate. Defaults to the instance's value. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.effective_time, expiry_time(datetime.datetime, optional) — Inclusive contract start and expiry timestamps.autocall_observations(iterable of SnowballObservation, optional) — Product-specific knock-out and coupon observations, in time order.calendar(TradingCalendar, optional) — Owned contractual observation calendar, defaulting to the instance's calendar.
Returns
BinarySnowballOption— Validated copy of the same class.
Raises
KiyosiError— If the resulting contract fails core validation.TypeError— If a representation or field name is invalid.
with_coupon
with_coupon(self, /, first_observation_coupon, *, quote_convention)Return a note with the quoted first coupon and preserved coupon spreads.
Parameters
first_observation_coupon(float) — Absolute annual first observation coupon, not an additive shift. All observation coupons shift equally to preserve their spreads.quote_convention(CouponQuoteConvention) — Whether to shift the maturity coupon or preserve it.
Returns
BinarySnowballOption— New note of the same type, preserving history and other terms.
Raises
InvalidInputError— If shifted coupons are non-finite or violate contractual constraints.
CashOrNothingOption
CashOrNothingOption(*, option_type, strike, payout, effective_time, expiry_time)European cash-or-nothing option paying only strictly in the money.
Parameters
option_type({'call', 'put'}) — Call or put payoff direction.strike(float) — Positive finite strike price.payout(float) — Positive finite cash payment.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.
Raises
InvalidInputError— If payout or strike is nonpositive or non-finite, or expiry precedes effective_time.
effective_time
Return inclusive first contract timestamp.
expiry_time
Return inclusive expiry time.
option_type
Return call or put payoff direction.
payout
Return the fixed cash payout.
replace
replace(self, /, *, option_type=Ellipsis, strike=Ellipsis, payout=Ellipsis, effective_time=Ellipsis, expiry_time=Ellipsis)Return a validated copy with replacement fields.
Omitted fields and fields set to Ellipsis use the instance's values. None clears nullable fields. The class documentation describes the accepted type and meaning of each field.
Parameters
option_type(object, optional) — Replacement field.strike(object, optional) — Replacement field.payout(object, optional) — Replacement field.effective_time(object, optional) — Replacement field.expiry_time(object, optional) — Replacement field.
Returns
object— Validated instance of the same class.
Raises
InvalidInputError— If fields fail constructor validation.TypeError— If a field name or representation is invalid.
strike
Return the strike price in underlying price units.
CouponObservation
CouponObservation(time, coupon_barrier_level)One Phoenix coupon observation with a nonnegative inclusive threshold.
Parameters
time(datetime.datetime) — Exact timezone-free observation timestamp.coupon_barrier_level(float) — Finite observation threshold; knock-out levels are positive and coupon barriers are nonnegative. A zero coupon barrier is unconditional.
Raises
InvalidInputError— If the threshold is outside its domain.TypeError— If the timestamp or number representation is invalid.
coupon_barrier_level
Return the validated observation threshold.
replace
replace(self, /, *, time=Ellipsis, coupon_barrier_level=Ellipsis)Return a validated copy with the supplied fields applied.
Omitted fields and fields set to Ellipsis default to the instance's values.
Parameters
time(datetime.datetime, optional) — Observation timestamp, defaulting to the instance's timestamp.coupon_barrier_level(float, optional) — Threshold, defaulting to the instance's threshold.
Returns
CouponObservation— Independent validated observation.
Raises
InvalidInputError— If the threshold is outside its domain.TypeError— If the timestamp or number representation is invalid.
time
Return the exact observation timestamp.
DoubleBarrierOption
DoubleBarrierOption(*, option_type, strike, effective_time, expiry_time, lower_barrier, upper_barrier, barrier_type, rebate=0.0, rebate_timing='at_expiry', observation_schedule=None, touch_state=None, calendar=Ellipsis)Vanilla option activated or terminated by either inclusive boundary.
Parameters
option_type({'call', 'put'}) — Call or put payoff direction.strike(float) — Positive finite strike price.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.lower_barrier(float) — Positive finite lower trigger; equality counts as a touch.upper_barrier(float) — Finite upper trigger, strictly above the lower trigger.barrier_type({'knock_in', 'knock_out'}) — Knock-in or knock-out activation by either barrier.rebate(float, optional) — Nonnegative finite cash rebate; defaults to zero.rebate_timing({'at_hit', 'at_expiry'}, optional) — Payment timing; at-hit rebates are valid only for knock-outs.observation_schedule(ObservationSchedule or iterable, optional) — Accepts a schedule or iterable of datetime.datetime values. Nonempty, strictly increasing times within life; None selects continuous monitoring.touch_state({'untouched', 'touched'} or None, optional) — Strictly prior history. None means unknown; untouched means known no hit.calendar(TradingCalendar, optional) — Explicit override. Omission or Ellipsis inherits a supplied ObservationSchedule calendar. Otherwise, construction defaults to weekdays and replacement defaults to the instance's calendar.
Raises
InvalidInputError— If boundaries, strike, rebate, life times, monitoring schedule or rebate timing are invalid. Calendar compatibility is checked on construction; history is checked during pricing.
barrier_type
Return knock-in or knock-out activation by either barrier.
calendar
Return an owned copy of the contract's observation calendar.
effective_time
Return the inclusive contract start.
expiry_time
Return the inclusive expiry time.
lower_barrier
Return positive finite lower trigger; equality counts as a touch.
observation_mode
Return continuous monitoring or observations on the supplied times.
observation_schedule
Return an owned schedule, or None for continuous monitoring.
observation_times
Return a copy of the contractual observation times.
option_type
Return call or put payoff direction.
rebate
Return nonnegative finite cash rebate; defaults to zero.
rebate_timing
Return payment timing; at-hit rebates are valid only for knock-outs.
replace
replace(self, /, *, option_type=Ellipsis, strike=Ellipsis, effective_time=Ellipsis, expiry_time=Ellipsis, lower_barrier=Ellipsis, upper_barrier=Ellipsis, barrier_type=Ellipsis, rebate=Ellipsis, rebate_timing=Ellipsis, observation_schedule=Ellipsis, touch_state=Ellipsis, calendar=Ellipsis)Return a validated replacement.
Omitted fields and fields set to Ellipsis default to the instance's values.
Parameters
option_type({'call', 'put'}, optional) — Call or put payoff direction.strike(float, optional) — Positive finite strike price.effective_time, expiry_time(datetime.datetime, optional) — Inclusive contract start and expiry timestamps.lower_barrier, upper_barrier(float, optional) — Positive finite lower and upper triggers, with the lower strictly smaller.barrier_type({'knock_in', 'knock_out'}, optional) — Knock-in or knock-out activation at either boundary.rebate(float, optional) — Nonnegative finite cash rebate.rebate_timing({'at_hit', 'at_expiry'}, optional) — Rebate payment timing; at-hit rebates require knock-out.observation_schedule(ObservationSchedule or iterable, optional) — Accepts a schedule or iterable of datetime.datetime values. The instance's monitoring is the default. None selects continuous monitoring. A nonempty iterable selects scheduled monitoring.touch_state({'untouched', 'touched'} or None, optional) — Strictly prior touch history; None clears it to unknown.calendar(TradingCalendar, optional) — Explicit override. Omission or Ellipsis inherits a supplied ObservationSchedule calendar. Otherwise, construction defaults to weekdays and replacement defaults to the instance's calendar.
Returns
DoubleBarrierOption— Validated copy of the same class.
Raises
KiyosiError— If the resulting contract fails core validation.TypeError— If a representation or field name is invalid.
strike
Return the strike price in underlying price units.
touch_state
Return strictly prior touch history, or None if unknown.
upper_barrier
Return finite upper trigger, strictly above the lower trigger.
DoubleTouchOption
DoubleTouchOption(*, effective_time, expiry_time, lower_barrier, upper_barrier, barrier_type, payout, settlement_timing='at_expiry', observation_schedule=None, touch_state=None, calendar=Ellipsis)Cash double one-touch or double no-touch option with inclusive barriers.
Parameters
effective_time, expiry_time(datetime.datetime) — Inclusive contract life.lower_barrier, upper_barrier(float) — Positive finite boundaries, with lower strictly below upper.barrier_type({'knock_in', 'knock_out'}) — Knock-in selects double one-touch; knock-out selects double no-touch.payout(float) — Positive finite cash payment.settlement_timing({'at_hit', 'at_expiry'}, optional) — Defaults to expiry; at-hit settlement requires double one-touch.observation_schedule(ObservationSchedule or iterable, optional) — Accepts a schedule or iterable of datetime.datetime values. Nonempty, strictly increasing times within life; None selects continuous monitoring.touch_state({'untouched', 'touched'} or None, optional) — Strictly prior touch history; defaults to unknown.calendar(TradingCalendar, optional) — Explicit override. Omission or Ellipsis inherits a supplied ObservationSchedule calendar. Otherwise, construction defaults to weekdays and replacement defaults to the instance's calendar.
Raises
InvalidInputError— If numeric terms, life, monitoring or calendar terms are invalid, or at-hit settlement is requested for double no-touch.
Notes
Double one-touch pays when either barrier is touched; double no-touch pays only if neither barrier is touched during monitoring. Prior at-hit payments have no remaining value.
barrier_type
Return knock_in for one-touch or knock_out for no-touch payment.
calendar
Return an owned copy of the contract's observation calendar.
effective_time
Return the inclusive contract start.
expiry_time
Return the inclusive expiry time.
lower_barrier
Return positive finite lower trigger; equality counts as a touch.
observation_mode
Return continuous monitoring or observations on the supplied times.
observation_schedule
Return an owned schedule, or None for continuous monitoring.
observation_times
Return a copy of the contractual observation times.
payout
Return the positive finite cash payout.
replace
replace(self, /, *, effective_time=Ellipsis, expiry_time=Ellipsis, lower_barrier=Ellipsis, upper_barrier=Ellipsis, barrier_type=Ellipsis, settlement_timing=Ellipsis, observation_schedule=Ellipsis, touch_state=Ellipsis, payout=Ellipsis, calendar=Ellipsis)Return a validated replacement.
Omitted fields and fields set to Ellipsis default to the instance's values.
Parameters
effective_time, expiry_time(datetime.datetime, optional) — Inclusive contract start and expiry timestamps.lower_barrier, upper_barrier(float, optional) — Positive finite lower and upper triggers, with the lower strictly smaller.barrier_type({'knock_in', 'knock_out'}, optional) — Knock-in or knock-out activation at either boundary.settlement_timing({'at_hit', 'at_expiry'}, optional) — Payment timing; at-hit settlement requires a one-touch contract.observation_schedule(ObservationSchedule or iterable, optional) — Accepts a schedule or iterable of datetime.datetime values. The instance's monitoring is the default. None selects continuous monitoring. A nonempty iterable selects scheduled monitoring.touch_state({'untouched', 'touched'} or None, optional) — Strictly prior touch history; None clears it to unknown.payout(float, optional) — Positive finite cash payment.calendar(TradingCalendar, optional) — Explicit override. Omission or Ellipsis inherits a supplied ObservationSchedule calendar. Otherwise, construction defaults to weekdays and replacement defaults to the instance's calendar.
Returns
DoubleTouchOption— Validated copy of the same class.
Raises
KiyosiError— If the resulting contract fails core validation.TypeError— If a representation or field name is invalid.
settlement_timing
Return at-hit or expiry payment; no-touch contracts settle only at expiry.
touch_state
Return strictly prior touch history, or None if unknown.
upper_barrier
Return finite upper trigger, strictly above the lower trigger.
EuropeanOption
EuropeanOption(*, option_type, strike, effective_time, expiry_time)European vanilla option.
Parameters
option_type({'call', 'put'}) — Call or put payoff direction.strike(float) — Positive finite strike price.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.
Raises
InvalidInputError— If strike is nonpositive or non-finite, or expiry precedes effective_time.
Notes
Pricing permits valuation before effective_time for this fixed-strike terminal payoff. Model data must cover valuation through expiry. Valuation after expiry is invalid.
effective_time
Return inclusive first contract timestamp.
expiry_time
Return inclusive expiry time.
option_type
Return call or put payoff direction.
replace
replace(self, /, *, option_type=Ellipsis, strike=Ellipsis, effective_time=Ellipsis, expiry_time=Ellipsis)Return a validated copy with replacement fields.
Omitted fields and fields set to Ellipsis use the instance's values. None clears nullable fields. The class documentation describes the accepted type and meaning of each field.
Parameters
option_type(object, optional) — Replacement field.strike(object, optional) — Replacement field.effective_time(object, optional) — Replacement field.expiry_time(object, optional) — Replacement field.
Returns
object— Validated instance of the same class.
Raises
InvalidInputError— If fields fail constructor validation.TypeError— If a field name or representation is invalid.
strike
Return the strike price in underlying price units.
GeometricAveragePriceOption
GeometricAveragePriceOption(*, option_type, strike, effective_time, averaging_start_time, expiry_time, realized_average=None)Continuously monitored average-price Asian option.
Parameters
option_type({'call', 'put'}) — Call or put payoff direction.strike(float) — Positive finite strike price.effective_time(datetime.datetime) — Inclusive contract start.averaging_start_time(datetime.datetime) — First averaging timestamp, within the contract life.expiry_time(datetime.datetime) — Inclusive expiry time.realized_average(float or None, optional) — Positive finite prior average; defaults to None (unknown). Must be None at or before averaging starts, and supplied strictly after it; time consistency is checked at pricing. History covers averaging strictly before valuation; callers supply the applicable average.
Raises
InvalidInputError— If strike, realized_average, life times or the averaging window are invalid.
averaging_start_time
Return first averaging timestamp, within the contract life.
effective_time
Return inclusive first contract timestamp.
expiry_time
Return inclusive expiry time.
option_type
Return call or put payoff direction.
realized_average
Return the supplied historical average, or None if unknown.
replace
replace(self, /, *, option_type=Ellipsis, strike=Ellipsis, effective_time=Ellipsis, averaging_start_time=Ellipsis, expiry_time=Ellipsis, realized_average=Ellipsis)Return a validated copy with replacement fields.
Omitted fields and fields set to Ellipsis use the instance's values. None clears nullable fields. The class documentation describes the accepted type and meaning of each field.
Parameters
option_type(object, optional) — Replacement field.strike(object, optional) — Replacement field.effective_time(object, optional) — Replacement field.averaging_start_time(object, optional) — Replacement field.expiry_time(object, optional) — Replacement field.realized_average(object, optional) — Replacement field.
Returns
object— Validated instance of the same class.
Raises
InvalidInputError— If fields fail constructor validation.TypeError— If a field name or representation is invalid.
strike
Return the strike price in underlying price units.
KnockInObservation
Knock-in observation rule with an owned daily clock when applicable.
Notes
Construct with every_trading_day(observation_clock_time) or at_expiry(). Knock-out and coupon timestamps are supplied independently through the corresponding product observation records.
at_expiry
at_expiry()Create knock-in observation only at the contract's expiry timestamp.
Returns
KnockInObservation— Immutable expiry-only observation rule without a daily clock.
every_trading_day
every_trading_day(observation_clock_time)Create daily knock-in observation on trading days.
Parameters
observation_clock_time(datetime.time) — Timezone-free daily knock-in clock with microsecond precision.
Returns
KnockInObservation— Immutable daily observation rule.
Raises
TypeError— If the clock representation is invalid or timezone-aware.
kind
Return every_trading_day or at_expiry.
observation_clock_time
Return the owned daily clock, or None for expiry-only observation.
KnockOutObservation
KnockOutObservation(time, knock_out_level)One Phoenix knock-out observation with a positive inclusive threshold.
Parameters
time(datetime.datetime) — Exact timezone-free observation timestamp.knock_out_level(float) — Finite observation threshold; knock-out levels are positive and coupon barriers are nonnegative. A zero coupon barrier is unconditional.
Raises
InvalidInputError— If the threshold is outside its domain.TypeError— If the timestamp or number representation is invalid.
knock_out_level
Return the validated observation threshold.
replace
replace(self, /, *, time=Ellipsis, knock_out_level=Ellipsis)Return a validated copy with the supplied fields applied.
Omitted fields and fields set to Ellipsis default to the instance's values.
Parameters
time(datetime.datetime, optional) — Observation timestamp, defaulting to the instance's timestamp.knock_out_level(float, optional) — Threshold, defaulting to the instance's threshold.
Returns
KnockOutObservation— Independent validated observation.
Raises
InvalidInputError— If the threshold is outside its domain.TypeError— If the timestamp or number representation is invalid.
time
Return the exact observation timestamp.
OptionType
OptionType = typing.Literal['call', 'put']PhoenixOption
PhoenixOption(*, coupon_per_period, initial_spot, knock_in_level, upper_strike, lower_strike, knock_in_observation, effective_time, expiry_time, knock_out_observations, coupon_observations, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar)Autocallable with conditional period coupons and capped downside loss.
Parameters
coupon_per_period(float) — Finite signed coupon proportion per qualifying observation, independent of period length.initial_spot(float) — Positive reference spot used to normalize downside losses.knock_in_level(float) — Positive strict downside threshold.upper_strike(float) — Positive upper terminal settlement strike.lower_strike(float) — Nonnegative lower terminal strike, at most the upper strike.knock_in_observation(KnockInObservation) — Observe knock-in on every trading day or only at expiry.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.knock_out_observations(iterable of KnockOutObservation) — Nonempty, strictly ordered knock-out observations within life.coupon_observations(iterable of CouponObservation) — Independent nonempty, strictly ordered coupon observations within life. The coupon and knock-out lists can contain up to 4,194,304 records combined.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Events strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out; knocked_in means an outstanding knocked-in note; knocked_out means settled with no remaining value. The engine handles observations at valuation using current spot. Callers supply applicable state.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupons and losses.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar) — Required owned observation calendar. Records carry no calendar; pass schedule.calendar when constructing from a schedule. Controls contractual observations independently of PricingContext.
Raises
TypeError— If a required value is missing or a supplied representation is invalid.InvalidInputError— If amounts, strikes, life times or either observation list are invalid.
Notes
Periodic coupons pay once per qualifying observation, including at the effective timestamp, without time accrual. None is not a coupon value. Coupon and knock-out barriers are inclusive; knock-in is strict. Past coupons are settled. There is no coupon memory or maturity coupon. Knock-out and coupon schedules are independent; neither implies an observation in the other. Expiry adds no implicit coupon or knock-out observation.
annual_rebate_rate
Return the annualized rebate rate accrued from effective time to exit.
barrier_state
Return strictly prior autocallable history, or None if unknown.
calendar
Return an owned copy of the contract's monitoring calendar.
coupon_barrier_levels
Return copied Phoenix coupon thresholds in observation order.
coupon_observations
Return owned copies of the coupon observations.
coupon_per_period
Return the finite signed coupon proportion per qualifying observation.
coupon_times
Return copied exact coupon observation times.
digital_coupon
digital_coupon(*, coupon_per_period, initial_spot, knock_in_level, knock_out_level, coupon_barrier_level, autocall_times, effective_time, expiry_time, lockout_periods=0, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar=Ellipsis)Create a digital coupon note with barrier-conditional fixed coupons.
Parameters
coupon_per_period(float) — Finite signed coupon proportion per qualifying observation; not annualized.initial_spot(float) — Positive reference spot used to normalize downside losses.knock_in_level(float) — Positive strict knock-in threshold.knock_out_level(float) — Positive inclusive threshold at the first eligible knock-out observation.coupon_barrier_level(float) — Nonnegative inclusive coupon threshold, including at knock-out.autocall_times(iterable of datetime.datetime) — Strictly increasing observation and payment times within life.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.lockout_periods(int, optional) — Initial observations excluded from knock-out; defaults to zero and must leave at least one eligible observation. Coupon and knock-in observations apply during the lockout.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — State strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out, knocked_in means outstanding after knock-in, and knocked_out means settled. Current observations use current spot.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupon and loss components.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar, optional) — Explicit calendar override; omission or Ellipsis inherits an ObservationSchedule calendar, otherwise weekdays.
Returns
PhoenixOption— Expiry-only knock-in with the knock-in level as upper strike and zero as lower strike.
Raises
InvalidInputError— If numeric terms, lockout, times or observations are invalid.TypeError— If a supplied representation is invalid, including Boolean or fractional counts.OverflowError— If a count is negative or outside the native unsigned integer range.
Notes
Coupons pay once per qualifying observation, including a qualifying knock-out, with no day accrual or memory. Knock-out and coupon barriers are inclusive; knock-in is strict. Observation times are payment times; no observation is implicitly added at expiry. Calendar compatibility is checked on construction; history consistency is checked during pricing. Past coupons are settled.
effective_time
Return inclusive first contract timestamp.
expiry_time
Return inclusive expiry time.
fixed_coupon
fixed_coupon(*, coupon_per_period, initial_spot, knock_in_level, knock_out_level, autocall_times, effective_time, expiry_time, lockout_periods=0, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar=Ellipsis)Create a fixed coupon note with unconditional surviving coupons.
Parameters
coupon_per_period(float) — Finite signed coupon proportion per qualifying observation; not annualized.initial_spot(float) — Positive reference spot used to normalize downside losses.knock_in_level(float) — Positive strict knock-in threshold.knock_out_level(float) — Positive inclusive threshold at the first eligible knock-out observation.autocall_times(iterable of datetime.datetime) — Strictly increasing observation and payment times within life.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.lockout_periods(int, optional) — Initial observations excluded from knock-out; defaults to zero and must leave at least one eligible observation. Coupon and knock-in observations apply during the lockout.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — State strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out, knocked_in means outstanding after knock-in, and knocked_out means settled. Current observations use current spot.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupon and loss components.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar, optional) — Explicit calendar override; omission or Ellipsis inherits an ObservationSchedule calendar, otherwise weekdays.
Returns
PhoenixOption— Expiry-only knock-in with the knock-in level as upper strike and zero as lower strike.
Raises
InvalidInputError— If numeric terms, lockout, times or observations are invalid.TypeError— If a supplied representation is invalid, including Boolean or fractional counts.OverflowError— If a count is negative or outside the native unsigned integer range.
Notes
Coupons pay once per qualifying observation, including a qualifying knock-out, with no day accrual or memory. Knock-out and coupon barriers are inclusive; knock-in is strict. Observation times are payment times; no observation is implicitly added at expiry. Calendar compatibility is checked on construction; history consistency is checked during pricing. Past coupons are settled.
initial_spot
Return positive reference spot used to normalize downside losses.
knock_in_level
Return positive strict downside threshold.
knock_in_observation
Return an owned knock-in observation rule.
knock_in_observation_schedule
Return an owned whole-life knock-in schedule, or None without knock-in.
Daily monitoring includes the effective instant at the contractual clock on open dates. Expiry-only monitoring returns just expiry. Observations for knock-out and coupons are supplied by the product observation lists. Long scans release the GIL and poll Python signals.
knock_out_levels
Return copied knock-out thresholds in knock-out observation order.
knock_out_observations
Return owned copies of the knock-out observations.
knock_out_times
Return copied exact knock-out observation times.
lower_strike
Return nonnegative lower terminal strike, at most the upper strike.
principal_redemption_ratio
Return nonnegative normalized principal, independent of coupons and losses.
rebate_rate
Return the flat rebate proportion paid once at knock-out or maturity.
replace
replace(self, /, *, coupon_per_period=Ellipsis, initial_spot=Ellipsis, knock_in_level=Ellipsis, upper_strike=Ellipsis, lower_strike=Ellipsis, knock_in_observation=Ellipsis, barrier_state=Ellipsis, principal_redemption_ratio=Ellipsis, rebate_rate=Ellipsis, annual_rebate_rate=Ellipsis, effective_time=Ellipsis, expiry_time=Ellipsis, knock_out_observations=Ellipsis, coupon_observations=Ellipsis, calendar=Ellipsis)Return a validated replacement.
Omitted fields and fields set to Ellipsis default to the instance's values.
Parameters
coupon_per_period(float, optional) — Finite signed periodic coupon rate.initial_spot, knock_in_level, upper_strike, lower_strike(float, optional) — Reference spot, strict downside barrier, and loss interval strikes.knock_in_observation(KnockInObservation, optional) — Daily or expiry-only knock-in monitoring rule.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Strictly prior event history; None clears it to unknown.principal_redemption_ratio(float, optional) — Finite nonnegative principal redemption per unit of original notional.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional. Defaults to the instance's value.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate. Defaults to the instance's value. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.effective_time, expiry_time(datetime.datetime, optional) — Inclusive contract start and expiry timestamps.knock_out_observations(iterable of KnockOutObservation, optional) — Knock-out observations in time order.coupon_observations(iterable of CouponObservation, optional) — Independent coupon observations in time order.calendar(TradingCalendar, optional) — Owned contractual observation calendar, defaulting to the instance's calendar.
Returns
PhoenixOption— Validated copy of the same class.
Raises
KiyosiError— If the resulting contract fails core validation.TypeError— If a representation or field name is invalid, including a None coupon.
standard
standard(*, coupon_per_period, initial_spot, knock_in_level, knock_out_level, coupon_barrier_level, knock_in_observation_clock_time, autocall_times, effective_time, expiry_time, lockout_periods=0, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar=Ellipsis)Create a Phoenix with a constant knock-out barrier and optional lockout.
Parameters
coupon_per_period(float) — Finite signed coupon proportion per qualifying observation; not annualized.initial_spot(float) — Positive reference spot used to normalize downside losses.knock_in_level(float) — Positive strict knock-in threshold.knock_out_level(float) — Positive inclusive threshold at the first eligible knock-out observation.coupon_barrier_level(float) — Nonnegative inclusive coupon threshold, including at knock-out.knock_in_observation_clock_time(datetime.time) — Daily knock-in observation clock on trading days.autocall_times(iterable of datetime.datetime) — Strictly increasing observation and payment times within life.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.lockout_periods(int, optional) — Initial observations excluded from knock-out; defaults to zero and must leave at least one eligible observation. Coupon and knock-in observations apply during the lockout.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — State strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out, knocked_in means outstanding after knock-in, and knocked_out means settled. Current observations use current spot.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupon and loss components.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar, optional) — Explicit calendar override; omission or Ellipsis inherits an ObservationSchedule calendar, otherwise weekdays.
Returns
PhoenixOption— Daily knock-in with the initial spot as upper strike and zero as lower strike.
Raises
InvalidInputError— If numeric terms, lockout, times or observations are invalid.TypeError— If a supplied representation is invalid, including Boolean or fractional counts.OverflowError— If a count is negative or outside the native unsigned integer range.
Notes
Coupons pay once per qualifying observation, including a qualifying knock-out, with no day accrual or memory. Knock-out and coupon barriers are inclusive; knock-in is strict. Observation times are payment times; no observation is implicitly added at expiry. Calendar compatibility is checked on construction; history consistency is checked during pricing. Past coupons are settled.
step_down
step_down(*, coupon_per_period, initial_spot, knock_in_level, initial_knock_out_level, coupon_barrier_level, knock_out_level_decrement, knock_in_observation_clock_time, autocall_times, effective_time, expiry_time, lockout_periods=0, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar=Ellipsis)Create a Phoenix whose knock-out barrier steps down after lockout.
Parameters
coupon_per_period(float) — Finite signed coupon proportion per qualifying observation; not annualized.initial_spot(float) — Positive reference spot used to normalize downside losses.knock_in_level(float) — Positive strict knock-in threshold.initial_knock_out_level(float) — Positive inclusive threshold at the first eligible knock-out observation.coupon_barrier_level(float) — Nonnegative inclusive coupon threshold, including at knock-out.knock_out_level_decrement(float) — Finite nonnegative absolute decrement per eligible observation. The ladder starts after lockout.knock_in_observation_clock_time(datetime.time) — Daily knock-in observation clock on trading days.autocall_times(iterable of datetime.datetime) — Strictly increasing observation and payment times within life.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.lockout_periods(int, optional) — Initial observations excluded from knock-out; defaults to zero and must leave at least one eligible observation. Coupon and knock-in observations apply during the lockout.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — State strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out, knocked_in means outstanding after knock-in, and knocked_out means settled. Current observations use current spot.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupon and loss components.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar, optional) — Explicit calendar override; omission or Ellipsis inherits an ObservationSchedule calendar, otherwise weekdays.
Returns
PhoenixOption— Daily knock-in with the initial spot as upper strike and zero as lower strike.
Raises
InvalidInputError— If numeric terms, lockout, times or observations are invalid.TypeError— If a supplied representation is invalid, including Boolean or fractional counts.OverflowError— If a count is negative or outside the native unsigned integer range.
Notes
Coupons pay once per qualifying observation, including a qualifying knock-out, with no day accrual or memory. Knock-out and coupon barriers are inclusive; knock-in is strict. Observation times are payment times; no observation is implicitly added at expiry. Calendar compatibility is checked on construction; history consistency is checked during pricing. Past coupons are settled.
upper_strike
Return positive upper terminal settlement strike.
with_coupon
with_coupon(self, /, *, coupon_per_period)Return a note with the supplied periodic coupon rate.
History and other terms are preserved.
Parameters
coupon_per_period(float) — Finite signed payment per observation, as a proportion of initial notional.
Returns
PhoenixOption— Note using the supplied periodic coupon rate.
Raises
InvalidInputError— If the coupon is non-finite.TypeError— If the supplied representation is invalid.
RangeAccrualOption
RangeAccrualOption(*, notional, annual_coupon_rate, lower_bound, upper_bound, effective_time, expiry_time, observation_clock_time, realized_hit_count=None, calendar=TradingCalendar(kind='weekdays', trading_days_per_year=261))Range coupon paid at expiry without principal repayment.
Parameters
notional(float) — Positive finite coupon notional, without principal repayment.annual_coupon_rate(float) — Nonnegative finite annual coupon rate in decimal units.lower_bound(float) — Inclusive nonnegative lower spot boundary.upper_bound(float) — Inclusive finite upper spot boundary, above the lower boundary.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.observation_clock_time(datetime.time) — Required daily observation time, without timezone information.realized_hit_count(int or None, optional) — Hits strictly before valuation, or None for unknown history. Cannot exceed the number of observations strictly before expiry.calendar(TradingCalendar, optional) — Owned observation calendar; defaults to weekdays, independently of PricingContext.
Raises
InvalidInputError— If amounts, bounds or history are invalid, or expiry is not after effective_time, or the observation schedule is empty. Pricing checks the inclusive contract life and history against elapsed observations.
Notes
Observe trading times in (effective_time, expiry_time]. Bounds are inclusive. Settlement may fall on a closed date without adding an observation. Payment is notional times annual coupon times Actual/365 Fixed life times the fraction of observations inside the range. Payment occurs at expiry and is discounted to the valuation time, including when the observation schedule is complete. Long schedule builds release the GIL and poll Python signals during construction and replacement.
annual_coupon_rate
Return nonnegative finite annual coupon rate in decimal units.
calendar
Return an owned copy of the contract's observation calendar.
effective_time
Return inclusive first contract timestamp.
expiry_time
Return inclusive expiry time.
lower_bound
Return inclusive nonnegative lower spot boundary.
notional
Return positive finite coupon notional, without principal repayment.
observation_clock_time
Return the explicitly specified daily observation clock time.
observation_schedule
Return the daily range observation schedule.
Observations exclude the effective instant.
Applies the contract calendar and clock through expiry, independently of supplied history. Payment adds no observation.
realized_hit_count
Return hits strictly before valuation, or None for unknown history.
replace
replace(self, /, *, notional=Ellipsis, annual_coupon_rate=Ellipsis, lower_bound=Ellipsis, upper_bound=Ellipsis, effective_time=Ellipsis, expiry_time=Ellipsis, observation_clock_time=Ellipsis, realized_hit_count=Ellipsis, calendar=Ellipsis)Return a validated copy with replacement fields.
Omitted fields and fields set to Ellipsis use the instance's values. None clears nullable fields. The class documentation describes the accepted type and meaning of each field.
Parameters
notional(object, optional) — Replacement field.annual_coupon_rate(object, optional) — Replacement field.lower_bound(object, optional) — Replacement field.upper_bound(object, optional) — Replacement field.effective_time(object, optional) — Replacement field.expiry_time(object, optional) — Replacement field.observation_clock_time(object, optional) — Replacement field.realized_hit_count(object, optional) — Replacement field.calendar(object, optional) — Replacement field.
Returns
object— Validated instance of the same class.
Raises
InvalidInputError— If fields fail constructor validation.TypeError— If a field name or representation is invalid.
upper_bound
Return inclusive finite upper spot boundary, above the lower boundary.
SnowballObservation
SnowballObservation(time, knock_out_level, *, coupon_rate)Snowball knock-out observation with a finite annual coupon.
Parameters
time(datetime.datetime) — Exact observation timestamp.knock_out_level(float) — Positive finite inclusive knock-out threshold.coupon_rate(float) — Finite signed annual knock-out coupon; supply zero explicitly for no coupon.
Raises
InvalidInputError— If the level is nonpositive or non-finite, or the coupon is non-finite.
Notes
Numeric terms are validated in Rust; the note validates ordering, life bounds and calendar compatibility. Phoenix uses KnockOutObservation and CouponObservation.
coupon_rate
Return the finite annual snowball coupon rate.
from_columns
from_columns(autocall_times, knock_out_levels, *, knock_out_coupon_rates)Combine parallel sequences into validated snowball observation records.
Parameters
autocall_times(iterable of datetime.datetime) — Knock-out and coupon observation times; the note checks ordering and life bounds.knock_out_levels(iterable of float) — Positive inclusive knock-out levels, one per observation timestamp.knock_out_coupon_rates(iterable of float) — Explicit annual snowball coupons, including zero for no coupon.
Returns
list of SnowballObservation— Observation records.
Raises
InvalidInputError— If sequence lengths differ, the record count exceeds 4,194,304, or numeric levels or coupons are invalid.TypeError— If an argument is missing or a value has an invalid representation.
Notes
The note constructor validates ordering, life bounds and calendar compatibility.
Passing an ObservationSchedule copies its timestamps into the records; the records carry no calendar. Pass calendar=schedule.calendar to the note constructor to preserve its observation calendar. Raw note constructors require an explicit calendar, including for daily knock-in monitoring.
Examples
Forward a schedule's custom calendar when constructing a snowball:
>>> from datetime import datetime, time
>>> from kiyosi import instruments as ins, market
>>> start, end = datetime(2025, 1, 2, 15), datetime(2025, 1, 10, 15)
>>> calendar = market.TradingCalendar.custom(
... base=market.TradingCalendar.weekdays(),
... closed_dates=[datetime(2025, 1, 6).date()],
... )
>>> schedule = market.ObservationSchedule(
... times=[end], start_time=start, end_time=end, calendar=calendar,
... )
>>> records = ins.SnowballObservation.from_columns(
... schedule, [110], knock_out_coupon_rates=[0.1],
... )
>>> daily = ins.KnockInObservation.every_trading_day(time(15))
>>> note = ins.SnowballOption(
... maturity_coupon_rate=0.1, initial_spot=100, knock_in_level=80,
... upper_strike=100, lower_strike=0,
... knock_in_observation=daily, effective_time=start, expiry_time=end,
... autocall_observations=records,
... calendar=schedule.calendar,
... )
>>> note.calendar == schedule.calendar
True
>>> len(note.knock_in_observation_schedule)
6knock_out_level
Return the positive finite knock-out threshold.
replace
replace(self, /, *, time=Ellipsis, knock_out_level=Ellipsis, coupon_rate=Ellipsis)Return a validated observation with the supplied fields replaced.
Omitted fields and fields set to Ellipsis default to the instance's values.
Parameters
time(datetime.datetime, optional) — Observation timestamp.knock_out_level(float, optional) — Positive finite knock-out threshold.coupon_rate(float, optional) — Finite annual snowball coupon.
Returns
SnowballObservation— Validated copy. The note checks schedule constraints.
Raises
InvalidInputError— If the level is nonpositive or non-finite, or the coupon is non-finite.TypeError— If a field has an invalid representation.
time
Return exact observation time.
SnowballOption
SnowballOption(*, maturity_coupon_rate, initial_spot, knock_in_level, upper_strike, lower_strike, knock_in_observation, effective_time, expiry_time, autocall_observations, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar)Snowball with knock-out coupons and capped knock-in downside loss.
Parameters
maturity_coupon_rate(float) — Finite annual maturity coupon rate in decimal units.initial_spot(float) — Positive reference spot used to normalize downside losses.knock_in_level(float) — Positive strict downside threshold.upper_strike(float) — Positive upper terminal settlement strike.lower_strike(float) — Nonnegative lower terminal strike, at most the upper strike.knock_in_observation(KnockInObservation) — Observe knock-in on every trading day or only at expiry.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.autocall_observations(iterable of SnowballObservation) — Nonempty, strictly ordered knock-out and coupon observations within life, with at most 4,194,304 records.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Events strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out; knocked_in means an outstanding knocked-in note; knocked_out means settled with no remaining value. The engine handles observations at valuation using current spot. Callers supply applicable state.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupons and losses.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar) — Required owned observation calendar. Records carry no calendar; pass schedule.calendar when constructing from a schedule. Controls contractual observations independently of PricingContext.
Raises
InvalidInputError— If amounts, strikes, life times or observation terms are invalid. Calendar compatibility is checked on construction; prior barrier history is checked during pricing.
annual_rebate_rate
Return the annualized rebate rate accrued from effective time to exit.
autocall_observations
Return owned copies of the contractual knock-out and coupon observations.
Knock-in monitoring is available through knock_in_observation_schedule.
autocall_times
Return a copy of the contractual knock-out and coupon observation times.
Excludes independently scheduled knock-in monitoring.
barrier_state
Return strictly prior autocallable history, or None if unknown.
both_down
both_down(*, initial_coupon_rate, initial_spot, knock_in_level, initial_knock_out_level, coupon_rate_decrement, knock_out_level_decrement, autocall_times, effective_time, expiry_time, knock_in_observation_clock_time, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar=Ellipsis)Create a snowball with decreasing coupons and knock-out levels.
Parameters
initial_coupon_rate(float) — Annual coupon rate at the first observation.initial_spot(float) — Positive reference spot used to normalize downside losses.knock_in_level(float) — Positive strict downside threshold.initial_knock_out_level(float) — Positive knock-out threshold at the first observation.coupon_rate_decrement(float) — Absolute decimal-rate decrement after each observation.knock_out_level_decrement(float) — Absolute price decrement after each observation; may be negative.autocall_times(iterable of datetime.datetime) — Strictly increasing knock-out and coupon observation times within life.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.knock_in_observation_clock_time(datetime.time) — Daily knock-in observation clock on trading days.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Events strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out; knocked_in means an outstanding knocked-in note; knocked_out means settled with no remaining value. The engine handles observations at valuation using current spot. Callers supply applicable state.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupons and losses.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar, optional) — Explicit calendar override; omission or Ellipsis inherits an ObservationSchedule calendar, otherwise weekdays.
Returns
SnowballOption— Validated owned contract.
Raises
InvalidInputError— If contractual amounts, life times or observation terms are invalid.
Notes
Knock-in is observed on every trading day. Decrements apply after each observation. The first uses the initial value. Signed coupons and decrements require valid expanded terms. Maturity uses the final observation coupon.
The returned SnowballOption stores observation and maturity coupons separately. To edit its first annual observation coupon while preserving coupon spreads, use the returned note's quoting operation:
.. code-block:: python
edited = note.with_coupon( first_observation_coupon=0.15, quote_convention="shift_maturity_coupon", )
This convention shifts the maturity coupon by the same amount. Use preserve_maturity_coupon to keep maturity fixed. Replacing only maturity_coupon_rate edits only the maturity coupon.
butterfly
butterfly(*, first_coupon_rate, initial_spot, knock_in_level, knock_out_level, second_coupon_rate, third_coupon_rate, first_stage_end_time, second_stage_end_time, autocall_times, effective_time, expiry_time, knock_in_observation_clock_time, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar=Ellipsis)Create a three-stage butterfly snowball.
Parameters
first_coupon_rate(float) — Finite signed annual coupon rate through first_stage_end_time.initial_spot(float) — Positive reference spot used to normalize downside losses.knock_in_level(float) — Positive strict downside threshold.knock_out_level(float) — Positive inclusive knock-out threshold.second_coupon_rate(float) — Finite signed annual coupon in the second stage.third_coupon_rate(float) — Finite signed annual coupon in the third stage and at maturity.first_stage_end_time(datetime.datetime) — Inclusive first-stage end within life and before second_stage_end_time.second_stage_end_time(datetime.datetime) — Inclusive second-stage end strictly before expiry.autocall_times(iterable of datetime.datetime) — Strictly increasing knock-out and coupon observation times within life.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.knock_in_observation_clock_time(datetime.time) — Daily knock-in observation clock on trading days.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Events strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out; knocked_in means an outstanding knocked-in note; knocked_out means settled with no remaining value. The engine handles observations at valuation using current spot. Callers supply applicable state.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupons and losses.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar, optional) — Explicit calendar override; omission or Ellipsis inherits an ObservationSchedule calendar, otherwise weekdays.
Returns
SnowballOption— Validated owned contract.
Raises
InvalidInputError— If contractual amounts, life times or observation terms are invalid.
Notes
Knock-in is observed on every trading day. Knock-out uses the observation's stage rate over the holding period. Maturity uses the final stage rate. Cutoffs may fall outside trading or observation times. Stages can be empty and rates can increase.
The returned SnowballOption stores observation and maturity coupons separately. To edit its first annual observation coupon while preserving coupon spreads, use the returned note's quoting operation:
.. code-block:: python
edited = note.with_coupon( first_observation_coupon=0.15, quote_convention="shift_maturity_coupon", )
This convention shifts the maturity coupon by the same amount. Use preserve_maturity_coupon to keep maturity fixed. Replacing only maturity_coupon_rate edits only the maturity coupon.
calendar
Return an owned copy of the contract's monitoring calendar.
dual_coupon
dual_coupon(*, knock_out_coupon_rate, initial_spot, knock_in_level, knock_out_level, maturity_coupon_rate, autocall_times, effective_time, expiry_time, knock_in_observation_clock_time, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar=Ellipsis)Create a snowball with separate knock-out and maturity coupons.
Parameters
knock_out_coupon_rate(float) — Annual coupon rate for knock-out settlement.initial_spot(float) — Positive reference spot used to normalize downside losses.knock_in_level(float) — Positive strict downside threshold.knock_out_level(float) — Positive inclusive knock-out threshold.maturity_coupon_rate(float) — Finite annual maturity coupon rate in decimal units.autocall_times(iterable of datetime.datetime) — Strictly increasing knock-out and coupon observation times within life.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.knock_in_observation_clock_time(datetime.time) — Daily knock-in observation clock on trading days.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Events strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out; knocked_in means an outstanding knocked-in note; knocked_out means settled with no remaining value. The engine handles observations at valuation using current spot. Callers supply applicable state.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupons and losses.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar, optional) — Explicit calendar override; omission or Ellipsis inherits an ObservationSchedule calendar, otherwise weekdays.
Returns
SnowballOption— Validated owned contract.
Raises
InvalidInputError— If contractual amounts, life times or observation terms are invalid.
Notes
Knock-in is observed on every trading day.
The returned SnowballOption stores observation and maturity coupons separately. To edit its first annual observation coupon while preserving coupon spreads, use the returned note's quoting operation:
.. code-block:: python
edited = note.with_coupon( first_observation_coupon=0.15, quote_convention="shift_maturity_coupon", )
This convention shifts the maturity coupon by the same amount. Use preserve_maturity_coupon to keep maturity fixed. Replacing only maturity_coupon_rate edits only the maturity coupon.
early_profit
early_profit(*, first_coupon_rate, initial_spot, knock_in_level, knock_out_level, second_coupon_rate, first_stage_end_time, autocall_times, effective_time, expiry_time, knock_in_observation_clock_time, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar=Ellipsis)Create a two-stage early-profit snowball.
Parameters
first_coupon_rate(float) — Finite signed annual coupon rate through first_stage_end_time.initial_spot(float) — Positive reference spot used to normalize downside losses.knock_in_level(float) — Positive strict downside threshold.knock_out_level(float) — Positive inclusive knock-out threshold.second_coupon_rate(float) — Finite signed annual coupon rate after the cutoff and at maturity.first_stage_end_time(datetime.datetime) — Inclusive first-stage end within life and strictly before expiry.autocall_times(iterable of datetime.datetime) — Strictly increasing knock-out and coupon observation times within life.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.knock_in_observation_clock_time(datetime.time) — Daily knock-in observation clock on trading days.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Events strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out; knocked_in means an outstanding knocked-in note; knocked_out means settled with no remaining value. The engine handles observations at valuation using current spot. Callers supply applicable state.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupons and losses.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar, optional) — Explicit calendar override; omission or Ellipsis inherits an ObservationSchedule calendar, otherwise weekdays.
Returns
SnowballOption— Validated owned contract.
Raises
InvalidInputError— If contractual amounts, life times or observation terms are invalid.
Notes
Knock-in is observed on every trading day. Knock-out uses the observation's stage rate over the holding period. Maturity uses the final stage rate. Cutoffs may fall outside trading or observation times. Stages can be empty and rates can increase.
The returned SnowballOption stores observation and maturity coupons separately. To edit its first annual observation coupon while preserving coupon spreads, use the returned note's quoting operation:
.. code-block:: python
edited = note.with_coupon( first_observation_coupon=0.15, quote_convention="shift_maturity_coupon", )
This convention shifts the maturity coupon by the same amount. Use preserve_maturity_coupon to keep maturity fixed. Replacing only maturity_coupon_rate edits only the maturity coupon.
effective_time
Return inclusive first contract timestamp.
european
european(*, coupon_rate, initial_spot, knock_in_level, knock_out_level, autocall_times, effective_time, expiry_time, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar=Ellipsis)Create a snowball with knock-in observed only at expiry.
Parameters
coupon_rate(float) — Finite annual coupon rate in decimal units.initial_spot(float) — Positive reference spot used to normalize downside losses.knock_in_level(float) — Positive strict downside threshold.knock_out_level(float) — Positive inclusive knock-out threshold.autocall_times(iterable of datetime.datetime) — Strictly increasing knock-out and coupon observation times within life.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Events strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out; knocked_in means an outstanding knocked-in note; knocked_out means settled with no remaining value. The engine handles observations at valuation using current spot. Callers supply applicable state.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupons and losses.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar, optional) — Explicit calendar override; omission or Ellipsis inherits an ObservationSchedule calendar, otherwise weekdays.
Returns
SnowballOption— Validated owned contract.
Raises
InvalidInputError— If contractual amounts, life times or observation terms are invalid.
Notes
Knock-in is observed only at expiry.
The returned SnowballOption stores observation and maturity coupons separately. To edit its first annual observation coupon while preserving coupon spreads, use the returned note's quoting operation:
.. code-block:: python
edited = note.with_coupon( first_observation_coupon=0.15, quote_convention="shift_maturity_coupon", )
This convention shifts the maturity coupon by the same amount. Use preserve_maturity_coupon to keep maturity fixed. Replacing only maturity_coupon_rate edits only the maturity coupon.
expiry_time
Return inclusive expiry time.
initial_spot
Return positive reference spot used to normalize downside losses.
knock_in_level
Return positive strict downside threshold.
knock_in_observation
Return an owned knock-in observation rule.
knock_in_observation_schedule
Return an owned whole-life knock-in schedule, or None without knock-in.
Daily monitoring includes the effective instant at the contractual clock on open dates. Expiry-only monitoring returns just expiry. Observations for knock-out and coupons are supplied by the product observation lists. Long scans release the GIL and poll Python signals.
knock_out_coupon_rates
Return copied annual knock-out coupons in observation order.
knock_out_levels
Return copied knock-out thresholds in observation order.
loss_capped
loss_capped(*, coupon_rate, initial_spot, knock_in_level, knock_out_level, lower_strike, autocall_times, effective_time, expiry_time, knock_in_observation_clock_time, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar=Ellipsis)Create a snowball whose lower terminal strike caps downside loss.
Parameters
coupon_rate(float) — Finite annual coupon rate in decimal units.initial_spot(float) — Positive reference spot used to normalize downside losses.knock_in_level(float) — Positive strict downside threshold.knock_out_level(float) — Positive inclusive knock-out threshold.lower_strike(float) — Nonnegative lower terminal strike, at most the upper strike.autocall_times(iterable of datetime.datetime) — Strictly increasing knock-out and coupon observation times within life.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.knock_in_observation_clock_time(datetime.time) — Daily knock-in observation clock on trading days.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Events strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out; knocked_in means an outstanding knocked-in note; knocked_out means settled with no remaining value. The engine handles observations at valuation using current spot. Callers supply applicable state.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupons and losses.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar, optional) — Explicit calendar override; omission or Ellipsis inherits an ObservationSchedule calendar, otherwise weekdays.
Returns
SnowballOption— Validated owned contract.
Raises
InvalidInputError— If contractual amounts, life times or observation terms are invalid.
Notes
Knock-in is observed on every trading day.
The returned SnowballOption stores observation and maturity coupons separately. To edit its first annual observation coupon while preserving coupon spreads, use the returned note's quoting operation:
.. code-block:: python
edited = note.with_coupon( first_observation_coupon=0.15, quote_convention="shift_maturity_coupon", )
This convention shifts the maturity coupon by the same amount. Use preserve_maturity_coupon to keep maturity fixed. Replacing only maturity_coupon_rate edits only the maturity coupon.
lower_strike
Return nonnegative lower terminal strike, at most the upper strike.
maturity_coupon_rate
Return finite annual maturity coupon rate in decimal units.
otm
otm(*, coupon_rate, initial_spot, knock_in_level, knock_out_level, upper_strike, autocall_times, effective_time, expiry_time, knock_in_observation_clock_time, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar=Ellipsis)Create a snowball with a replaced upper terminal strike.
Parameters
coupon_rate(float) — Finite annual coupon rate in decimal units.initial_spot(float) — Positive reference spot used to normalize downside losses.knock_in_level(float) — Positive strict downside threshold.knock_out_level(float) — Positive inclusive knock-out threshold.upper_strike(float) — Positive upper terminal settlement strike.autocall_times(iterable of datetime.datetime) — Strictly increasing knock-out and coupon observation times within life.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.knock_in_observation_clock_time(datetime.time) — Daily knock-in observation clock on trading days.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Events strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out; knocked_in means an outstanding knocked-in note; knocked_out means settled with no remaining value. The engine handles observations at valuation using current spot. Callers supply applicable state.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupons and losses.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar, optional) — Explicit calendar override; omission or Ellipsis inherits an ObservationSchedule calendar, otherwise weekdays.
Returns
SnowballOption— Validated owned contract.
Raises
InvalidInputError— If contractual amounts, life times or observation terms are invalid.
Notes
Knock-in is observed on every trading day.
The returned SnowballOption stores observation and maturity coupons separately. To edit its first annual observation coupon while preserving coupon spreads, use the returned note's quoting operation:
.. code-block:: python
edited = note.with_coupon( first_observation_coupon=0.15, quote_convention="shift_maturity_coupon", )
This convention shifts the maturity coupon by the same amount. Use preserve_maturity_coupon to keep maturity fixed. Replacing only maturity_coupon_rate edits only the maturity coupon.
parachute
parachute(*, coupon_rate, initial_spot, knock_in_level, knock_out_level, final_knock_out_level, autocall_times, effective_time, expiry_time, knock_in_observation_clock_time, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar=Ellipsis)Create a snowball with a distinct final knock-out level.
Parameters
coupon_rate(float) — Finite annual coupon rate in decimal units.initial_spot(float) — Positive reference spot used to normalize downside losses.knock_in_level(float) — Positive strict downside threshold.knock_out_level(float) — Positive inclusive knock-out threshold.final_knock_out_level(float) — Positive threshold replacing only the final knock-out level.autocall_times(iterable of datetime.datetime) — Strictly increasing knock-out and coupon observation times within life.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.knock_in_observation_clock_time(datetime.time) — Daily knock-in observation clock on trading days.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Events strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out; knocked_in means an outstanding knocked-in note; knocked_out means settled with no remaining value. The engine handles observations at valuation using current spot. Callers supply applicable state.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupons and losses.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar, optional) — Explicit calendar override; omission or Ellipsis inherits an ObservationSchedule calendar, otherwise weekdays.
Returns
SnowballOption— Validated owned contract.
Raises
InvalidInputError— If contractual amounts, life times or observation terms are invalid.
Notes
Knock-in is observed on every trading day.
The returned SnowballOption stores observation and maturity coupons separately. To edit its first annual observation coupon while preserving coupon spreads, use the returned note's quoting operation:
.. code-block:: python
edited = note.with_coupon( first_observation_coupon=0.15, quote_convention="shift_maturity_coupon", )
This convention shifts the maturity coupon by the same amount. Use preserve_maturity_coupon to keep maturity fixed. Replacing only maturity_coupon_rate edits only the maturity coupon.
principal_redemption_ratio
Return nonnegative normalized principal, independent of coupons and losses.
rebate_rate
Return the flat rebate proportion paid once at knock-out or maturity.
replace
replace(self, /, *, maturity_coupon_rate=Ellipsis, initial_spot=Ellipsis, knock_in_level=Ellipsis, upper_strike=Ellipsis, lower_strike=Ellipsis, knock_in_observation=Ellipsis, barrier_state=Ellipsis, principal_redemption_ratio=Ellipsis, rebate_rate=Ellipsis, annual_rebate_rate=Ellipsis, effective_time=Ellipsis, expiry_time=Ellipsis, autocall_observations=Ellipsis, calendar=Ellipsis)Return a validated replacement.
Omitted fields and fields set to Ellipsis default to the instance's values.
Parameters
maturity_coupon_rate, initial_spot, knock_in_level(float, optional) — Annual maturity coupon, reference spot, and strict downside barrier.upper_strike, lower_strike(float, optional) — Upper and lower strikes defining the downside loss interval.knock_in_observation(KnockInObservation, optional) — Daily or expiry-only knock-in monitoring rule.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Strictly prior event history; None clears it to unknown.principal_redemption_ratio(float, optional) — Finite nonnegative principal redemption per unit of original notional.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional. Defaults to the instance's value.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate. Defaults to the instance's value. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.effective_time, expiry_time(datetime.datetime, optional) — Inclusive contract start and expiry timestamps.autocall_observations(iterable of SnowballObservation, optional) — Product-specific knock-out and coupon observations, in time order.calendar(TradingCalendar, optional) — Owned contractual observation calendar, defaulting to the instance's calendar.
Returns
SnowballOption— Validated copy of the same class.
Raises
KiyosiError— If the resulting contract fails core validation.TypeError— If a representation or field name is invalid.
standard
standard(*, coupon_rate, initial_spot, knock_in_level, knock_out_level, autocall_times, effective_time, expiry_time, knock_in_observation_clock_time, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar=Ellipsis)Create a snowball with flat knock-out terms and daily knock-in.
Parameters
coupon_rate(float) — Finite annual coupon rate in decimal units.initial_spot(float) — Positive reference spot used to normalize downside losses.knock_in_level(float) — Positive strict downside threshold.knock_out_level(float) — Positive inclusive knock-out threshold.autocall_times(iterable of datetime.datetime) — Strictly increasing knock-out and coupon observation times within life.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.knock_in_observation_clock_time(datetime.time) — Daily knock-in observation clock on trading days.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Events strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out; knocked_in means an outstanding knocked-in note; knocked_out means settled with no remaining value. The engine handles observations at valuation using current spot. Callers supply applicable state.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupons and losses.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar, optional) — Explicit calendar override; omission or Ellipsis inherits an ObservationSchedule calendar, otherwise weekdays.
Returns
SnowballOption— Validated owned contract.
Raises
InvalidInputError— If contractual amounts, life times or observation terms are invalid.
Notes
Knock-in is observed on every trading day.
The returned SnowballOption stores observation and maturity coupons separately. To edit its first annual observation coupon while preserving coupon spreads, use the returned note's quoting operation:
.. code-block:: python
edited = note.with_coupon( first_observation_coupon=0.15, quote_convention="shift_maturity_coupon", )
This convention shifts the maturity coupon by the same amount. Use preserve_maturity_coupon to keep maturity fixed. Replacing only maturity_coupon_rate edits only the maturity coupon.
step_down
step_down(*, coupon_rate, initial_spot, knock_in_level, initial_knock_out_level, knock_out_level_decrement, autocall_times, effective_time, expiry_time, knock_in_observation_clock_time, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar=Ellipsis)Create a snowball with decreasing knock-out levels.
Parameters
coupon_rate(float) — Finite annual coupon rate in decimal units.initial_spot(float) — Positive reference spot used to normalize downside losses.knock_in_level(float) — Positive strict downside threshold.initial_knock_out_level(float) — Positive knock-out threshold at the first observation.knock_out_level_decrement(float) — Absolute price decrement after each observation; may be negative.autocall_times(iterable of datetime.datetime) — Strictly increasing knock-out and coupon observation times within life.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.knock_in_observation_clock_time(datetime.time) — Daily knock-in observation clock on trading days.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Events strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out; knocked_in means an outstanding knocked-in note; knocked_out means settled with no remaining value. The engine handles observations at valuation using current spot. Callers supply applicable state.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupons and losses.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar, optional) — Explicit calendar override; omission or Ellipsis inherits an ObservationSchedule calendar, otherwise weekdays.
Returns
SnowballOption— Validated owned contract.
Raises
InvalidInputError— If contractual amounts, life times or observation terms are invalid.
Notes
Knock-in is observed on every trading day. Decrements apply after each observation. The first uses the initial value. Signed coupons and decrements require valid expanded terms.
The returned SnowballOption stores observation and maturity coupons separately. To edit its first annual observation coupon while preserving coupon spreads, use the returned note's quoting operation:
.. code-block:: python
edited = note.with_coupon( first_observation_coupon=0.15, quote_convention="shift_maturity_coupon", )
This convention shifts the maturity coupon by the same amount. Use preserve_maturity_coupon to keep maturity fixed. Replacing only maturity_coupon_rate edits only the maturity coupon.
upper_strike
Return positive upper terminal settlement strike.
with_coupon
with_coupon(self, /, first_observation_coupon, *, quote_convention)Return a note with the quoted first coupon and preserved coupon spreads.
Parameters
first_observation_coupon(float) — Absolute annual first observation coupon, not an additive shift. All observation coupons shift equally to preserve their spreads.quote_convention(CouponQuoteConvention) — Whether to shift the maturity coupon or preserve it.
Returns
SnowballOption— New note of the same type, preserving history and other terms.
Raises
InvalidInputError— If shifted coupons are non-finite or violate contractual constraints.
TernarySnowballOption
TernarySnowballOption(*, maturity_coupon_rate, minimum_coupon_rate, knock_in_level, knock_in_observation, effective_time, expiry_time, autocall_observations, barrier_state=None, principal_redemption_ratio=1.0, rebate_rate=0.0, annual_rebate_rate=0.0, calendar)Snowball with distinct intact and knocked-in maturity coupons.
Parameters
maturity_coupon_rate(float) — Finite annual maturity coupon rate in decimal units.minimum_coupon_rate(float) — Knocked-in maturity coupon, at most the intact maturity coupon.knock_in_level(float) — Positive strict downside threshold.knock_in_observation(KnockInObservation) — Observe knock-in on every trading day or only at expiry.effective_time(datetime.datetime) — Inclusive contract start.expiry_time(datetime.datetime) — Inclusive expiry time.autocall_observations(iterable of SnowballObservation) — Nonempty, strictly ordered knock-out and coupon observations within life, with at most 4,194,304 records.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Events strictly before valuation. None is unknown; no_event means no prior knock-in or knock-out; knocked_in means an outstanding knocked-in note; knocked_out means settled with no remaining value. The engine handles observations at valuation using current spot. Callers supply applicable state.principal_redemption_ratio(float, optional) — Nonnegative normalized principal, independent of coupons and losses.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional, default 0.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate, default 0. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.calendar(TradingCalendar) — Required owned observation calendar. Records carry no calendar; pass schedule.calendar when constructing from a schedule. Controls contractual observations independently of PricingContext.
Raises
InvalidInputError— If coupons, principal, barriers, times or observations are invalid. minimum_coupon_rate must not exceed maturity_coupon_rate.
annual_rebate_rate
Return the annualized rebate rate accrued from effective time to exit.
autocall_observations
Return owned copies of the contractual knock-out and coupon observations.
Knock-in monitoring is available through knock_in_observation_schedule.
autocall_times
Return a copy of the contractual knock-out and coupon observation times.
Excludes independently scheduled knock-in monitoring.
barrier_state
Return strictly prior autocallable history, or None if unknown.
calendar
Return an owned copy of the contract's monitoring calendar.
effective_time
Return inclusive first contract timestamp.
expiry_time
Return inclusive expiry time.
knock_in_level
Return positive strict downside threshold.
knock_in_observation
Return an owned knock-in observation rule.
knock_in_observation_schedule
Return an owned whole-life knock-in schedule, or None without knock-in.
Daily monitoring includes the effective instant at the contractual clock on open dates. Expiry-only monitoring returns just expiry. Observations for knock-out and coupons are supplied by the product observation lists. Long scans release the GIL and poll Python signals.
knock_out_coupon_rates
Return copied annual knock-out coupons in observation order.
knock_out_levels
Return copied knock-out thresholds in observation order.
maturity_coupon_rate
Return finite annual maturity coupon rate in decimal units.
minimum_coupon_rate
Return the annual knocked-in maturity coupon.
principal_redemption_ratio
Return nonnegative normalized principal, independent of coupons and losses.
rebate_rate
Return the flat rebate proportion paid once at knock-out or maturity.
replace
replace(self, /, *, maturity_coupon_rate=Ellipsis, minimum_coupon_rate=Ellipsis, knock_in_level=Ellipsis, knock_in_observation=Ellipsis, barrier_state=Ellipsis, principal_redemption_ratio=Ellipsis, rebate_rate=Ellipsis, annual_rebate_rate=Ellipsis, effective_time=Ellipsis, expiry_time=Ellipsis, autocall_observations=Ellipsis, calendar=Ellipsis)Return a validated replacement.
Omitted fields and fields set to Ellipsis default to the instance's values.
Parameters
maturity_coupon_rate, minimum_coupon_rate, knock_in_level(float, optional) — Annual maturity and minimum coupons, and the strict downside barrier.knock_in_observation(KnockInObservation, optional) — Daily or expiry-only knock-in monitoring rule.barrier_state({'no_event', 'knocked_in', 'knocked_out'} or None, optional) — Strictly prior event history; None clears it to unknown.principal_redemption_ratio(float, optional) — Finite nonnegative principal redemption per unit of original notional.rebate_rate(float, optional) — Finite nonnegative flat rebate per unit of original notional. Defaults to the instance's value.annual_rebate_rate(float, optional) — Finite nonnegative annualized rebate rate. Defaults to the instance's value. Accrues from effective time to actual knock-out or expiry using Actual/365 Fixed, including intraday time and nontrading days. Both rebates are additive to coupons and principal gains or losses and pay once at termination. A note knocked out before valuation is settled and has zero value.effective_time, expiry_time(datetime.datetime, optional) — Inclusive contract start and expiry timestamps.autocall_observations(iterable of SnowballObservation, optional) — Product-specific knock-out and coupon observations, in time order.calendar(TradingCalendar, optional) — Owned contractual observation calendar, defaulting to the instance's calendar.
Returns
TernarySnowballOption— Validated copy of the same class.
Raises
KiyosiError— If the resulting contract fails core validation.TypeError— If a representation or field name is invalid.
with_coupon
with_coupon(self, /, first_observation_coupon, *, quote_convention)Return a note with the quoted first coupon and preserved coupon spreads.
Parameters
first_observation_coupon(float) — Absolute annual first observation coupon, not an additive shift. All observation coupons shift equally to preserve their spreads.quote_convention(CouponQuoteConvention) — Whether to shift the maturity coupon or preserve it.
Returns
TernarySnowballOption— New note of the same type, preserving history and other terms.
Raises
InvalidInputError— If shifted coupons are non-finite or violate contractual constraints.
TouchOption
TouchOption(*, effective_time, expiry_time, barrier_level, barrier_type, payoff_type, payout=None, settlement_timing='at_expiry', observation_schedule=None, touch_state=None, calendar=Ellipsis)Strike-free cash or asset one-touch or no-touch contract.
Parameters
effective_time, expiry_time(datetime.datetime) — Inclusive contract life.barrier_level(float) — Positive finite trigger level; equality counts as a touch.barrier_type({'up_and_in', 'up_and_out', 'down_and_in', 'down_and_out'}) — In selects one-touch; out selects no-touch. Up/down selects direction.payoff_type({'cash', 'asset'}) — Explicit settlement choice.payout(float or None, optional) — Positive cash amount required for cash settlement; absent for asset settlement.settlement_timing({'at_hit', 'at_expiry'}, optional) — Defaults to expiry; at-hit settlement requires a one-touch.observation_schedule(ObservationSchedule or iterable, optional) — Accepts a schedule or iterable of datetime.datetime values. Nonempty, strictly increasing times within life; None selects continuous monitoring.touch_state({'untouched', 'touched'} or None, optional) — Strictly prior touch history; defaults to unknown.calendar(TradingCalendar, optional) — Explicit override. Omission or Ellipsis inherits a supplied ObservationSchedule calendar. Otherwise, construction defaults to weekdays and replacement defaults to the instance's calendar.
Raises
InvalidInputError— If numeric terms, life, monitoring or calendar terms are invalid, or at-hit settlement is requested for a no-touch.
Notes
Prior at-hit payments are settled. A current asset hit transfers spot; a future continuous asset hit transfers the barrier amount.
barrier_level
Return positive finite trigger level; equality counts as a touch.
barrier_type
Return trigger direction and knock-in or knock-out behavior.
calendar
Return an owned copy of the contract's observation calendar.
effective_time
Return the inclusive contract start.
expiry_time
Return the inclusive expiry time.
observation_mode
Return continuous monitoring or observations on the supplied times.
observation_schedule
Return an owned schedule, or None for continuous monitoring.
observation_times
Return a copy of the contractual observation times.
payoff_type
Return cash or asset settlement as a choice string.
payout
Return the cash payout, or None for asset settlement.
replace
replace(self, /, *, effective_time=Ellipsis, expiry_time=Ellipsis, barrier_level=Ellipsis, barrier_type=Ellipsis, settlement_timing=Ellipsis, observation_schedule=Ellipsis, touch_state=Ellipsis, payoff_type=Ellipsis, payout=Ellipsis, calendar=Ellipsis)Return a validated replacement.
Omitted fields and fields set to Ellipsis default to the instance's values.
Parameters
effective_time, expiry_time(datetime.datetime, optional) — Inclusive contract start and expiry timestamps.barrier_level(float, optional) — Positive finite trigger level; equality counts as a touch.barrier_type(str, optional) — One of 'up_and_in', 'up_and_out', 'down_and_in', or 'down_and_out'. Barrier direction and knock-in or knock-out behavior.settlement_timing({'at_hit', 'at_expiry'}, optional) — Payment timing; at-hit settlement requires a one-touch contract.observation_schedule(ObservationSchedule or iterable, optional) — Accepts a schedule or iterable of datetime.datetime values. The instance's monitoring is the default. None selects continuous monitoring. A nonempty iterable selects scheduled monitoring.touch_state({'untouched', 'touched'} or None, optional) — Strictly prior touch history; None clears it to unknown.payoff_type({'cash', 'asset'}, optional) — Settlement kind, defaulting to the instance's kind.payout(float or None, optional) — A cash payoff requires a cash amount. Select the settlement kind with payoff_type.calendar(TradingCalendar, optional) — Explicit override. Omission or Ellipsis inherits a supplied ObservationSchedule calendar. Otherwise, construction defaults to weekdays and replacement defaults to the instance's calendar.
Returns
TouchOption— Validated copy of the same class.
Raises
KiyosiError— If the resulting contract fails core validation.TypeError— If a representation or field name is invalid.
settlement_timing
Return at-hit or expiry payment; no-touch contracts settle only at expiry.
touch_state
Return strictly prior touch history, or None if unknown.