########
Examples
########

.. raw:: html

    <a href='https://ko-fi.com/B0B833SXD' target='_blank'><img height='36'style='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi1.png?v=2' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>

The following examples are available:

Return Risk Portfolio Optimization Models
-----------------------------------------
* `Mean Risk Portfolio Optimization using historical estimates <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%201.ipynb>`_.
* `Mean Risk Portfolio Optimization using custom estimates (mean and covariance) <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%206.ipynb>`_.
* `Ulcer Index Portfolio Optimization for Mean Risk and Risk Parity <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2014.ipynb>`_.
* `Entropic Value at Risk (EVaR) Portfolio Optimization for Mean Risk and Risk Parity <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2015.ipynb>`_.
* `Riskfolio-Lib with MOSEK for Real Applications (612 assets and 4943 observations) <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2017.ipynb>`_.
* `Entropic Drawdown at Risk (EDaR) Portfolio Optimization for Mean Risk and Risk Parity <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2019.ipynb>`_.
* `Logarithmic Mean Risk (Kelly Criterion) Portfolio Optimization <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2022.ipynb>`_.
* `Worst Case Mean Variance Portfolio Optimization using box and elliptical uncertainty sets <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2012.ipynb>`_.
* `Comparing Covariance Estimates Methods <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2034.ipynb>`_.
* `Gini Mean Difference (GMD) Portfolio Optimization for Mean Risk and Risk Parity <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2035.ipynb>`_.
* `Tail Gini Range Portfolio Optimization for Mean Risk and Risk Parity <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2036.ipynb>`_.
* `Ordered Weighted Averaging (OWA) Portfolio Optimization <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2037.ipynb>`_.


Special Constraints
-------------------
* `Index tracking/replicating portfolios <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%207.ipynb>`_.
* `Short and leveraged portfolios <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%208.ipynb>`_.
* `Portfolio Optimization with Constraints on Return and Risk Measures <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2021.ipynb>`_.
* `Portfolio Optimization with Dollar Neutral Constraint <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2023.ipynb>`_.
* `Portfolio Optimization with Constraints on Number of Assets and Number of Effective Assets <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2026.ipynb>`_.


Risk Factors Models
-------------------
* `Mean Risk Portfolio Optimization using risk factors models and stepwise regression <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%202.ipynb>`_.
* `Mean Risk Portfolio Optimization using risk factors models and principal component regression <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%209.ipynb>`_.
* `Fixed Income Portfolio Optimization and Immunization <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%204.ipynb>`_.
* `Vanilla Risk Parity Optimization using risk factors models and stepwise regression <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2011.ipynb>`_.


Black Litterman Models
----------------------
* `Mean Risk Portfolio Optimization using Black Litterman model <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%203.ipynb>`_.
* `Mean Risk Portfolio Optimization using Black Litterman with Factors model (Black Litterman Bayesian and Augmented Black Litterman) <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2020.ipynb>`_.


Risk Parity Models
-------------------
* `Vanilla Risk Parity Portfolio Optimization using historical estimates <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2010.ipynb>`_.
* `Relaxed Risk Parity Portfolio Optimization <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2032.ipynb>`_.
* `Risk Parity with Constraints using the Risk Budgeting Approach <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2033.ipynb>`_.


Hierarchical Clustering Portfolio Optimization
----------------------------------------------
* `Hierarchical Risk Parity (HRP) Portfolio Optimization <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2024.ipynb>`_.
* `Hierarchical Equal Risk Contribution (HERC) Portfolio Optimization <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2025.ipynb>`_.
* `Hierarchical Equal Risk Contribution with equally weights within clusters (HERC2) Portfolio Optimization <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2027.ipynb>`_.
* `Hierarchical Clustering and Networks <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2028.ipynb>`_.
* `Hierarchical Risk Parity with Constraints <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2029.ipynb>`_.
* `Nested Clustered Optimization (NCO) <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2030.ipynb>`_.
* `Hierarchical Portfolios with Custom Covariance <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2031.ipynb>`_.


Backtesting
-----------
* `Multi Assets Algorithmic Trading Backtesting with transaction cost and slippage using Backtrader <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%205.ipynb>`_ (matplotlib=3.2.2 for compatibility with backtrader=1.9.76.123).
* `Multi Assets Algorithmic Trading Backtesting with Vectorbt <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2018.ipynb>`_ (vectorbt=0.23.0).


Excel and Reporting
-------------------
* `Riskfolio-Lib and Xlwings <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2013.ipynb>`_.
* `Riskfolio-Lib Reports in Jupyter Notebook and Excel <https://nbviewer.jupyter.org/github/dcajasn/Riskfolio-Lib/blob/master/examples/Tutorial%2016.ipynb>`_.
