Skip to main content

Payoff

Trait Payoff 

Source
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§

Source

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.

Source

fn payoff_kind(&self) -> PayoffType

Source

fn put_or_call(&self) -> &PutOrCall

Source

fn exercise_style(&self) -> &ContractStyle

Source

fn as_any(&self) -> &dyn Any

Downcast hook so pricers that need payoff-specific details (e.g. the analytic pricer distinguishing cash- from asset-or-nothing binaries) can recover the concrete payoff type.

Provided Methods§

Source

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).

Source

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.

Source

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§

Source§

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.

Source§

impl Payoff for AutocallablePayoff

Source§

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.

Source§

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.

Source§

impl Payoff for ForwardStartPayoff

Source§

impl Payoff for VanillaPayoff