digifi/lib.rs
1//! # DigiFi
2//!
3//! `digifi` is a general purpose financial library and framework for financial modelling, portfolio optimization, and asset pricing. The purpose of
4//! this library is to provide basic functions and algorithms used in finance, but with enhanced memory safety, minimum number of dependencies and
5//! low computational requirements. `digifi` is composed of the following modules:
6//!
7//! - `utilities`: Generic utility functions including time-value calculators, mathematical functions, loss functions and numerical solvers.
8//! - `statistics`: Contains probability distributions (e.g., Normal, Binomial, Poisson) along with methods for computing covariance, skewness, kurtosis, and
9//! gamma and beta functions.
10//! - `random_generators`: Algorithms for generating pseudo-random numbers from uniform and normal distributions, along with the algorithms that connect
11//! with probability distributions through a polymorphism to allow generation of pseudo-random numbers from any defined distribution.
12//! - `stochastic_processes`: Stochastic processes for simulation of price action, and a builder of custom stochastic processes.
13//! - `financial_instruments`: Pricing of different financial instruments (e.g., bonds, stocks, options) and their utility functions.
14//! - `portfolio_applications`: Portfolio performance metrics, risk metrics, algorithm for optimizing portfolio of financial instruments for a given
15//! performance metric.
16//! - `lattice_models`: Binomial and trinomial models for pricing options (European, American and Bermudan) with any payoff (e.g., Call, Straddle).
17//! - `monte_carlo`: Function for pricing custom payoffs over any stochastic processes using Monte-Carlo simulations.
18//! - `corporate_finance`: Functions for valuation of investment projects, and CAPM.
19//! - `technical_indicators`: Trading indicators such as RSI, MACD, Bollinger Bands, etc.
20//! - `market_making`: Automated Market Making (AMM) algorithm for simulation of transactions in liquidity pools.
21//!
22//! # Disclaimer
23//!
24//! Note that the developers of this package do not accept any responsibility or liability for the accuracy or completeness of the code or the information provided.
25//!
26//! # Features
27//!
28//! The following optional features are provided by `digifi` (Note: none of these features are the enabled by default):
29//!
30//! - `sample_data`: Provides sample data to test CAPM and portfolio optimization algorithms.
31//! - `serde`: Provides serialization/deserialization for certain structs.
32//! - `plotly`: Provides functions for plotting results using `plotly` library.
33//!
34//! # Errors
35//!
36//! In general, the functions and methods inside `digifi` propagate errors so that the users can decide on the error handling techniques applicable to
37//! rtheir use case. However, for some numerical solutions closures are used which can panic at runtime.
38//!
39//! # Citations
40//!
41//! Some of the code and algorithms used are from external sources (aside from the dependencies of the library). Below is the list of the sources where
42//! the code extracts/algorithms were taken from, along with the purpose they serve in the library. We would like to express gratitude to the developers
43//! and academics who contributed to these projects.
44//!
45//! 1. Nelder-Mead Numerical Solver (<https://github.com/to266/optimize>): Only part of the `optimize` crate was used in the development of this library.
46//! Unfortunately, the crate itself is outdated, but it contains a really good implementation of the Nelder-Mead numerical solver. `optimize` is not a
47//! dependency to this library, but we have used an extract from its source code and slightly changed it to optimize it for our needs.
48//! Nonetheless, `optimize` is a great package and we hope there will be a renewed support for it.
49//! 2. Inverse CDF of Poisson Distribution (<https://people.maths.ox.ac.uk/gilesm/codes/poissinv/paper.pdf>): This paper covers the implementation of the
50//! method for approximating the inverse CDF of the Poisson distribution.
51//! 3. Algorithms for ln Gamma, ln Beta, Regularized Incomplete Beta and Inverse Regularized Incomplete Beta functions (<https://github.com/statrs-dev/statrs>): The implementation of these functions were taken from `statrs`.
52//!
53//! # General information
54//! If you would like to add a commit or an issue, please do so using the GitHub link to the project:
55//! - <https://github.com/Digital-Finance-DigiFi/digifi>
56
57
58pub mod consts;
59pub mod corporate_finance;
60pub mod error;
61pub mod financial_instruments;
62pub mod lattice_models;
63pub mod market_making;
64pub mod monte_carlo;
65pub mod portfolio_applications;
66pub mod random_generators;
67pub mod statistics;
68pub mod stochastic_processes;
69pub mod technical_indicators;
70pub mod utilities;
71
72
73// Plotly feature
74#[cfg(feature = "plotly")]
75pub mod plots;