4 releases
0.18.1 | Mar 9, 2023 |
---|---|
0.18.0 | Mar 6, 2023 |
0.10.7 | Nov 21, 2022 |
0.10.6 | Nov 21, 2022 |
#372 in Finance
30KB
410 lines
blackscholes
This library provides an simple, lightweight, and efficient (though not heavily optimized) implementation of the Black-Scholes-Merton model for pricing European options.
Includes all first, second, and third order Greeks.
Usage
View the docs for usage and examples.
lib.rs
:
This library provides an simple, lightweight, and efficient (though not heavily optimized) implementation of the Black-Scholes-Merton model for pricing European options.
Provides methods for pricing options, calculating implied volatility, and calculating the first, second, and third order Greeks.
Example:
use blackscholes::{Inputs, OptionType, Pricing};
let inputs = Inputs::new(OptionType::Call, 100.0, 100.0, None, 0.05, 0.2, 20.0/365.25, Some(0.2));
let price: f32 = inputs.calc_price().unwrap();
Criterion benchmark can be ran by running:
cargo bench
See the Github Repo for full source code. Other implementations such as a npm WASM package and a python module are also available.
Dependencies
~8MB
~151K SLoC