pub trait Payoff:
Debug
+ Send
+ Sync {
// Required methods
fn payoff(&self, spot: f64, strike: f64) -> f64;
fn payoff_kind(&self) -> PayoffType;
fn put_or_call(&self) -> &PutOrCall;
fn exercise_style(&self) -> &ContractStyle;
fn as_any(&self) -> &dyn Any;
// Provided methods
fn path_payoff(&self, path: &[f64], strike: f64) -> f64 { ... }
fn is_path_dependent(&self) -> bool { ... }
fn payoff_amount(&self, base: &EquityOptionBase) -> f64 { ... }
}Expand description
Common interface linking all payoffs (Vanilla, Binary, Barrier, Asian).
Terminal payoffs implement payoff; path-dependent
payoffs (Asian, Barrier) additionally override
path_payoff, which defaults to evaluating the
terminal payoff on the last point of the path. Engines only ever call
these two methods, so a new payoff plugs into every engine at once.
Required Methods§
Sourcefn payoff(&self, spot: f64, strike: f64) -> f64
fn payoff(&self, spot: f64, strike: f64) -> f64
Payoff for a given level of the underlying: the terminal spot for European exercise, or the exercise spot for American.
fn payoff_kind(&self) -> PayoffType
fn put_or_call(&self) -> &PutOrCall
fn exercise_style(&self) -> &ContractStyle
Provided Methods§
Sourcefn path_payoff(&self, path: &[f64], strike: f64) -> f64
fn path_payoff(&self, path: &[f64], strike: f64) -> f64
Payoff for a full simulated path (used by Monte Carlo). Terminal payoffs default to the last point; Asian/Barrier override this. The path excludes the initial spot (it starts at the first step).
Sourcefn is_path_dependent(&self) -> bool
fn is_path_dependent(&self) -> bool
True when the payoff depends on the whole path (Asian, Barrier), so engines must simulate paths rather than terminal values.
Sourcefn payoff_amount(&self, base: &EquityOptionBase) -> f64
fn payoff_amount(&self, base: &EquityOptionBase) -> f64
Intrinsic value at the option’s current underlying price.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Payoff for AsianPayoff
Asian payoff: the average is taken over the monitored path points (equally spaced, spot excluded). Fixed strike pays on the average against the strike; floating strike pays on the terminal spot against the average.
impl Payoff for AutocallablePayoff
impl Payoff for BarrierPayoff
Barrier payoff: payoff is the underlying vanilla leg (used by the
analytic building blocks and as the terminal leg of path pricing);
path_payoff applies discretely monitored knock logic to a full path.
The Monte Carlo engine additionally applies a Brownian-bridge crossing
correction, so its effective monitoring is continuous.
impl Payoff for BinaryPayoff
Binary (digital) payoff, strictly in the money beyond the strike:
cash-or-nothing pays cash, asset-or-nothing pays the underlying level.