100% Accurate Stock Prediction Algorithm
title: “100% Accurate Stock Prediction Algorithm” date: 2023-01-22T11:58:31-07:00 draft: false ShowReadingTime: true tags: [projects] —
I created an algorithm that predicts daily stock movements with 100% accuracy. You can verify these predictions yourself by checking out my bot on X. While my bot is currently only running on SPY, I believe it can be generalized to any stock or even cryptocurrency.
I started this project because I wanted to learn how to use two API’s, Twitter and Alpaca. Alpaca is a brokerage with an API for programmatic trading.
Here’s the secret to the algorithm: hindsight is 20/20, hence the name 2020stockpicks. Once a day, my bot will make two predictions:
- The stock will go up.
- The stock will go down.
At the end of the day, my bot will check to see what direction the stock actually went and delete the prediction that was wrong.
You might think this is a useless algorithm since it takes both sides of the bet. However, it is actually quite simple to use this bot to build generational wealth. The steps you should follow are: Check my Twitter feed to see what direction the stock moved today. Go back to yesterday and place the appropriate trade.
Step 2 is left as an exercise to the reader. Follow me for more financial advice*.
*This is clearly not financial advice. Past performance does not guarantee future results. You should carefully consider if time travel is aligned with your personal investment strategies, goals, and risk tolerance.
How does the bot work
The algorithm the bot runs is simple. Therefore, we just need to handle a little bit of integration to make it work.
Pre-Requirements Set up a Twitter account for the bot and get access to the API(I followed this video). Set up an Alpaca account and get access to the API.
Requirements Once per day the bot should make a prediction for tomorrow’s stock movement. Two tweets are published. One stating that the stock will go up and one stating that the stock will go down. The IDs of these tweets are saved. (You could also use the twitter API to fetch the IDs at a later time instead of saving them) Once per day the bot should adjust the previous predictions to be correct. Use Alpaca’s API to fetch the open and close value of the stock to determine whether it moved up or down. Find the corresponding tweet id for the stock movement and delete it. E.g. if the stock moved down, find the tweet ID for the stock that predicted it would go up. Predictions should only be made for days the market is open. Use Alpaca’s API to determine what days the markets are open.
And that’s it. My only goal for this project was to build an introduction to the Twitter and Alpaca API’s and get a clickbait title out of it.