blackscholes_wasm/lib.rs
1//! This library provides an simple, lightweight, and efficient (though not heavily optimized) implementation of the Black-Scholes-Merton model for pricing European options.
2//!
3//! Provides methods for pricing options, calculating implied volatility, and calculating the first, second, and third order Greeks.
4//!
5//! ### Example:
6//! ```
7//! use blackscholes::{Inputs, OptionType, Pricing};
8//! let inputs = Inputs::new(OptionType::Call, 100.0, 100.0, None, 0.05, 0.2, 20.0/365.25, Some(0.2));
9//! let price: f32 = inputs.calc_price().unwrap();
10//! ```
11//!
12//! Criterion benchmark can be ran by running:
13//! ```
14//! cargo bench
15//! ```
16//!
17//! See the [Github Repo](https://github.com/hayden4r4/blackscholes-rust/tree/master) for full source code. Other implementations such as a [npm WASM package](https://www.npmjs.com/package/@haydenr4/blackscholes_wasm) and a [python module](https://pypi.org/project/blackscholes/) are also available.
18mod common;
19mod constants;
20mod greeks;
21mod implied_volatility;
22mod inputs;
23mod pricing;
24
25pub use inputs::{Inputs, OptionType};