quantrs
Quantrs is a tiny quantitative finance library for Rust. It is designed to be simple and easy to use, with a focus on performance and correctness. It is still in the early stages of development, so expect bugs and breaking changes.
Please check out the documentation here.
Features
Options Pricing
For now quantrs only supports options pricing. The following features are available:
- Option types: European, American, 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
| Model | Black-Scholes | Binomial Tree | Monte Carlo Simulation |
|---|---|---|---|
| European Options | ✅ | ✅ | ⏳ |
| American Options | ❌ (not applicable) | ✅ | ⏳ |
| Binary Cash-or-Nothing | ✅ | ❌ | ❌ |
| Binary Asset-or-Nothing | ✅ | ❌ | ❌ |
| Greeks | ✅ | ⏳ | ⏳ |
| Implied Volatility | ✅ | ⏳ | ⏳ |
(✅ = Supported, ⏳ = Planned / In progress, ❌ = Not supported)
Usage
Add this to your Cargo.toml:
[]
= "0.1.3"
Now if you want to e.g., model binary call options using the Black-Scholes model, you can:
use *;
This will output:
Price: 0.8006934914644723
Greeks: OptionGreeks { delta: 0.013645840354947947, gamma: -0.0008813766475726433, theta: 0.17537248302290848, vega: -1.3749475702133236, rho: 0.4398346243436515 }
See the documentation for more information and examples.
Minimum supported Rust version (MSRV)
This crate requires a Rust version of 1.65.0 or higher. Increases in MSRV will be considered a semver non-breaking API change and require a version increase (PATCH until 1.0.0, MINOR after 1.0.0).
Outlook
Planned Features
- Data retrieval
- Yahoo Finance
- Alpha Vantage
- Quandl
- IEX Cloud
- Fixed income & IR
- Bond pricing
- Duration
- Convexity
- Yield curve
- Term structure
- Forward rates
- Interest rate models
- Time series analysis
- Moving averages
- Volatility
- Correlation
- Cointegration
- ARIMA
- GARCH
- Kalman filter
- Portfolio optimization
- Mean-variance optimization
- Black-Litterman model
- Risk parity
- Minimum variance
- Maximum diversification
Contributing
If you find any bugs or have suggestions for improvement, please open a new issue or submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE.md file for details.
© Carlo Bortolan
Carlo Bortolan · GitHub carlobortolan · contact via carlobortolan@gmail.com