RustQuant_instruments 0.3.1

A Rust library for quantitative finance.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// RustQuant: A Rust library for quantitative finance tools.
// Copyright (C) 2023 https://github.com/avhz
// Dual licensed under Apache 2.0 and MIT.
// See:
//      - LICENSE-APACHE.md
//      - LICENSE-MIT.md
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/// Generic payoff trait for derivatives.
pub trait Payoff {
    /// Underlying input type for the payoff function.
    type Underlying;

    /// Payoff function for the derivative.
    fn payoff(&self, underlying: Self::Underlying) -> f64;
}