Function black_scholes::compute_all

source ·
pub fn compute_all(
    stock: f64,
    strike: f64,
    rate: f64,
    sigma: f64,
    maturity: f64
) -> PricesAndGreeks
Expand description

Returns call and put prices and greeks. Due to caching the complex computations (such as N(d1)), this implementation is faster if you need to obtain all the information for a given stock price and strike price.

Examples

let sigma = 0.3;
let stock = 5.0;
let strike = 4.5;
let rate = 0.05;
let maturity = 1.0;
let all_prices_and_greeks = black_scholes::compute_all(
    stock,
    strike,
    rate,
    sigma,
    maturity,
);