diff --git a/docs/requirements.txt b/docs/requirements.txt
index d810c649..84af71f6 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -21,4 +21,6 @@ arch
XlsxWriter
networkx
astropy
-pybind11
\ No newline at end of file
+pybind11
+sphinx-immaterial
+fonttools>=4.43.0
\ No newline at end of file
diff --git a/docs/source/_static/Python_for_Finance_2025_I.pdf b/docs/source/_static/Python_for_Finance_2025_I.pdf
new file mode 100644
index 00000000..e9a8ca8f
Binary files /dev/null and b/docs/source/_static/Python_for_Finance_2025_I.pdf differ
diff --git a/docs/source/_static/Python_for_Finance_2025_II.pdf b/docs/source/_static/Python_for_Finance_2025_II.pdf
new file mode 100644
index 00000000..e95c4620
Binary files /dev/null and b/docs/source/_static/Python_for_Finance_2025_II.pdf differ
diff --git a/docs/source/_static/Python_for_Finance_2025_III.pdf b/docs/source/_static/Python_for_Finance_2025_III.pdf
new file mode 100644
index 00000000..557b6ebd
Binary files /dev/null and b/docs/source/_static/Python_for_Finance_2025_III.pdf differ
diff --git a/docs/source/_static/Riskfolio.ico b/docs/source/_static/Riskfolio.ico
new file mode 100644
index 00000000..57a0efd4
Binary files /dev/null and b/docs/source/_static/Riskfolio.ico differ
diff --git a/docs/source/_static/Riskfolio.png b/docs/source/_static/Riskfolio.png
new file mode 100644
index 00000000..ea6911bc
Binary files /dev/null and b/docs/source/_static/Riskfolio.png differ
diff --git a/docs/source/_static/custom.css b/docs/source/_static/custom.css
new file mode 100644
index 00000000..63fe827a
--- /dev/null
+++ b/docs/source/_static/custom.css
@@ -0,0 +1,12 @@
+header.md-header{
+ background-color: orange;
+ color: #FFF;
+}
+
+.md-text-color {
+ color: #666666; /* Custom primary font color */
+}
+
+.md-footer{
+ background: #666666;
+}
\ No newline at end of file
diff --git a/docs/source/biblio.bib b/docs/source/biblio.bib
index b3628c51..20ec7249 100755
--- a/docs/source/biblio.bib
+++ b/docs/source/biblio.bib
@@ -29,7 +29,7 @@ @article {Ledoit
@article{Ledoit2008,
author={Ledoit, Oliver and Wolf, Michael},
- title={{Robust performance hypothesis testing with the Sharpe ratio}},
+ title={Robust performance hypothesis testing with the Sharpe ratio},
journal={Journal of Empirical Finance},
year=2008,
volume={15},
@@ -84,20 +84,19 @@ @article{Resampling
}
@Article{Worst1,
-author="T{\"u}t{\"u}nc{\"u}, R.H.
-and Koenig, M.",
-title="Robust Asset Allocation",
-journal="Annals of Operations Research",
-year="2004",
-month="Nov",
-day="01",
-volume="132",
-number="1",
-pages="157--187",
-abstract="This article addresses the problem of finding an optimal allocation of funds among different asset classes in a robust manner when the estimates of the structure of returns are unreliable. Instead of point estimates used in classical mean-variance optimization, moments of returns are described using uncertainty sets that contain all, or most, of their possible realizations. The approach presented here takes a conservative viewpoint and identifies asset mixes that have the best worst-case behavior. Techniques for generating uncertainty sets from historical data are discussed and numerical results that illustrate the stability of robust optimal asset mixes are reported.",
-issn="1572-9338",
-doi="10.1023/B:ANOR.0000045281.41041.ed",
-url="https://doi.org/10.1023/B:ANOR.0000045281.41041.ed"
+author={T{\"u}t{\"u}nc{\"u}, R.H. and Koenig, M.},
+title={Robust Asset Allocation},
+journal={Annals of Operations Research},
+year={2004},
+month={Nov},
+day={01},
+volume={132},
+number={1},
+pages={157--187},
+abstract={This article addresses the problem of finding an optimal allocation of funds among different asset classes in a robust manner when the estimates of the structure of returns are unreliable. Instead of point estimates used in classical mean-variance optimization, moments of returns are described using uncertainty sets that contain all, or most, of their possible realizations. The approach presented here takes a conservative viewpoint and identifies asset mixes that have the best worst-case behavior. Techniques for generating uncertainty sets from historical data are discussed and numerical results that illustrate the stability of robust optimal asset mixes are reported.},
+issn={1572-9338},
+doi={10.1023/B:ANOR.0000045281.41041.ed},
+url={https://doi.org/10.1023/B:ANOR.0000045281.41041.ed}
}
@article{Black1,
@@ -246,7 +245,7 @@ @article{Santos
@Article{Hawawini,
author={Gabriel A. Hawawini},
- title={{The Intertemporal Cross Price Behavior of Common Stocks: Evidence and Implications}},
+ title={The Intertemporal Cross Price Behavior of Common Stocks: Evidence and Implications},
journal={Journal of Financial Research},
year=1980,
volume={3},
@@ -263,7 +262,7 @@ @Article{Hawawini
@TechReport{Ledoit2010,
author={Olivier Ledoit and Michael Wolf},
- title={{Robust performance hypothesis testing with the variance}},
+ title={Robust performance hypothesis testing with the variance},
year=2010,
month=Oct,
institution={Institute for Empirical Research in Economics - University of Zurich},
@@ -277,7 +276,7 @@ @TechReport{Ledoit2010
@TechReport{Ledoit2018,
author={Olivier Ledoit and Michael Wolf},
- title={{Robust performance hypothesis testing with smooth functions of population moments}},
+ title={Robust performance hypothesis testing with smooth functions of population moments},
year=2018,
month=Oct,
institution={Department of Economics - University of Zurich},
@@ -314,7 +313,7 @@ @article{Rockafellar
@InCollection{Uryasev1,
author={A. Chekhlov and S. Uryasev and M. Zabarankin},
editor={Panos M Pardalos and Athanasios Migdalas and George Baourakis},
- title={{Portfolio Optimization With Drawdown Constraints}},
+ title={Portfolio Optimization With Drawdown Constraints},
booktitle={{Supply Chain And Finance}},
publisher={World Scientific Publishing Co. Pte. Ltd.},
year=2004,
@@ -369,12 +368,6 @@ @article{Mansini3
doi = {10.1016/j.ejor.2013.08.035}
}
-@comment{
-
-Los que siguen son ejemplos de libros.
-
-}
-
@book{Knuth84,
Author = {Donald E. Knuth},
Publisher = {Addison-Wesley},
@@ -426,53 +419,6 @@ @book{Mansini
doi = {10.1007/978-3-319-18482-1}
}
-@comment{
-
-Ahora un ejemplo de un art'iculo publicado en un congreso. Nota tambi'en
-que, a'un cuando son varios autores, tienes que escribir *siempre* la
-palabra " and " entre cada par de ellos.
-
-}
-
-@inproceedings{Rofl06,
- Author = {Matthew Caesar and Tyson Condie and Jayanthkumar Kannan
- and Karthik Lakshminarayanan and Ion Stoica},
- Booktitle = {ACM SIGCOMM},
- Title = {{ROFL}: Routing on Flat Labels},
- Year = {2006}}
-
-@comment{
-
-Finalmente dos referencias a manuales.
-
-}
-
-@misc{Wolf,
-author = {Michael Wolf},
-title = {Publications},
-year = {2008},
-howpublished = {\url{https://www.econ.uzh.ch/en/people/faculty/wolf/publications.html}},
-urldate = {15-07-2019}
-}
-
-@manual{doc:natbib,
- Author = {Patrick W. Daly},
- Month = feb,
- Title = {Naural Sciences Citations and References},
- Year = {2007}}
-
-@manual{doc:geometry,
- Author = {Hideo Umeki},
- Month = jul,
- Title = {The geometry package},
- Year = {2002}}
-
-@comment{
-
-Referencias a tesis
-
-}
-
@mastersthesis{Graaf,
author = {T.A. de Graaf},
title = {Robust Mean-Variance Optimization},
@@ -824,10 +770,9 @@ @article{Prado2
author = {Prado, Marcos},
year = {2019},
month = {01},
-pages = {},
title = {A Robust Estimator of the Efficient Frontier},
journal = {SSRN Electronic Journal},
-doi = {10.2139/ssrn.3469961}
+doi = {10.2139/ssrn.3469961},
}
@article{jLogo,
@@ -852,7 +797,7 @@ @book{MLforAM
publisher={Cambridge University Press},
author={López de Prado, Marcos M.},
year={2020},
-collection={Elements in Quantitative Finance}
+collection={Elements in Quantitative Finance},
}
@article{Cajas3,
@@ -883,7 +828,7 @@ @article{Ogryczak2002
title = {Dual Stochastic Dominance and Quantile Risk Measures},
volume = {9},
journal = {International Transactions in Operational Research},
-doi = {10.1111/1475-3995.00380}
+doi = {10.1111/1475-3995.00380},
}
@article{Gerber2021,
@@ -893,7 +838,7 @@ @article{Gerber2021
publisher = {Elsevier {BV}},
author = {Sander Gerber and Harry Markowitz and Philip Ernst and Yinsen Miao and Babak Javid and Paul Sargen},
title = {The Gerber Statistic: A Robust Co-Movement Measure for Portfolio Optimization},
- journal = {SSRN Electronic Journal},
+ journal = {SSRN Electronic Journal},
}
@article{Cajas4,
@@ -929,7 +874,6 @@ @article{Cajas5
author = {Dany Cajas},
title = {Portfolio Optimization of Relativistic Value at Risk},
journal = {SSRN Electronic Journal},
- doi = {10.2139/ssrn.4378498},
}
@article{Cajas6,
@@ -984,7 +928,7 @@ @article{Cajas11
month = {12},
title = {A Graph Theory Approach to Portfolio Optimization Part II},
journal = {SSRN Electronic Journal},
-doi = {10.2139/ssrn.4667426},
+doi = {10.2139/ssrn.4540021},
}
@book{Meucci2005,
@@ -993,7 +937,7 @@ @book{Meucci2005
year = {2005},
publisher = {Springer Berlin Heidelberg},
author = {Attilio Meucci},
- title = {Risk and Asset Allocation}
+ title = {Risk and Asset Allocation},
}
@article{Feng2016,
@@ -1006,7 +950,7 @@ @article{Feng2016
pages = {1--231},
author = {Yiyong Feng and Daniel P. Palomar},
title = {A Signal Processing Perspective of Financial Engineering},
- journal = {Foundations and Trends{\textregistered} in Signal Processing}
+ journal = {Foundations and Trends{\textregistered} in Signal Processing},
}
@article{Jorion1986,
@@ -1014,26 +958,26 @@ @article{Jorion1986
url = {https://doi.org/10.2307/2331042},
year = {1986},
month = sep,
- publisher = {{JSTOR}},
+ publisher = {JSTOR},
volume = {21},
number = {3},
pages = {279},
author = {Philippe Jorion},
title = {Bayes-Stein Estimation for Portfolio Analysis},
- journal = {The Journal of Financial and Quantitative Analysis}
+ journal = {The Journal of Financial and Quantitative Analysis},
}
@article{Bodnar2019,
doi = {10.1016/j.jmva.2018.07.004},
url = {https://doi.org/10.1016\%2Fj.jmva.2018.07.004},
- year = 2019,
- month = {mar},
+ year = {2019},
+ month = {03},
publisher = {Elsevier {BV}},
volume = {170},
pages = {63--79},
author = {Taras Bodnar and Ostap Okhrin and Nestor Parolya},
title = {Optimal shrinkage estimator for high-dimensional mean vector},
- journal = {Journal of Multivariate Analysis}
+ journal = {Journal of Multivariate Analysis},
}
@article{Ojeda2015,
@@ -1046,9 +990,18 @@ @article{Ojeda2015
pages = {60},
author = {Ignacio Ojeda},
title = {Kronecker Square Roots and the Block Vec Matrix},
- journal = {The American Mathematical Monthly}
+ journal = {The American Mathematical Monthly},
}
+@mastersthesis{Yang2019,
+ author = {Yang, Mingyu},
+ title = {Uncertainty Set Sizes, Sensitivity Analysis, in Robust Portfolio Optimization},
+ school = {University of Waterloo},
+ year = 2019,
+ url={https://www.math.uwaterloo.ca/~hwolkowi/henry/reports/MingyuYangCM-eresearchpaper-printcopy.pdf},
+}
+
+
@Inbook{VanLoan1993,
author={Van Loan, C. F. and Pitsianis, N.},
editor={Moonen, Marc S. and Golub, Gene H. and De Moor, Bart L. R.},
@@ -1060,15 +1013,7 @@ @Inbook{VanLoan1993
pages={293--314},
isbn={978-94-015-8196-7},
doi={10.1007/978-94-015-8196-7\_17},
-url={https://doi.org/10.1007/978-94-015-8196-7\_17}
-}
-
-@mastersthesis{Yang2019,
-title={Uncertainty Set Sizes, Sensitivity Analysis, in Robust Portfolio Optimization},
-author={Yang, Mingyu},
-year={2019}
-school={University of Waterloo},
-url={https://www.math.uwaterloo.ca/~hwolkowi/henry/reports/MingyuYangCM-eresearchpaper-printcopy.pdf},
+url={https://doi.org/10.1007/978-94-015-8196-7\_17},
}
@article{Tutuncu2004,
@@ -1089,14 +1034,13 @@ @article{ElGhaoui2003
number = {4},
year = {2003},
pages = {543--556},
- publisher = {INFORMS}
+ publisher = {INFORMS},
}
- @article{Roncalli2012b,
+@article{Roncalli2012b,
author = {Roncalli, Thierry and Weisang, Guillaume},
year = {2012},
month = {09},
-pages = {},
title = {Risk Parity Portfolios with Risk Factors},
volume = {16},
journal = {SSRN Electronic Journal},
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 039892ed..b00eac02 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -14,6 +14,8 @@
import sys
import sphinx_rtd_theme
+import riskfolio as rp
+
sys.path.insert(0, os.path.abspath('../..'))
sys.path.insert(1, os.path.abspath('../../riskfolio'))
sys.path.insert(2, os.path.abspath('../../riskfolio/src'))
@@ -25,13 +27,9 @@
copyright = '2020-2024, Dany Cajas'
author = 'Dany Cajas'
-__version__ = "6.3.1"
# The short X.Y version
-version = '.'.join(__version__.split('.')[:2])
-# The full version, including alpha/beta/rc tags
-release = __version__
-
+release = '.'.join(rp.__version__.split('.')[:2])
# -- General configuration ---------------------------------------------------
@@ -55,6 +53,7 @@
'sphinx.ext.napoleon',
'sphinxcontrib.bibtex',
'sphinxemoji.sphinxemoji',
+ 'sphinx_immaterial',
]
autodoc_mock_imports = ["riskfolio.external.functions"]
@@ -84,7 +83,8 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
-html_theme = 'sphinx_rtd_theme'
+html_title = f"{project} {release}"
+html_theme = 'sphinx_immaterial'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
@@ -92,6 +92,30 @@
html_static_path = ['_static']
html_search_language = 'en'
+html_theme_options = {
+ "palette": { "scheme": "default"},
+ "icon": {"repo": "fontawesome/brands/github"},
+ "site_url": "https://riskfolio-lib.readthedocs.io/en/latest",
+ "repo_url": "https://github.com/dcajasn/Riskfolio-Lib",
+ "repo_name": "Riskfolio-Lib",
+ "globaltoc_collapse": True,
+ "toc_title": "Contents",
+ "toc_title_is_page_title": True,
+ "social": [
+ {
+ "icon": "fontawesome/brands/github",
+ "link": "https://github.com/dcajasn/Riskfolio-Lib",
+ "name": "Source on github.com",
+ },
+ {
+ "icon": "fontawesome/brands/python",
+ "link": "https://pypi.org/project/Riskfolio-Lib/",
+ },
+ ],}
+html_static_path = ["_static"]
+html_css_files = ["custom.css"]
+html_favicon = "_static/Riskfolio.ico"
+html_logo = "_static/Riskfolio.png"
# -- Extension configuration -------------------------------------------------
diff --git a/docs/source/constraints.rst b/docs/source/constraints.rst
index fba8c14f..70b73afe 100644
--- a/docs/source/constraints.rst
+++ b/docs/source/constraints.rst
@@ -19,11 +19,11 @@ of the portfolio to a specific risk factor. These functions transform all
constraint to the form :math:`Aw \geq B`.
This module have a function that help us to create relative and absolute views for the Black
-Litterman model. This views can consider relationships among assets and asset classes. This
+Litterman model :cite:`e-BlackLitterman`. This views can consider relationships among assets and asset classes. This
function transform all views to the form :math:`Pw = Q`.
-This module also have functions to create constraints based on graph information like the
-information obtained from networks and dendrograms.
+This module also have functions to create constraints based on graph information :cite:`e-Cajas10` :cite:`e-Cajas11`
+like the information obtained from networks and dendrograms.
Module Functions
================
@@ -31,3 +31,11 @@ Module Functions
.. automodule:: ConstraintsFunctions
:members:
:private-members:
+
+Bibliography
+============
+
+.. bibliography:: biblio.bib
+ :style: unsrt
+ :labelprefix: E
+ :keyprefix: e-
diff --git a/docs/source/course.rst b/docs/source/course.rst
new file mode 100644
index 00000000..f2228323
--- /dev/null
+++ b/docs/source/course.rst
@@ -0,0 +1,348 @@
+###########################################
+Portfolio Optimization with Python Course
+###########################################
+
+Motivation
+===========
+
+Since its release in March 2nd, 2020; Riskfolio-Lib has become one of the most popular
+Portfolio Optimization Python libraries worldwide. However, a large percentage of users
+encounter difficulties when using Riskfolio-Lib because they have not had adequate training in
+mathematical optimization or mathematical programming.
+
+**It is important to mention that this course helps to fund the continuous development and maintenance
+of Riskfolio-Lib due to it is a personal open-source project that is not financed for any institution
+like other popular Python projects.**
+
+Objective
+===========
+
+The objective of the course is to provide the student with the computational tools that allow them
+to design asset allocation strategies using the most modern portfolio optimization techniques that
+would be very complicated using a spreadsheet or a traditional programming language.
+
+Student Profile
+===============
+
+Professionals in the areas of finance, investments, risk management; who wish to improve their
+skills in portfolio optimization. It is recommended that the students have basic to intermediate
+knowledge of portfolio theory, optimization, calculus, linear algebra and statistics; and intermediate
+to advance knowledge of one programming language (Python, R, Julia, Rust, C, C++, VBA, VB.net,
+Matlab or similar).
+
+Courses Schedule for 2025
+=========================
+
+The live classes are online through Google Meets (all classes will be recorded and uploaded to the
+google classroom of the course).
+The duration of the course is 39 hours and classes are hold on Saturday and Sunday from 10a.m. to. 1p.m. (UTC-5).
+
+In the following table you can see the dates of the courses that will be taught in 2025:
+
+.. raw:: html
+
+
+
+
+
+Enrollment
+==========
+
+To enroll in the course, you need an email with an explicit "@gmail.com" domain (for example johnmarlon@gmail.com)
+and then pay the course fee using the following PayPal link:
+
+.. raw:: html
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+If you wish to register in a group of 4 or more, a 10% discount applies, for which you must send us an
+email to orenji.eirl@gmail.com with the information of all the students (full name, city of residence
+and an email with explicit '@gmail.com' domain) in order to send you the
+PayPal invoice with the discount.
+
+Course Content
+===============
+
+The detailed content of the course follows below:
+
+.. raw:: html
+
+
+
+
+
+
+
Topics
+
Hours
+
+
+
+
+
Main Libraries
+
+
+
+
Numpy: Linear Algebra
+
2
+
+
+
Pandas: Dataframes
+
1
+
+
+
Scipy: Statistical Functions and Linear Algebra
+
1
+
+
+
Montecarlo and Quasimontecarlo Simulation for Portfolio Optimization
Second Order Cone Programming (Standard Deviation)
+
1.5
+
+
+
Semidefinite Programming (Variance, Kurtosis and Approximate Kurtosis)
+
3
+
+
+
Exponential Cone Programming (Entropic Value at Risk)
+
1
+
+
+
Power Cone Programming (Relativistic Value at Risk)
+
1
+
+
+
Convex Fractional Programming (Risk Adjusted Return Ratio Optimization)
+
1
+
+
+
Mean Risk Optimization
+
2
+
+
+
Risk Parity Optimization (Least Squares and Risk Budgeting approaches)
+
2
+
+
+
Worst Case Optimization (Box and Elliptical Uncertainty Sets)
+
2
+
+
+
Integer Programming for Portfolio Optimization
+
+
+
+
Value at Risk Optimization
+
1
+
+
+
Integer Constraints (Cardinality on Assets and Classes, and Buy in threshold constraints)
+
1
+
+
+
Convex Fractional Programming with Integer Variables
+
1
+
+
+
Risk Parity Optimization for Long Short Portfolios
+
1
+
+
+
Machine Learning for Portfolio Optimization
+
+
+
+
Hierarchical Risk Parity
+
2
+
+
+
Hierarchical Equal Risk Contribution
+
1
+
+
+
Nested Clustered Optimization
+
1
+
+
+
Graph Theory for Portfolio Optimization
+
+
+
+
Centrality Measures Constraints (Average Connectivity of Graphs)
+
1
+
+
+
Network Constraints (Relative Positions on Graphs)
+
1
+
+
+
Clusters Constraints (Clusters based on Dendrogram)
+
1
+
+
+
Backtesting of Portfolio Optimization Strategies
+
+
+
+
The Walk Forward Method (Rolling and Expanding Window)
+
2
+
+
+
The Cross-Validation Method
+
1
+
+
+
The Combinatorial Purged Cross-Validation Method
+
1
+
+
+
Total
+
39
+
+
+
\ No newline at end of file
diff --git a/docs/source/images/.DS_Store b/docs/source/images/.DS_Store
index c7d73752..8f7c3d47 100644
Binary files a/docs/source/images/.DS_Store and b/docs/source/images/.DS_Store differ
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 96b055f2..e3c03817 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -51,145 +51,145 @@ investment portfolios based on mathematically complex models with low effort. It
Some of key functionalities that Riskfolio-Lib offers:
-- Mean Risk and Logarithmic Mean Risk (Kelly Criterion) Portfolio Optimization with 4 objective functions:
+* Mean Risk and Logarithmic Mean Risk (Kelly Criterion) Portfolio Optimization with 4 objective functions:
- - Minimum Risk.
- - Maximum Return.
- - Maximum Utility Function.
- - Maximum Risk Adjusted Return Ratio.
+ * Minimum Risk.
+ * Maximum Return.
+ * Maximum Utility Function.
+ * Maximum Risk Adjusted Return Ratio.
-- Mean Risk and Logarithmic Mean Risk (Kelly Criterion) Portfolio Optimization with 22 convex risk measures:
+* Mean Risk and Logarithmic Mean Risk (Kelly Criterion) Portfolio Optimization with 22 convex risk measures:
**Dispersion Risk Measures:**
- - Standard Deviation.
- - Square Root Kurtosis.
- - Mean Absolute Deviation (MAD).
- - Gini Mean Difference (GMD).
- - Conditional Value at Risk Range.
- - Tail Gini Range.
- - Range.
+ * Standard Deviation.
+ * Square Root Kurtosis.
+ * Mean Absolute Deviation (MAD).
+ * Gini Mean Difference (GMD).
+ * Conditional Value at Risk Range.
+ * Tail Gini Range.
+ * Range.
**Downside Risk Measures:**
- - Semi Standard Deviation.
- - Square Root Semi Kurtosis.
- - First Lower Partial Moment (Omega Ratio).
- - Second Lower Partial Moment (Sortino Ratio).
- - Conditional Value at Risk (CVaR).
- - Tail Gini.
- - Entropic Value at Risk (EVaR).
- - Relativistic Value at Risk (RLVaR).
- - Worst Realization (Minimax).
+ * Semi Standard Deviation.
+ * Square Root Semi Kurtosis.
+ * First Lower Partial Moment (Omega Ratio).
+ * Second Lower Partial Moment (Sortino Ratio).
+ * Conditional Value at Risk (CVaR).
+ * Tail Gini.
+ * Entropic Value at Risk (EVaR).
+ * Relativistic Value at Risk (RLVaR).
+ * Worst Realization (Minimax).
**Drawdown Risk Measures:**
- - Average Drawdown for uncompounded cumulative returns.
- - Ulcer Index for uncompounded cumulative returns.
- - Conditional Drawdown at Risk (CDaR) for uncompounded cumulative returns.
- - Entropic Drawdown at Risk (EDaR) for uncompounded cumulative returns.
- - Relativistic Drawdown at Risk (RLDaR) for uncompounded cumulative returns.
- - Maximum Drawdown (Calmar Ratio) for uncompounded cumulative returns.
+ * Average Drawdown for uncompounded cumulative returns.
+ * Ulcer Index for uncompounded cumulative returns.
+ * Conditional Drawdown at Risk (CDaR) for uncompounded cumulative returns.
+ * Entropic Drawdown at Risk (EDaR) for uncompounded cumulative returns.
+ * Relativistic Drawdown at Risk (RLDaR) for uncompounded cumulative returns.
+ * Maximum Drawdown (Calmar Ratio) for uncompounded cumulative returns.
-- Risk Parity Portfolio Optimization with 18 convex risk measures:
+* Risk Parity Portfolio Optimization with 18 convex risk measures:
**Dispersion Risk Measures:**
- - Standard Deviation.
- - Square Root Kurtosis.
- - Mean Absolute Deviation (MAD).
- - Gini Mean Difference (GMD).
- - Conditional Value at Risk Range.
- - Tail Gini Range.
+ * Standard Deviation.
+ * Square Root Kurtosis.
+ * Mean Absolute Deviation (MAD).
+ * Gini Mean Difference (GMD).
+ * Conditional Value at Risk Range.
+ * Tail Gini Range.
**Downside Risk Measures:**
- - Semi Standard Deviation.
- - Square Root Semi Kurtosis.
- - First Lower Partial Moment (Omega Ratio)
- - Second Lower Partial Moment (Sortino Ratio)
- - Conditional Value at Risk (CVaR).
- - Tail Gini.
- - Entropic Value at Risk (EVaR).
- - Relativistic Value at Risk (RLVaR).
+ * Semi Standard Deviation.
+ * Square Root Semi Kurtosis.
+ * First Lower Partial Moment (Omega Ratio)
+ * Second Lower Partial Moment (Sortino Ratio)
+ * Conditional Value at Risk (CVaR).
+ * Tail Gini.
+ * Entropic Value at Risk (EVaR).
+ * Relativistic Value at Risk (RLVaR).
**Drawdown Risk Measures:**
- - Ulcer Index for uncompounded cumulative returns.
- - Conditional Drawdown at Risk (CDaR) for uncompounded cumulative returns.
- - Entropic Drawdown at Risk (EDaR) for uncompounded cumulative returns.
- - Relativistic Drawdown at Risk (RLDaR) for uncompounded cumulative returns.
+ * Ulcer Index for uncompounded cumulative returns.
+ * Conditional Drawdown at Risk (CDaR) for uncompounded cumulative returns.
+ * Entropic Drawdown at Risk (EDaR) for uncompounded cumulative returns.
+ * Relativistic Drawdown at Risk (RLDaR) for uncompounded cumulative returns.
-- Hierarchical Clustering Portfolio Optimization: Hierarchical Risk Parity (HRP) and Hierarchical Equal Risk Contribution (HERC) with 32 risk measures using naive risk parity:
+* Hierarchical Clustering Portfolio Optimization: Hierarchical Risk Parity (HRP) and Hierarchical Equal Risk Contribution (HERC) with 32 risk measures using naive risk parity:
**Dispersion Risk Measures:**
- - Standard Deviation.
- - Variance.
- - Square Root Kurtosis.
- - Mean Absolute Deviation (MAD).
- - Gini Mean Difference (GMD).
- - Conditional Value at Risk Range.
- - Tail Gini Range.
- - Range.
+ * Standard Deviation.
+ * Variance.
+ * Square Root Kurtosis.
+ * Mean Absolute Deviation (MAD).
+ * Gini Mean Difference (GMD).
+ * Conditional Value at Risk Range.
+ * Tail Gini Range.
+ * Range.
**Downside Risk Measures:**
- - Semi Standard Deviation.
- - Square Root Semi Kurtosis.
- - First Lower Partial Moment (Omega Ratio).
- - Second Lower Partial Moment (Sortino Ratio).
- - Value at Risk (VaR).
- - Conditional Value at Risk (CVaR).
- - Entropic Value at Risk (EVaR).
- - Relativistic Value at Risk (RLVaR).
- - Tail Gini.
- - Worst Case Realization (Minimax).
+ * Semi Standard Deviation.
+ * Square Root Semi Kurtosis.
+ * First Lower Partial Moment (Omega Ratio).
+ * Second Lower Partial Moment (Sortino Ratio).
+ * Value at Risk (VaR).
+ * Conditional Value at Risk (CVaR).
+ * Entropic Value at Risk (EVaR).
+ * Relativistic Value at Risk (RLVaR).
+ * Tail Gini.
+ * Worst Case Realization (Minimax).
**Drawdown Risk Measures:**
- - Average Drawdown for compounded and uncompounded cumulative returns.
- - Ulcer Index for compounded and uncompounded cumulative returns.
- - Drawdown at Risk (DaR) for compounded and uncompounded cumulative returns.
- - Conditional Drawdown at Risk (CDaR) for compounded and uncompounded cumulative returns.
- - Entropic Drawdown at Risk (EDaR) for compounded and uncompounded cumulative returns.
- - Relativistic Drawdown at Risk (RLDaR) for compounded and uncompounded cumulative returns.
- - Maximum Drawdown (Calmar Ratio) for compounded and uncompounded cumulative returns.
-
-- Nested Clustered Optimization (NCO) with four objective functions and the available risk measures to each objective:
-
- - Minimum Risk.
- - Maximum Return.
- - Maximum Utility Function.
- - Equal Risk Contribution.
-
-- Worst Case Mean Variance Portfolio Optimization.
-- Relaxed Risk Parity Portfolio Optimization.
-- Ordered Weighted Averaging (OWA) Portfolio Optimization.
-- Portfolio optimization with Black Litterman model.
-- Portfolio optimization with Risk Factors model.
-- Portfolio optimization with Black Litterman Bayesian model.
-- Portfolio optimization with Augmented Black Litterman model.
-- Portfolio optimization with constraints on tracking error and turnover.
-- Portfolio optimization with short positions and leveraged portfolios.
-- Portfolio optimization with constraints on number of assets and number of effective assets.
-- Portfolio optimization with constraints based on graph information.
-- Tools to build efficient frontier for 22 convex risk measures.
-- Tools to build linear constraints on assets, asset classes and risk factors.
-- Tools to build views on assets and asset classes.
-- Tools to build views on risk factors.
-- Tools to build risk contribution constraints per asset classes.
-- Tools to build risk contribution constraints per risk factor using explicit risk factors and principal components.
-- Tools to build bounds constraints for Hierarchical Clustering Portfolios.
-- Tools to calculate risk measures.
-- Tools to calculate risk contributions per asset.
-- Tools to calculate risk contributions per risk factor.
-- Tools to calculate uncertainty sets for mean vector and covariance matrix.
-- Tools to calculate assets clusters based on codependence metrics.
-- Tools to estimate loadings matrix (Stepwise Regression and Principal Components Regression).
-- Tools to visualizing portfolio properties and risk measures.
-- Tools to build reports on Jupyter Notebook and Excel.
-- Option to use commercial optimization solver like MOSEK or GUROBI for large scale problems.
+ * Average Drawdown for compounded and uncompounded cumulative returns.
+ * Ulcer Index for compounded and uncompounded cumulative returns.
+ * Drawdown at Risk (DaR) for compounded and uncompounded cumulative returns.
+ * Conditional Drawdown at Risk (CDaR) for compounded and uncompounded cumulative returns.
+ * Entropic Drawdown at Risk (EDaR) for compounded and uncompounded cumulative returns.
+ * Relativistic Drawdown at Risk (RLDaR) for compounded and uncompounded cumulative returns.
+ * Maximum Drawdown (Calmar Ratio) for compounded and uncompounded cumulative returns.
+
+* Nested Clustered Optimization (NCO) with four objective functions and the available risk measures to each objective:
+
+ * Minimum Risk.
+ * Maximum Return.
+ * Maximum Utility Function.
+ * Equal Risk Contribution.
+
+* Worst Case Mean Variance Portfolio Optimization.
+* Relaxed Risk Parity Portfolio Optimization.
+* Ordered Weighted Averaging (OWA) Portfolio Optimization.
+* Portfolio optimization with Black Litterman model.
+* Portfolio optimization with Risk Factors model.
+* Portfolio optimization with Black Litterman Bayesian model.
+* Portfolio optimization with Augmented Black Litterman model.
+* Portfolio optimization with constraints on tracking error and turnover.
+* Portfolio optimization with short positions and leveraged portfolios.
+* Portfolio optimization with constraints on number of assets and number of effective assets.
+* Portfolio optimization with constraints based on graph information.
+* Tools to build efficient frontier for 22 convex risk measures.
+* Tools to build linear constraints on assets, asset classes and risk factors.
+* Tools to build views on assets and asset classes.
+* Tools to build views on risk factors.
+* Tools to build risk contribution constraints per asset classes.
+* Tools to build risk contribution constraints per risk factor using explicit risk factors and principal components.
+* Tools to build bounds constraints for Hierarchical Clustering Portfolios.
+* Tools to calculate risk measures.
+* Tools to calculate risk contributions per asset.
+* Tools to calculate risk contributions per risk factor.
+* Tools to calculate uncertainty sets for mean vector and covariance matrix.
+* Tools to calculate assets clusters based on codependence metrics.
+* Tools to estimate loadings matrix (Stepwise Regression and Principal Components Regression).
+* Tools to visualizing portfolio properties and risk measures.
+* Tools to build reports on Jupyter Notebook and Excel.
+* Option to use commercial optimization solver like MOSEK or GUROBI for large scale problems.
Choosing a Solver
@@ -200,69 +200,248 @@ The list of solvers compatible with CVXPY is available in `Choosing a solver
+
+
+
+
+
Risk Measure
+
LP
+
QP
+
SOCP
+
SDP
+
EXP
+
POW
+
+
+
+
+
Variance (MV)
+
+
+
X
+
X*
+
+
+
+
+
Mean Absolute Deviation (MAD)
+
X
+
+
+
+
+
+
+
+
Gini Mean Difference (GMD)
+
+
+
+
+
+
X**
+
+
+
Semi Variance (MSV)
+
+
+
X
+
+
+
+
+
+
Kurtosis (KT)
+
+
+
+
X
+
+
+
+
+
Semi Kurtosis (SKT)
+
+
+
+
X
+
+
+
+
+
First Lower Partial Moment (FLPM)
+
X
+
+
+
+
+
+
+
+
Second Lower Partial Moment (SLPM)
+
+
+
X
+
+
+
+
+
+
Conditional Value at Risk (CVaR)
+
X
+
+
+
+
+
+
+
+
Tail Gini (TG)
+
+
+
+
+
+
X**
+
+
+
Entropic Value at Risk (EVaR)
+
+
+
+
+
X
+
+
+
+
Relativistic Value at Risk (RLVaR)
+
+
+
+
+
+
X**
+
+
+
Worst Realization (WR)
+
X
+
+
+
+
+
+
+
+
CVaR Range (CVRG)
+
X
+
+
+
+
+
+
+
+
Tail Gini Range (TGRG)
+
+
+
+
+
+
X**
+
+
+
Range (RG)
+
X
+
+
+
+
+
+
+
+
Average Drawdown (ADD)
+
X
+
+
+
+
+
+
+
+
Ulcer Index (UCI)
+
+
+
X
+
+
+
+
+
+
Conditional Drawdown at Risk (CDaR)
+
X
+
+
+
+
+
+
+
+
Entropic Drawdown at Risk (EDaR)
+
+
+
+
+
X
+
+
+
+
Relativistic Drawdown at Risk (RLDaR)
+
+
+
+
+
+
X**
+
+
+
Maximum Drawdown (MDD)
+
X
+
+
+
+
+
+
+
+
(*) When SDP graph theory constraints are included. In the case of integer programming graph theory constraints, the model assume the SOCP formulation.
(**) For these models is highly recommended to use MOSEK as solver, due to in some cases CLARABEL cannot find a solution and SCS takes too much time to solve them.
-LP - Linear Programming refers to problems with a linear objective function and linear constraints.
+LP: Linear Programming refers to problems with a linear objective function and linear constraints.
-QP - Quadratic Programming refers to problems with a quadratic objective function and linear constraints.
+QP: Quadratic Programming refers to problems with a quadratic objective function and linear constraints.
-SOCP - Second Order Cone Programming refers to problems with second-order cone constraints.
+SOCP: Second Order Cone Programming refers to problems with second-order cone constraints.
-SDP - Semidefinite Programming refers to problems with positive semidefinite constraints.
+SDP: Semidefinite Programming refers to problems with positive semidefinite constraints.
-EXP - refers to problems with exponential cone constraints.
+EXP:refers to problems with exponential cone constraints.
-POW - refers to problems with 3-dimensional power cone constraints.
+POW: refers to problems with 3-dimensional power cone constraints.
Consulting Fees
@@ -270,26 +449,26 @@ Consulting Fees
Riskfolio-Lib is an open-source project, however due it's a project that is not financed for any institution, I started charging for consultancies that are not related to errors in source code. Our fees are as follows:
-- $ 25 USD (United States Dollars) per question that doesn't require to check code.
+* $ 25 USD (United States Dollars) per question that doesn't require to check code.
-- $ 50 USD to check a small size script or code (less than 200 lines of code). The fee of the solution depends on the complexity of the solution:
- - $ 50 USD for simple errors in scripts (modify less than 10 lines of code).
- - For most complex errors the fee depends on the complexity of the solution but the fee is $ 150 USD per hour.
+* $ 50 USD to check a small size script or code (less than 200 lines of code). The fee of the solution depends on the complexity of the solution:
+ * $ 50 USD for simple errors in scripts (modify less than 10 lines of code).
+ * For most complex errors the fee depends on the complexity of the solution but the fee is $ 150 USD per hour.
-- $ 100 USD to check a medium size script or code (between 201 and 600 lines of code). The fee of the solution depends on the complexity of the solution:
- - $ 50 USD for simple errors in scripts (modify less than 10 lines of code).
- - For most complex errors the fee depends on the complexity of the solution but the fee is $ 150 USD per hour.
+* $ 100 USD to check a medium size script or code (between 201 and 600 lines of code). The fee of the solution depends on the complexity of the solution:
+ * $ 50 USD for simple errors in scripts (modify less than 10 lines of code).
+ * For most complex errors the fee depends on the complexity of the solution but the fee is $ 150 USD per hour.
-- For large size script or code (more than 600 lines of code) the fee is variable depending on the size of the code. The fee of the solution depends on the complexity of the solution:
- - $ 50 USD for simple errors in scripts (modify less than 10 lines of code).
- - For most complex errors the fee depends on the complexity of the solution but the fee is $ 150 USD per hour.
+* For large size script or code (more than 600 lines of code) the fee is variable depending on the size of the code. The fee of the solution depends on the complexity of the solution:
+ * $ 50 USD for simple errors in scripts (modify less than 10 lines of code).
+ * For most complex errors the fee depends on the complexity of the solution but the fee is $ 150 USD per hour.
**All consulting must be paid in advance**.
You can contact me through:
-- `LinkedIn `
-- `Gmail `
+* `LinkedIn `
+* `Gmail `
You can pay using one of the following channels:
@@ -322,6 +501,7 @@ Contents
:maxdepth: 1
Install
+ Portfolio Course
Riskfolio-XL
Portfolio Models
Hierarchical Clustering Models
@@ -341,9 +521,9 @@ Contents
Indices and tables
==================
-- :ref:`genindex`
-- :ref:`modindex`
-- :ref:`search`
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
Module Plans
@@ -352,4 +532,4 @@ Module Plans
The plan for this library is to add more functions that will be very useful
for students, academics and practitioners.
-- Add more functions based on suggestion of users.
+* Add more functions based on suggestion of users.
diff --git a/riskfolio/src/ConstraintsFunctions.py b/riskfolio/src/ConstraintsFunctions.py
index acb5c290..ae22c599 100644
--- a/riskfolio/src/ConstraintsFunctions.py
+++ b/riskfolio/src/ConstraintsFunctions.py
@@ -1117,7 +1117,7 @@ def connection_matrix(
gs_threshold=0.5,
):
r"""
- Create a connection matrix of walks of a specific size based on :cite:`e-Cajas10` formula..
+ Create a connection matrix of walks of a specific size based on :cite:`e-Cajas10` formula.
Parameters
----------
diff --git a/riskfolio/src/GerberStatistic.py b/riskfolio/src/GerberStatistic.py
index 3aaf6b36..eac90634 100644
--- a/riskfolio/src/GerberStatistic.py
+++ b/riskfolio/src/GerberStatistic.py
@@ -20,7 +20,7 @@
def gerber_cov_stat0(X, threshold=0.5):
r"""
Compute Gerber covariance Statistics 0 or original Gerber statistics
- :cite: `d-Gerber2021`, not always PSD, however this function fixes the
+ :cite:`d-Gerber2021`, not always PSD, however this function fixes the
covariance matrix finding the nearest covariance matrix that is positive
semidefinite.
@@ -98,7 +98,7 @@ def gerber_cov_stat0(X, threshold=0.5):
def gerber_cov_stat1(X, threshold=0.5):
r"""
- Compute Gerber covariance Statistics 1 :cite: `d-Gerber2021`.
+ Compute Gerber covariance Statistics 1 :cite:`d-Gerber2021`.
Parameters
----------
@@ -177,7 +177,7 @@ def gerber_cov_stat1(X, threshold=0.5):
def gerber_cov_stat2(X, threshold=0.5):
r"""
- Compute Gerber covariance Statistics 2 :cite: `d-Gerber2021`.
+ Compute Gerber covariance Statistics 2 :cite:`d-Gerber2021`.
Parameters
----------
diff --git a/riskfolio/src/HCPortfolio.py b/riskfolio/src/HCPortfolio.py
index 95d8fa2c..c83288ce 100644
--- a/riskfolio/src/HCPortfolio.py
+++ b/riskfolio/src/HCPortfolio.py
@@ -781,9 +781,9 @@ def optimization(
- 'hist': use historical estimator.
- 'ewma1': use ewma with adjust=True. For more information see `EWM `_.
- 'ewma2': use ewma with adjust=False. For more information see `EWM `_.
- - 'JS': James-Stein estimator. For more information see :cite:`b-Meucci2005` and :cite:`b-Feng2016`.
- - 'BS': Bayes-Stein estimator. For more information see :cite:`b-Jorion1986`.
- - 'BOP': BOP estimator. For more information see :cite:`b-Bodnar2019`.
+ - 'JS': James-Stein estimator. For more information see :cite:`c-Meucci2005` and :cite:`c-Feng2016`.
+ - 'BS': Bayes-Stein estimator. For more information see :cite:`c-Jorion1986`.
+ - 'BOP': BOP estimator. For more information see :cite:`c-Bodnar2019`.
- 'custom_mu': use custom expected returns vector.
method_cov : str, optional
diff --git a/riskfolio/src/Portfolio.py b/riskfolio/src/Portfolio.py
index 6cf14f89..2c4b8390 100644
--- a/riskfolio/src/Portfolio.py
+++ b/riskfolio/src/Portfolio.py
@@ -2752,7 +2752,7 @@ def rp_optimization(
r"""
This method that calculates the risk parity portfolio using the risk
budgeting approach :cite:`a-Roncalli` :cite:`a-RichardRoncalli` and
- the risk parity with risk factors approach :cite:`Roncalli2012b`
+ the risk parity with risk factors approach :cite:`a-Roncalli2012b`
according to the optimization model selected by the user. The general
problem that solves is: