23 releases

Uses new Rust 2024

0.11.1 Jan 18, 2026
0.11.0 Nov 11, 2025
0.10.2 May 26, 2024
0.10.1 Nov 30, 2022
0.1.2 Dec 2, 2017

#45 in Finance

Download history 265/week @ 2025-12-10 127/week @ 2025-12-17 28/week @ 2025-12-24 70/week @ 2025-12-31 316/week @ 2026-01-07 146/week @ 2026-01-14 182/week @ 2026-01-21 101/week @ 2026-01-28 263/week @ 2026-02-04 327/week @ 2026-02-11 527/week @ 2026-02-18 200/week @ 2026-02-25 552/week @ 2026-03-04 785/week @ 2026-03-11 2207/week @ 2026-03-18 1124/week @ 2026-03-25

4,694 downloads per month
Used in 5 crates (4 directly)

MIT license

74KB
1.5K SLoC

[lin-badge]: https://github.com/danielhstahl/black_scholes_rust/workflows/Rust/badge.svg [cov-badge]: https://coveralls.io/repos/github/danielhstahl/black_scholes_rust/badge.svg?branch=master

Linux Coveralls
![lin-badge] ![cov-badge]

black_scholes_rust

This is a simple Black Scholes option calculator written in rust. Documentation is on docs.rs.

breaking changes

The move from 0.4 to 0.5 results changed the IV api to return a Result<f64, f64> rather than an f64.

using black_scholes_rust

Put the following in your Cargo.toml:

[dependencies]
black_scholes = "0.11.0"

Import and use:

extern crate black_scholes;
let stock = 5.0;
let strike = 4.5;
let rate = 0.01;
let discount = 0.99;
let sigma = 0.3;
let maturity = 2.0;
let sqrt_maturity_sigma = sigma*maturity.sqrt();
let price = black_scholes::call_discount(
    stock, strike, discount,
    sqrt_maturity_sigma
);
//or
let price = black_scholes::call(
    stock, strike, rate,
    sigma, maturity
);

Dependencies

~1.3–2MB
~43K SLoC