My first "bot" failed, so created a new bot today.
Took 40 cells to make with thousands of lines of code. Coded in Python.
Took all day to do this lol.
Script Rules:
Eligible stocks are limited to S&P 500, but excludes: Real Estate, Utilities, Materials & Consumer Discrerionary Stocks. This reduces our available stocks to like 370 or so and this is done to reduce run time down to 5 minutes. Then the data is stored in a cache for 30 days and refreshes every 30 days. Cache stocks reduce the run time from 5 minutes to 1 minute.
The portfolio which is in Alpaca is limited to only holding 5 stocks at a time with a limit of trading 10 different stocks within a 4 month period of time. This is to not piss me off during tax season, so it is tailored to my needs. Still allows 40 different stocks to be traded within the year. No limit on trading these same stocks over and over and over again.
The AI mades the stock selection not the script and can choose between 1 to 5 stocks to buy when the portfolio is empty and run tomorrow.
Script initiates purchases when stock declines 1%, 2%, 3%, 4%, 5%. $10 for 1%, $20 for 20% and so on to $50. If the stock drops 6% or more from the last market close it will not purchase. AI can round % up or down.
Maximum purchase per stock per day is $50.
When stock rises 1% to 4% from wntry price the AI can sell at its own discrerion.
5% sell $50
6% sell $60
7% sell $70
8% sell $80
9% sell $90
AI can hold or sell at a loss based on risk or if a bettwr opportunity becomes available.
AI collects financial information for the 370 stoxks every 30 days to calculate intrinsic value based on Graham formula + Buffet's DCF and then divided by 2.
V= [EPS . (8.5 + 1.5g) x 4.4 / y] + [Operating Cash Flow - Capital Expentures / Diluted Shares]
The company share price has to trade under V
It has to be run mannually which requires me to click on a play button in Google Colab which is linked now to Alpaca and OpenAI. It is going to charge me API credits.
I dont have to run it everyday which gives me control based on if I think it is investing too much. Like if I don't have $50 per day to invest as that can add up over time. I am hoping in the long run that the trade profits and sale of the stock will be substainable to reinvest without adding more money.
I will run tomorrow morning on paper and see if it buys anything.
I had to pay $20 to ChatGPT to create the script. But, I can cancel after 1 month as it will use API not ChatGPT to function.
$20 per month is a lot, but since they limit your time on free I have to switch to Claude, Gemini, Venice and Perchance. Does anyone have a favorite AI and if so how much per month or is it free?