| Linux | Codecov | | :---------------: | :-------------------: | | ![lin-badge] | ![cov-badge] |

Fang-Oosterlee Option Pricing for Rust

Implements Fang-Oosterlee option pricing in Rust. Documentation is at docs.rs

Use

The crate is available on crates.io.

Import and use:

rust extern crate num_complex; use num_complex::Complex; extern crate fang_oost_option; use fang_oost_option::option_pricing; let num_u:usize = 256; let asset = 50.0; let strikes = vec![5000.0, 75.0, 50.0, 40.0, 0.03]; let rate = 0.03; let t_maturity = 0.5; let volatility:f64 = 0.3; //As an example, cf is standard diffusion let cf = |u: &Complex<f64>| { ((rate-volatility*volatility*0.5)*t_maturity*u+volatility*volatility*t_maturity*u*u*0.5).exp() }; let prices = option_pricing::fang_oost_call_price( num_u, asset, &strikes, rate, t_maturity, &cf );

Speed

The benchmarks are comparable to my C++ implementation. To run the tests with benchmarking, use cargo bench. You can see the benchmarks at https://phillyfan1138.github.io/fangoostoption_rust/report/index.html.