This project implements and compares dynamic portfolio optimization methods for allocating wealth between risky and a risk-free asset over multiple periods. It explores both analytical and approximate solutions under different investor utility functions, including log and CRRA utilities.
- Objective: Determine optimal portfolio weights over a finite investment horizon in the presence of uncertainty.
- Frameworks Used:
- Monte Carlo simulation
- Convex optimization via CVXPY
- Approximate Dynamic Programming (ADP)
- Key Features:
- Exact dynamic programming with log utility and multi-asset convex optimization
- Approximate dynamic programming with a single risky asset, CRRA utility, and cubic interpolation
- Wealth grid construction and policy extraction
- The market is assumed to be frictionless, with no transaction costs, slippage, or liquidity constraints.
- Risk-free and risky assets are perfectly divisible.
dynamicPortfolioAllocation.py
: Core module with reusable functions for:- Return simulation
- Optimal portfolio computation
- Value function approximation
dynamic_portfolio_allocation.ipynb
: Jupyter notebook demonstrating:- Examples of portfolio allocation under various scenarios
- Visualizations of value functions and optimal policies
- Comparison between exact and approximate solutions
- Demonstrates how optimal asset allocations change over time and across wealth levels.
- Highlights the performance of approximate dynamic programming versus exact methods.
- Offers a blueprint for extending the ADP to multi-asset, multi-period portfolio problems.
If you use this code in your work, please cite this repository:
https://github.com/ramiuness/dynamic-portfolio-allocation
This project is licensed under the MIT License. See the LICENSE file for details.