Skip to main content

QuadratureAutocallableEngine

Struct QuadratureAutocallableEngine 

Source
pub struct QuadratureAutocallableEngine { /* private fields */ }
Expand description

Prices snowball variants and Phoenix notes by quadrature between event dates.

Integrates piecewise cubic continuation values against Gaussian transition densities. Rolls back cash flows on event dates and the remaining knock-in exposure on daily dates. Preserves cash and asset payments below the spatial grid, including zero-lower-strike losses. Extends the spatial domain for forward drift and the backward movement of event boundaries. Spatial resolution and integration extent require separate convergence checks. Shared and distinct instances support concurrent pricing. See Self::new for an example.

§Greeks

Computes requested scalar sensitivities using shared core bump defaults.

Expiry Greeks follow terminal payoffs. Time Greeks are absent at expiry. Spot and time stencils crossing active events are unavailable. Vega and rho are defined at current thresholds. See Self::new for an example.

§Errors

Checks flat-rate applicability before shift validation, then propagates crate::numerical_greeks errors.

Implementations§

Source§

impl QuadratureAutocallableEngine

Source

pub fn new(settings: QuadratureSettings) -> Result<Self>

Creates an engine with validated spatial resolution and integration extent.

§Errors

Propagates QuadratureSettings::validate errors.

§Examples
use kiyosi::*;
use kiyosi::engines::QuadratureSettings;
let start = Date::new(2025, 1, 1)?.start_of_day();
let end = Date::new(2025, 4, 1)?.start_of_day();
let terms = SnowballTerms::new(0.08, 100.0, 80.0, 100.0, 0.0, start, end,
    SnowballObservation::from_columns(&[end], &[110.0], &[0.08])?, KnockInObservation::AtExpiry, kiyosi::TradingCalendar::weekdays());
let note = SnowballOption::new(terms)?;
let context = PricingContext::new(BlackScholesMertonParameters::new(0.04, 0.01, 0.2)?,
    100.0, start.into())?;
let engine = QuadratureAutocallableEngine::new(QuadratureSettings::default())?;
assert_eq!(engine.settings().asset_step_count, 512);
let result = engine.price_with_greeks(&note, &context,
    GreeksRequest::new([Greek::Delta, Greek::Vega]))?;
assert!(result.price().is_finite());
assert!(result.get(Greek::Delta).is_some());
Source

pub fn settings(&self) -> QuadratureSettings

Returns owned settings; see Self::new.

Trait Implementations§

Source§

impl Clone for QuadratureAutocallableEngine

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for QuadratureAutocallableEngine

Source§

impl Debug for QuadratureAutocallableEngine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for QuadratureAutocallableEngine

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for QuadratureAutocallableEngine

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T: AutocallableTerms> PricingEngine<AutocallableNote<T>> for QuadratureAutocallableEngine

Source§

fn price( &self, option: &AutocallableNote<T>, context: &PricingContext, ) -> Result<f64>

Prices remaining cash flows, resolving current events before future integration.

Knock-in is strict below its level; knock-out and Phoenix coupon barriers are inclusive. Phoenix coupons pay a fixed proportion of initial notional per qualifying observation without time accrual. Coupons are paid independently of knock-out, principal and downside loss. Past knock-outs return zero, and terminal payments use normalized units. See Self::new for an example.

§Errors

Missing required history returns crate::Error::MissingHistory; see the caller-supplied history contract.

Checks flat rates (Error::UnsupportedOperation), then inclusive life, impossible prior history, and required curve coverage (Error::InvalidInput), in that order. Non-finite prices or unrepresentable transitions return Error::ComputationFailure. Unresolved thresholds or quotes above the remaining discounted payout bound return Error::NonConvergence.

Source§

fn validate_applicability(&self, context: &PricingContext) -> Result<()>

Checks engine applicability before numerical requests or implied-volatility validation. Read more
Source§

fn prepare_request( &self, ) -> Result<Option<Box<dyn PricingEngine<AutocallableNote<T>> + '_>>>

Prepares request-local state for numerical Greeks and implied-parameter solvers. Read more
Source§

fn price_with_greeks( &self, option: &I, context: &PricingContext, request: GreeksRequest, ) -> Result<PricingResult>
where I: OptionContract,

Returns requested sensitivities using shared bump defaults. Read more
Source§

fn price_with_greeks_with_settings( &self, option: &I, context: &PricingContext, request: GreeksRequest, settings: NumericalShiftSettings, ) -> Result<PricingResult>
where I: OptionContract,

Returns native sensitivities with explicit request-level numerical controls. Read more
Source§

fn greek_method( &self, option: &I, context: &PricingContext, ) -> Result<GreekMethod>
where I: OptionContract,

Reports the native Greek calculation path without pricing or drawing samples. Read more
Source§

fn default_spot_shift(&self, _option: &I, context: &PricingContext) -> f64

Returns the automatic pre-expiry spot bump for this engine and contract family. Read more
Source§

fn validate_solver_seed(&self) -> Result<()>

Checks that a solver’s random draws can be replayed by the caller. Read more
Source§

fn price_with_seed( &self, option: &I, context: &PricingContext, ) -> Result<(f64, Option<u64>)>

Returns a scalar price and the seed used, or None without sampling. Read more
Source§

fn price_with_statistics( &self, _option: &I, _context: &PricingContext, ) -> Result<MonteCarloEstimate>

Returns a price with sampling uncertainty when the engine provides an estimator. Read more
Source§

fn volatility_affects_price(&self, option: &I, context: &PricingContext) -> bool
where I: OptionContract,

Reports whether volatility affects a validated contract’s remaining payoff. Read more
Source§

fn prepare_implied_volatility( &self, _option: &I, _context: &PricingContext, settings: ImpliedVolatilitySettings, ) -> Result<ImpliedVolatilitySettings>

Restricts a validated solver bracket to the engine’s supported domain. Read more
Source§

impl StructuralPartialEq for QuadratureAutocallableEngine

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.