#finance #option #wasm #blackscholes #option-pricing

blackscholes_wasm

Black-Scholes option pricing model calculator

2 releases

0.10.7 Nov 21, 2022
0.10.6 Nov 21, 2022

#81 in Finance

26 downloads per month

MIT license

15KB
186 lines

blackscholes_wasm

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.

View the Rust docs or npm docs for usage and examples.


lib.rs:

blackscholes_wasm

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.

Example:

let inputs: blackscholes::Inputs = blackscholes::Inputs.new(blackscholes::OptionType::Call, 100.0, 100.0, None, 0.05, 0.02, 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.

Dependencies

~5.5MB
~114K SLoC