Expand description
This crate is designed to be simple and easy to use library for options pricing, portfolio optimization, and risk analysis. It is not intended to be a full-fledged quantitative finance library. The goal is to provide library for pricing options, calculating greeks, and performing basic risk analysis without the need to write complex code or have a PhD in reading quantlib documentation. The library is still in the early stages of development, and many features are not yet implemented.
Compared to other popular options pricing libraries, quantrs is significantly faster:
- 29x faster than
QuantLib
(python bindings) - 113x faster than
py_vollib
- 15x faster than
RustQuant
- 2.7x faster than
Q-Fin
You can find the benchmarks at quantrs.pages.dev/report.
§Options Pricing
For now quantrs only supports options pricing. The following features are available:
- Option types: European, American, Asian, Rainbow, Binary Cash-or-Nothing, Binary Asset-or-Nothing
- Option pricing: Black-Scholes, Binomial Tree, Monte Carlo Simulation
- Greeks: Delta, Gamma, Theta, Vega, Rho
- Implied volatility
use quantrs::options::*;
let option = BinaryOption::cash_or_nothing(Instrument::new().with_spot(100.0), 85.0, 0.78, OptionType::Call);
let model = BlackScholesModel::new(0.05, 0.2);
let price = model.price(&option);
let greeks = Greeks::calculate(&model, &option);
Modules§
- options
- Module for calculating the price and Greeks of various types of options.
Macros§
- check_
is_ call - Check if the option is a call.
- check_
is_ put - Check if the option is a put.
- check_
same_ expiration_ date - Check if the options have the same expiration date.
- log_
debug - Log a debug message.
- log_
error - Log an error message.
- log_
info - Log an info message.
- log_
trace - Log a trace message.
- log_
warn - Log a warning message.
- range
- Return a range with a given step.
- square
- Calculate the square of a number.