Is there an ideal strategy for mom-and-pop investors to trade stocks effectively and maximize profit while managing risk? This project explores this question by analyzing stock data and proposing a strategy based on Joel Greenblatt's Magic Formula. The aim is to evaluate the risk and return of this strategy and articulate the benefits and drawbacks in an accessible manner for those without the technical know-how and possibly turn this into a data product. Additionally, we explore the potential of turning this analysis into a valuable data product for individual investors.
Using data from financial modeling prep's API, transformed and stored in Snowflake, this project employs a Python script to fetch, analyze, and visualize stock performance over the last six years. The data fetched is then transformed within snowflake to use its compute, which can scale for a data product. The core of our strategy revolves around selecting the top-ranked companies each quarter based on their return on capital and earnings yield, a proxy for Greenblatt's Magic Formula. Go to file thematic_investment.ipynb as it contains the main logic proposing a solution.
- Data Acquisition and Transformation: Leveraged Snowflake for data storage and manipulation, ensuring a robust and scalable data pipeline. This could further be automated using Airflow or Astronomer to automate and run daily to get updated data from FMP's API!
- Universe Selection: Employed a quantitative approach to filter and rank companies based on financial metrics, focusing on a universe of stocks that offer the best potential for returns. As such we have taken all the S&P 500 companies that ever existed in the last 6 years reducing the Survivorship Bias.
- Strategy Measurement: Analyzed the returns using key financial metrics such as Sharpe ratio, Returns, Max Drawdown,etc to assess performance and risk.
- Quarterly Rebalancing: Despite the complex statistical techniques, the project emphasizes simplicity and accessibility, making it easier for mom-and-pop investors to understand and apply the findings. It creates a way for them to rebalance once every quarter and invest in the top 30 companies in the strategy outputs.
The strategy, inspired by Greenblatt's Magic Formula, showcases an annualized return that outperforms the market benchmark, indicating its potential effectiveness for individual investors. Risk metrics, including volatility and max drawdown, provide a comprehensive view of the strategy's risk profile, suggesting a higher risk-reward ratio. You can see the returns vs S&P 500 for the backtest period. Click here for the graph
Metric | Value |
---|---|
Annualized Return(%) | 18.802107 |
Absolute Returns(%) | 193.528921 |
Sharpe Ratio | 0.725566 |
Max Drawdown(%) | -28.251780 |
Volatility(%) | 23.1572 |
Backtest (Years) | 6 |
The thematic investment strategy offers a promising avenue for mom-and-pop investors, combining sound financial principles with accessible data science techniques. Future enhancements could include integrating machine learning models to refine stock selection and improve risk-adjusted returns.
- Critical Thinking: Demonstrated through a thorough analysis of the problem and a data-driven approach to strategy formulation.
- Statistical/First Principles Modeling: Applied appropriate statistical methods to support hypotheses and understand the underlying economic phenomena.
- Coding Skills: Showcased efficient and modularized code, focusing on scalability and performance.
Transforming this thematic investment strategy analysis into a data product involves creating a user-friendly platform that provides actionable insights to mom-and-pop investors. Here's how this could be achieved:
-
Interactive Web Application: Develop a web-based platform where users can easily access the strategy's performance, current stock rankings, and personalized investment recommendations based on the other fundamental and technical investment themes. This could be easily done using Streamlit for a POC and simple apps, but can also use React front end frameworks to build a cool investment app that links to the broker. One way to link and place orders directly is through Alpaca's API. You can find the documentation here - https://docs.alpaca.markets/docs/getting-started
-
Other Datasets: We have prepared a dataset that contains information on fundamental ratios and technical indicators, but this could easily be used to expand on other datasets and is just scratching the surface. You can find other datasets available through FMP's API - https://site.financialmodelingprep.com/developer/docs
-
Customizable Portfolio Simulation: Offer tools that allow users to simulate how their investment would perform under this strategy, including risk assessment and potential returns. This feature could include sliders for adjusting investment amounts, risk tolerance, and other relevant parameters.
-
Real-time Data Integration: Implement real-time data feeds to ensure the stock rankings and recommendations are always up to date. This feature would require robust backend infrastructure to process data efficiently and deliver timely insights.
-
Educational Resources: To make the strategy accessible to those without a data science background, include educational content that explains the underlying principles, how to interpret the analytics, and the rationale behind the stock selections.
-
User Engagement and Feedback Loop: Incorporate mechanisms for user feedback and engagement, such as forums, Q&A sections, and customer support. This feedback loop will be crucial for iterating on the product and ensuring it meets the needs of its users.
-
Mobile App: Expand the platform's reach by developing a mobile application that provides notifications on portfolio updates, market news, and personalized investment tips. This would ensure users can stay informed on the go.
-
Subscription Model for Advanced Features: While offering basic features for free, a subscription model could be introduced for advanced analytics, personalized consultations, and detailed portfolio strategies. This approach allows for scaling the product while providing significant value to serious investors.
By focusing on user experience, accessibility, and real-time insights, this thematic investment strategy can be transformed into a valuable data product that empowers mom-and-pop investors to make informed decisions, manage risk effectively, and achieve their investment goals.
We hope this project inspires investors to explore quantitative strategies and leverage data science for better investment decisions. Happy investing! ✨