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
impl QuadratureAutocallableEngine
Sourcepub fn new(settings: QuadratureSettings) -> Result<Self>
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(¬e, &context,
GreeksRequest::new([Greek::Delta, Greek::Vega]))?;
assert!(result.price().is_finite());
assert!(result.get(Greek::Delta).is_some());Sourcepub fn settings(&self) -> QuadratureSettings
pub fn settings(&self) -> QuadratureSettings
Returns owned settings; see Self::new.
Trait Implementations§
Source§impl Clone for QuadratureAutocallableEngine
impl Clone for QuadratureAutocallableEngine
impl Copy for QuadratureAutocallableEngine
Source§impl Debug for QuadratureAutocallableEngine
impl Debug for QuadratureAutocallableEngine
Source§impl<T: AutocallableTerms> PricingEngine<AutocallableNote<T>> for QuadratureAutocallableEngine
impl<T: AutocallableTerms> PricingEngine<AutocallableNote<T>> for QuadratureAutocallableEngine
Source§fn price(
&self,
option: &AutocallableNote<T>,
context: &PricingContext,
) -> Result<f64>
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<()>
fn validate_applicability(&self, context: &PricingContext) -> Result<()>
Source§fn prepare_request(
&self,
) -> Result<Option<Box<dyn PricingEngine<AutocallableNote<T>> + '_>>>
fn prepare_request( &self, ) -> Result<Option<Box<dyn PricingEngine<AutocallableNote<T>> + '_>>>
Source§fn price_with_greeks(
&self,
option: &I,
context: &PricingContext,
request: GreeksRequest,
) -> Result<PricingResult>where
I: OptionContract,
fn price_with_greeks(
&self,
option: &I,
context: &PricingContext,
request: GreeksRequest,
) -> Result<PricingResult>where
I: OptionContract,
Source§fn price_with_greeks_with_settings(
&self,
option: &I,
context: &PricingContext,
request: GreeksRequest,
settings: NumericalShiftSettings,
) -> Result<PricingResult>where
I: OptionContract,
fn price_with_greeks_with_settings(
&self,
option: &I,
context: &PricingContext,
request: GreeksRequest,
settings: NumericalShiftSettings,
) -> Result<PricingResult>where
I: OptionContract,
Source§fn greek_method(
&self,
option: &I,
context: &PricingContext,
) -> Result<GreekMethod>where
I: OptionContract,
fn greek_method(
&self,
option: &I,
context: &PricingContext,
) -> Result<GreekMethod>where
I: OptionContract,
Source§fn default_spot_shift(&self, _option: &I, context: &PricingContext) -> f64
fn default_spot_shift(&self, _option: &I, context: &PricingContext) -> f64
Source§fn validate_solver_seed(&self) -> Result<()>
fn validate_solver_seed(&self) -> Result<()>
Source§fn price_with_seed(
&self,
option: &I,
context: &PricingContext,
) -> Result<(f64, Option<u64>)>
fn price_with_seed( &self, option: &I, context: &PricingContext, ) -> Result<(f64, Option<u64>)>
None without sampling. Read moreSource§fn price_with_statistics(
&self,
_option: &I,
_context: &PricingContext,
) -> Result<MonteCarloEstimate>
fn price_with_statistics( &self, _option: &I, _context: &PricingContext, ) -> Result<MonteCarloEstimate>
Source§fn volatility_affects_price(&self, option: &I, context: &PricingContext) -> boolwhere
I: OptionContract,
fn volatility_affects_price(&self, option: &I, context: &PricingContext) -> boolwhere
I: OptionContract,
Source§fn prepare_implied_volatility(
&self,
_option: &I,
_context: &PricingContext,
settings: ImpliedVolatilitySettings,
) -> Result<ImpliedVolatilitySettings>
fn prepare_implied_volatility( &self, _option: &I, _context: &PricingContext, settings: ImpliedVolatilitySettings, ) -> Result<ImpliedVolatilitySettings>
impl StructuralPartialEq for QuadratureAutocallableEngine
Auto Trait Implementations§
impl Freeze for QuadratureAutocallableEngine
impl RefUnwindSafe for QuadratureAutocallableEngine
impl Send for QuadratureAutocallableEngine
impl Sync for QuadratureAutocallableEngine
impl Unpin for QuadratureAutocallableEngine
impl UnsafeUnpin for QuadratureAutocallableEngine
impl UnwindSafe for QuadratureAutocallableEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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