11 releases

0.5.0 Feb 5, 2022
0.4.0 Mar 2, 2019
0.3.6 Jan 12, 2019
0.3.4 Aug 19, 2018
0.1.0 Aug 16, 2018

#171 in Finance

37 downloads per month
Used in hull_white

MIT license

17KB
291 lines

[lin-badge]: https://github.com/danielhstahl/binomial_tree_rust/workflows/Rust/badge.svg [cov-badge]: https://codecov.io/gh/danielhstahl/binomial_tree_rust/branch/master/graph/badge.svg

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

Binomial Tree Option Calculator

This is a very generic binomial tree calculator. The calculator can be used to price American and European style options for any payoff and any single dimensional SDE of the form dS=alpha(S, t)dt+sigma(S, t)dW_t.

Requires 4 functions:

  • The ratio of drift over volatility: (alpha(S, t)/sigma(S, t))
  • The derivative of sigma with respect to the underlying: sigma'(S, t)
  • The discount factor
  • The payoff function

To demonstrate the flexibility, the tests compute the Black Scholes model price and a bond price under a CIR process.

Speed

This library takes roughly .4 seconds compared to .7 seconds for my C++ library for a 5000 step European call option. Benchmarks at https://danielhstahl.github.io/binomial_tree_rust/report/index.html.

No runtime deps