AI-Driven Stock Investment Strategy Development
Budget: $250 – $750 CAD
You are an expert Data Analytics in a large financial investment company. The company management would like to launch an AI stock investment strategy product.
Some of the competing investment management firms have already launched AI products. The market pressure is mounting to deliver your own version.
You think that the historical data on stocks should reveal patterns of successful indicators that predict the high-performing, or “winning”, portfolios. Big data may reveal what works in the stock market.
As the first step, a large historical data set is constructed. The data set consists of stock returns and many company features driven from financial accounts such as valuation ratios, profitability ratios etc.
Data collection is already done. There are a number of points to decide upon initially:
• Data files are downloaded from different sources. They need to be merged/cleaned/organised.
• What are the particular issues related to ‘cross-sectional, time-series’ data?
Step 1:
Organize the data set, prepare the variables for standard ML algorithms. Make sure the data set is organised and prepared (scaling, normalization, cleaning, etc. done) after a careful Exploratory Data Analysis(EDA) process.
The details of the analysis of the model and the related code are to be decided via team discussion. You are free take executive decisions to select variables to drop from the data set if you do not see much use or value for the ML analysis.
Project aim is to forecast the set of stocks that are likely to be the best (and worst) FUTURE 3-Month performers at a point in time based on their features measured and recorded prior to the observed stock returns. If the model is able to pick the FUTURE WINNERS and avoid the FUTURE LOSERS, then the portfolio will outperform the other possible portfolios that are constructed with a passive decision (i.e., hold all stocks in equal weight, or buy the largest market-cap stocks).
By using the historical data available at a point in time, the model should forecast the WINNERS of the next 3-months, and an equal-weighted portfolio can be created with the predicted WINNERS.
Analogy: If the stock returns in each time interval is assumed to be the results of a horse race, the objective is to find an ML model to predict the winning horses by using the information available prior to the horse race. The historical data set allows to Train the models and Test them to check the prediction success achieved in the past.
As a part of the required output, model has to demonstrate the performance of the ML-driven stock picking strategy with a back-test. That is to show the historical success of selected method as an investment strategy to answer the following: If someone had actually used our ML methods to construct portfolios in the past with the information that was available back then, and repeated the prediction process over time for many “horse races” what would be the performance?
Target Variable: Forward 3-Month return WINNERS (best performing stocks in the next 3-month period)
Features: Financial Ratios, Past Returns, Sector or Industry Group etc. available in the provided data sets
Questions to discuss and answer:
How to define the WINNERS and/or LOSERS at each period? (Rank them?)
How to design the prediction model? Is this a Classification problem or a Regression problem?
How to select TRAIN, TEST and VALIDATION sets? Should a moving-window approach be used?
Are there redundant features that can be discarded? How to decide which ones?
Step 2:
• Run selected ML method(s) to identify the features that have the greatest importance (and significance) to predict future returns.
• Present the results of the selected ML approach along with a description of your method.
• How do results change when different train-test samples are used? Run selected ML procedure over moving windows of time (such as moving 3-year window for the training sample, and subsequent period for the test sample).
• Do the “useful features” change over time with the moving sub-samples? Show how the set of “important features” (if any) change over moving-window samples. Show if there are any consistently useful features to predict the future Winner and Loser stock groups.
• Are there any features that could be proposed to use consistently for the new AI-driven product? Are the ML model results statistically or economically convincing? Briefly explain.
Step 3:
Create an animated chart and/or dynamic dashboard that show the changes in features importance as your Train-Test sample moves over time. (The results of the moving-window model fitting.
How is feature importance measured? Which method is more useful or more interpretable in this case?
Explore the details of methods such as Shapley Value, LIME (Local Interpretable Model-Agnostic Explanations), Partial Dependence Plots (PDP), Breakdown.
Create a teaching note on commonly used Feature Importance measures and their use cases.
Step 4.
Show the stock portfolio of stocks held based on selected ML-based model forecasts by the end of 2023. Which stocks would be selected (Top 50 [or 40] Predicted Winners) to be in the portfolio by 2023-December?
Assume you created an equal-weighted portfolio of Forecasted Top 50 [or 40] Winner Stocks in 2023-Dec. Collect the stock price/return data for the 2024-Jan to 2024-Mar period and show how your portfolio has performed compared to a market benchmark index. What would be the over/under-performance in the first quarter of 2024?
Step 5.
Apply a different AI strategy.
(i) Ask GPT what to buy among your stock universe by the end of 2023 based on the information available by the end of 2023. See how GPT’s portfolio would have performed relative to your ML-based portfolio and relative to the market benchmark in the first 3 months of 2024.
(ii) Repeat (i) for the portfolios constructed by the end of 2022.
Make sure to record your GPT prompts and the responses that you used for portfolio construction.
Based on (i, ii) who wins? GPT, or selected ML model?
Do you think LLMs can help with portfolio strategy? Why or why not?
----------------------------------
A simple example of preliminary GPT prompt for Step 5:
“I will give you a list of stock tickers. Make a guess or a forecast about the percent return of these stocks over the next 3 months by suggesting a predictive model or by creating a story to justify your stock preferences. Use the latest data, news and information. Suggest a portfolio of 4 stocks based on your model and/or story. Here are the tickers: AMZN, MSFT, XOM, JJ, C, JPM, PFE, AA, K, HD, NVDIA, TSLA”
…..
“Now, assume you have information and historical data only and only up to 2022-January. You do not know anything beyond the calendar year of 2022. Eliminate all information that is dated beyond the year 2022. What would be your portfolio decision then?
Try similar prompts and variants for your stock universe. Use different iterations, back-and-forth prompt conversations to decide on the useful form of prompting the LLM model.
Data:
https://1drv.ms/x/s!Aj89N01PTfKFb9CB5nYcUvLgOhw?e=ou0U1p
https://1drv.ms/x/s!Aj89N01PTfKFbj1gz2jfHnIv5MA?e=2CIWKr
Some of the competing investment management firms have already launched AI products. The market pressure is mounting to deliver your own version.
You think that the historical data on stocks should reveal patterns of successful indicators that predict the high-performing, or “winning”, portfolios. Big data may reveal what works in the stock market.
As the first step, a large historical data set is constructed. The data set consists of stock returns and many company features driven from financial accounts such as valuation ratios, profitability ratios etc.
Data collection is already done. There are a number of points to decide upon initially:
• Data files are downloaded from different sources. They need to be merged/cleaned/organised.
• What are the particular issues related to ‘cross-sectional, time-series’ data?
Step 1:
Organize the data set, prepare the variables for standard ML algorithms. Make sure the data set is organised and prepared (scaling, normalization, cleaning, etc. done) after a careful Exploratory Data Analysis(EDA) process.
The details of the analysis of the model and the related code are to be decided via team discussion. You are free take executive decisions to select variables to drop from the data set if you do not see much use or value for the ML analysis.
Project aim is to forecast the set of stocks that are likely to be the best (and worst) FUTURE 3-Month performers at a point in time based on their features measured and recorded prior to the observed stock returns. If the model is able to pick the FUTURE WINNERS and avoid the FUTURE LOSERS, then the portfolio will outperform the other possible portfolios that are constructed with a passive decision (i.e., hold all stocks in equal weight, or buy the largest market-cap stocks).
By using the historical data available at a point in time, the model should forecast the WINNERS of the next 3-months, and an equal-weighted portfolio can be created with the predicted WINNERS.
Analogy: If the stock returns in each time interval is assumed to be the results of a horse race, the objective is to find an ML model to predict the winning horses by using the information available prior to the horse race. The historical data set allows to Train the models and Test them to check the prediction success achieved in the past.
As a part of the required output, model has to demonstrate the performance of the ML-driven stock picking strategy with a back-test. That is to show the historical success of selected method as an investment strategy to answer the following: If someone had actually used our ML methods to construct portfolios in the past with the information that was available back then, and repeated the prediction process over time for many “horse races” what would be the performance?
Target Variable: Forward 3-Month return WINNERS (best performing stocks in the next 3-month period)
Features: Financial Ratios, Past Returns, Sector or Industry Group etc. available in the provided data sets
Questions to discuss and answer:
How to define the WINNERS and/or LOSERS at each period? (Rank them?)
How to design the prediction model? Is this a Classification problem or a Regression problem?
How to select TRAIN, TEST and VALIDATION sets? Should a moving-window approach be used?
Are there redundant features that can be discarded? How to decide which ones?
Step 2:
• Run selected ML method(s) to identify the features that have the greatest importance (and significance) to predict future returns.
• Present the results of the selected ML approach along with a description of your method.
• How do results change when different train-test samples are used? Run selected ML procedure over moving windows of time (such as moving 3-year window for the training sample, and subsequent period for the test sample).
• Do the “useful features” change over time with the moving sub-samples? Show how the set of “important features” (if any) change over moving-window samples. Show if there are any consistently useful features to predict the future Winner and Loser stock groups.
• Are there any features that could be proposed to use consistently for the new AI-driven product? Are the ML model results statistically or economically convincing? Briefly explain.
Step 3:
Create an animated chart and/or dynamic dashboard that show the changes in features importance as your Train-Test sample moves over time. (The results of the moving-window model fitting.
How is feature importance measured? Which method is more useful or more interpretable in this case?
Explore the details of methods such as Shapley Value, LIME (Local Interpretable Model-Agnostic Explanations), Partial Dependence Plots (PDP), Breakdown.
Create a teaching note on commonly used Feature Importance measures and their use cases.
Step 4.
Show the stock portfolio of stocks held based on selected ML-based model forecasts by the end of 2023. Which stocks would be selected (Top 50 [or 40] Predicted Winners) to be in the portfolio by 2023-December?
Assume you created an equal-weighted portfolio of Forecasted Top 50 [or 40] Winner Stocks in 2023-Dec. Collect the stock price/return data for the 2024-Jan to 2024-Mar period and show how your portfolio has performed compared to a market benchmark index. What would be the over/under-performance in the first quarter of 2024?
Step 5.
Apply a different AI strategy.
(i) Ask GPT what to buy among your stock universe by the end of 2023 based on the information available by the end of 2023. See how GPT’s portfolio would have performed relative to your ML-based portfolio and relative to the market benchmark in the first 3 months of 2024.
(ii) Repeat (i) for the portfolios constructed by the end of 2022.
Make sure to record your GPT prompts and the responses that you used for portfolio construction.
Based on (i, ii) who wins? GPT, or selected ML model?
Do you think LLMs can help with portfolio strategy? Why or why not?
----------------------------------
A simple example of preliminary GPT prompt for Step 5:
“I will give you a list of stock tickers. Make a guess or a forecast about the percent return of these stocks over the next 3 months by suggesting a predictive model or by creating a story to justify your stock preferences. Use the latest data, news and information. Suggest a portfolio of 4 stocks based on your model and/or story. Here are the tickers: AMZN, MSFT, XOM, JJ, C, JPM, PFE, AA, K, HD, NVDIA, TSLA”
…..
“Now, assume you have information and historical data only and only up to 2022-January. You do not know anything beyond the calendar year of 2022. Eliminate all information that is dated beyond the year 2022. What would be your portfolio decision then?
Try similar prompts and variants for your stock universe. Use different iterations, back-and-forth prompt conversations to decide on the useful form of prompting the LLM model.
Data:
https://1drv.ms/x/s!Aj89N01PTfKFb9CB5nYcUvLgOhw?e=ou0U1p
https://1drv.ms/x/s!Aj89N01PTfKFbj1gz2jfHnIv5MA?e=2CIWKr