Inspiration
This project was inspired by the challenge of optimizing portfolio performance while incorporating both market data and personal investment views. The idea came from the realization that modern investors, especially in the context of a hackathon, often need a tool that integrates both machine learning predictions and classic financial models for decision-making. We wanted to build something that balances a tech-savvy approach with traditional finance principles.
What it does
OptiFolio is a comprehensive portfolio optimization tool that combines ML with classic financial theories to assist users in constructing optimized portfolios. The tool allows users to input their risk tolerance, market views (both absolute and relative), and constraints (such as minimum and maximum allocations and trading costs). It does the following:
Predicts asset returns based on historical data for the next 30 days.
Implements Ledoit-Wolf shrinkage to estimate the covariance matrix of asset returns more robustly and with better stability, especially when dealing with large numbers of assets or noisy data.
Incorporates the Black-Litterman model to adjust for market equilibrium and personal views, allowing users to input views about assets or asset pairs (e.g., outperforming one asset over another).
Uses CVXPY to solve a quadratic optimization problem that balances risk and return, considering both the expected returns (from Black-Litterman and machine learning forecasts) and the portfolio’s risk (based on the estimated covariance matrix).
Analyzes how portfolio weights change as risk tolerance parameters are adjusted.
How we built it
During the development process, we earned a lot about the Black-Litterman model, how to incorporate statistical forecasting into portfolio optimization, and the technical challenges involved in handling financial data, especially with time-series forecasting. We used ARIMA to predict asset returns and combined that with the Black-Litterman model to adjust for market equilibrium versus my personal investment views.
Challenges we ran into
Building this project required integrating data from multiple sources, including Yahoo Finance, and working with complex mathematical models. The biggest challenge was handling the matrix inversion in the Black-Litterman approach and ensuring the integration of various risk and confidence parameters. We also had to overcome some initial difficulties with aligning the ML model outputs with the classical portfolio optimization.
Accomplishments that we're proud of
Integrating our ARIMA model with classical portfolio optimization techniques to create a hybrid optimization tool.
Developed a user-friendly interface with Streamlit, enabling dynamic user input for risk tolerance, asset views, and trading constraints.
The project is highly flexible, allowing users to experiment with different risk and return assumptions, asset selections, and view configurations.
What we learned
Through implementing Ledoit-Wolf shrinkage, we learned how to estimate the covariance matrix more effectively in cases of small datasets or when assets are highly correlated.
We also understood the math behind the Black-Litterman model from first principles. We incorporated both market equilibrium views and personal insights, which reinforced our knowledge Bayesian methods can be used to update our portfolio assumptions dynamically.
Using ARIMA for time-series forecasting taught us how to generate reliable return predictions for assets based on their historical price data. We also learned how to evaluate forecast accuracy and its impact on the overall portfolio optimization.
What's next for OptiFolio
Expanding forecasting capabilities by incorporating LSTMs (Long Short-Term Memory networks) to improve prediction accuracy.
Add features that allow users to simulate different market scenarios, like economic downturns or high-volatility periods, to assess how the portfolio would perform in those conditions.
Built With
- python
- streamlit
Log in or sign up for Devpost to join the conversation.