#move #f64 #option #pricing #scholes #black

black_scholes

A Black Scholes option pricing library

13 releases (4 breaking)

0.5.0 Mar 23, 2019
0.4.0 Mar 2, 2019
0.3.0 Sep 16, 2018
0.2.8 Aug 19, 2018
0.1.2 Dec 2, 2017
Download history 48/week @ 2020-08-10 29/week @ 2020-08-17 30/week @ 2020-08-24 24/week @ 2020-08-31 197/week @ 2020-09-07 13/week @ 2020-09-14 11/week @ 2020-09-21 10/week @ 2020-09-28 76/week @ 2020-10-05 91/week @ 2020-10-12 79/week @ 2020-10-19 7/week @ 2020-10-26 28/week @ 2020-11-02 14/week @ 2020-11-09 17/week @ 2020-11-16 183/week @ 2020-11-23

146 downloads per month
Used in 4 crates

MIT license

17KB
247 lines

Linux Codecov
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.5"

Import and use:

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

tests

Note that the greeks don't have direct tests. Please feel free to add tests. However, these formulas are essentially and extensively tested in the fang oost option library.

Dependencies

~485KB
~10K SLoC