Hello everyone, this is my first post here and I'm coming to you all today with an idea that I had and questions to go along with it.
TL;DR I want to use the R programming language to drive portfolio decisions and I have most of a plan but little knowledge of the necessary resources to fully execute it so pls help.
My Goal
Use quantitative analysis to build optimal portfolios for both the short and long term. I will first use historical stock data to tune any models I build and test out long-term scenarios with the historical data. From that I hope to find the best metrics to use to drive purchasing/selling decisions and portfolio composition to minimize risk and maximize gain (I know that last part is obvious, but I'm still going to say it) and then apply what I built to real-time stocks.
My Plan
Model Building
- Data: to build my model I intend to download 20 years of historical stock data on every ticker that is available. I will use whichever financial metrics are included and calculate the rest.
- I will test out a variety of methods combining forecasting and machine learning to 1) choose which stocks to buy (and later, which ones to sell) 2) choose how much of a stock to buy and 3) choose the optimal portfolio. To choose the top performing method I am going to create 1,000 faux investment accounts with amounts that range from $100 to $1,000,000 as a baseline and train/test the models on each scenario for roughly 20 years of the historical data. I will compare the results of these scenarios and select the top performing models (if there is any advice on what might already be the best method feel free to let me know).
Real-World Testing
- Data: to continuously build upon the model I will download stock data every day and run it through my model to bring me to what decisions I should make.
- I'm risk-adverse, so, like in the Model Building phase, I am going to create a series of faux accounts of varying amounts and assess their performance over the course of the next year. Once I am confident in the results I will begin applying my model to my own portfolio.
Other Considerations
- I don't intend to day-trade. Though I will assess my portfolio daily, I will include minor tests that will help me decide whether to hold onto my portfolio or whether to adjust it more so on a weekly/monthly basis
- I will prioritize risk over reward (I have decades left until retirement)
- I intend to trust the numbers and not allow feelings to drive portfolio decisions
- I will periodically test my model's performance and adjust accordingly
Questions for the Community
- Best free websites to download aggregate historical/current stock data?
- Best models for forecasting stocks, portfolio composition? If anyone is familiar with R there are some packages that could be useful, but by no means have I looked through them all yet, so I'd gladly take advice there.
- Overall: has anyone built this before in a non-commercial setting? Is it feasible or even useful?
If this idea intrigues you, I am open to collaboration. I want to make this using completely free resources with the intent to share the end result after the initial testing as well as in its completed stage. If you aren't comfortable in R, I'm still open to collaboration from an idea standpoint. I do want to make this to help myself, but I want others to be able to gain from it as well.
Edit: I just learned about cross-posting so I will be posting this on other investing communities so I apologize if you see this more than once.
Submitted December 28, 2020 at 05:53PM by LateralPentose https://ift.tt/2M7n81e