ronniec95 / black_scholes

A SIMD based black scholes pricer using the http://crates.io/wide crate
https://mushfaqueronniechowdhury.medium.com/probably-the-fastest-black-scholes-pricer-in-world-34103e97f7eb
64 stars 7 forks source link
math-functions option-pricing simd

SIMD Black scholes pricer

Probably the fastest black scholes pricer in the world.

This tries to be correct for all black scholes calculations including accounting for dividends and american binomial options Tested against widely known pricers for accuracy

Contains

* call
* put
* delta
* rho
* gamma
* theta
* vega
* implied_vol from price
* implied_rho from price
* strike from delta
* american put

SIMD

As a thought experiment I used this to see what performance I could eeek out of a i5 6th gen laptop compared to the the naive calculation

For 10,000,000 calls to bs_single::call()

with RUST_FLAGS=-C -target_feature=+avx,+fma

With the SIMD version with RUST_FLAGS=-C -target_feature=+avx,+fma, without Wide math functions

with RUST_FLAGS=-C -target_feature=+avx,+fma, with Wide math functions

So around 18x speed up when written with careful CPU consideration

License

GNU AGPL-3.0-or-later; see AGPL-v3.