Crate blackscholes

source ·
Expand description

blackscholes

This library provides an simple, lightweight, and efficient (though not heavily optimized) implementation of the Black-Scholes-Merton model for pricing European options.

Usage

Simply create an instance of the Inputs struct and call the desired method. This crate is generic over all floating point types (f32, f64)

Example:

use blackscholes::{Inputs, OptionType};
let inputs = Inputs::new(OptionType::Call, 100.0, 100.0, None, 0.05, 0.2, 20.0/365.25, Some(0.2));
let price: f64 = inputs.calc_price();

See the Github Repo for full source code. Other implementations such as a npm WASM package and a python module are also available.

Structs

The inputs to the Black-Scholes-Merton model.

Enums

The type of option to be priced.

Traits

Trait alias for floats