Options Trading with GPT4o Price Predictions
I don't advise anyone to do this.
This was done as an experiment.
I'm not a financial expert.
This is not advice.
In the highly unlikely event profits are made, 100% will be donated to the American Red Cross for tornado relief.
Now that that the formalities are out of the way, let me show you how I created price predictions for Home Depot (HD) using GPT4o.
How LLMs Work
As any recipe, on any site, there's a bit of frustrating upfront info that helps understand the ingredients. This will will be 50k foot in 5 sentences.
LLMs are simply autocomplete on steroids. Like major meathead steroids.
If you give the prompt "I Like" it's the LLMs job to guess what comes next.
That's literally it. They just do this on a MASSIVE scale with TONs and data which makes them so good. (I stole that diagram from here, it's a great read)
Choosing a Stock
Now that we're LLM experts the next thing is the stock choice.
I was inspired to do this experiment by stumbling upon finance heads talk about stock market impact of the recent tornadoes in the Midwest.
Awful events truly, if you'd like to donate to help you can do so here with the American Red Cross. ALL profits made from this experiment will be donated.
As an amateur home improver I make plenty of trips to Home Depot and seeing the wreckage left in the tornadoes wake, a pessimistic(?) thought crossed my mind that Home Depot stock would surely get a bump right?
I mean, people are going to need to repair the damage and granted that the local Home Depot wasn't destroyed as well, they should have a bump in revenue. Seems sensible.
To get a second opinion I went to ChatGPT 4o.
PROMPT:
What companies see a boost in profit during tornadoes in the Midwest of the us?
GPT4o RESPONSE:
During tornadoes in the Midwest of the U.S., certain industries and companies typically see a boost in profits due to increased demand for their products and services. Here are some of the key sectors and examples of companies that might experience a financial uptick:
1. Construction and Home Repair:
- Home Depot and Lowe's often see increased sales as homeowners repair and rebuild damaged properties.
- Local construction companies and contractors experience higher demand for their services.
2. Insurance:
- State Farm, Allstate, and other insurance companies may see increased activity. While they face higher payouts for claims, they often adjust premiums and policies, which can result in higher future profits.
3. Building Materials:
- Companies like USG Corporation (drywall and building materials) and Owens Corning (roofing and insulation) benefit from the increased need for reconstruction materials.
4. Emergency and Disaster Relief:
- Generac (portable generators) often sees a spike in sales.
- Companies providing disaster relief and emergency supplies also experience higher demand.
5. Automotive:
- Automotive repair shops and parts suppliers, such as O'Reilly Auto Parts and AutoZone, benefit from an increase in vehicle repairs due to storm damage.
6. Retail and Grocery:
- Stores like Walmart and Target may see a surge in sales of emergency supplies, food, and water.
7. Utilities and Energy:
- Companies providing repair and maintenance services for utilities, such as Quanta Services, experience increased demand as they work to restore power and other services.
8. Waste Management:
- Companies like Waste Management and Republic Services see increased demand for debris removal and cleanup services.
These sectors and companies typically see short-term boosts in profits due to the immediate needs following tornado events.
PROMPT:
what stocks would have the highest gains based on this logic
GPT4o RESPONSE:
Based on the sectors and companies that typically see increased demand and profits during tornado events in the Midwest, the following stocks might experience the highest gains:
1. Home Improvement Retailers:
- Home Depot (HD)
- Lowe's (LOW)
2. Building Materials:
- Owens Corning (OC)
- USG Corporation (acquired by Knauf)
3. Construction and Engineering:
- Masco Corporation (MAS)
- Quanta Services (PWR)
4. Insurance:
- State Farm (private company, not publicly traded)
- Allstate Corporation (ALL)
- Progressive Corporation (PGR)
5. Emergency Power and Equipment:
- Generac Holdings (GNRC)
6. Automotive Parts and Repair:
- O'Reilly Automotive (ORLY)
- AutoZone (AZO)
7. Waste Management:
- Waste Management, Inc. (WM)
- Republic Services, Inc. (RSG)
8. Retail and Grocery:
- Walmart Inc. (WMT)
- Target Corporation (TGT)
9. Utilities and Energy Services:
- NextEra Energy (NEE)
- Duke Energy (DUK)
These companies are likely to experience higher sales and profits due to increased demand for their products and services following tornado events, which could lead to stock price gains. However, it's important to consider overall market conditions, company fundamentals, and other factors before making investment decisions.
PROMPT:
if you had to pick 3 stocks which would yield the highest return in a three month period to win a game. What stocks would you pick?
GPT4o RESPONSE:
If I had to pick three stocks that might yield the highest return in a three-month period following tornadoes in the Midwest, I would focus on companies that typically see immediate and significant demand spikes. Based on historical trends and the nature of these events, my picks would be:
1. Generac Holdings (GNRC): Rationale: Generac produces portable generators, which see a surge in demand immediately following natural disasters. The company's products are essential for emergency power, making it a prime candidate for short-term gains.
2. Home Depot (HD): Rationale: As one of the largest home improvement retailers, Home Depot benefits from increased sales of building materials, tools, and supplies needed for repairs and reconstruction. The immediate need for home repairs can drive a quick uptick in their sales and stock price.
3. Owens Corning (OC): Rationale: Owens Corning specializes in roofing, insulation, and other building materials. These products are in high demand for repairing and rebuilding damaged homes and buildings, making it likely to experience a short-term boost in sales and stock price.
These selections are based on the assumption that the companies will see a quick and substantial increase in demand for their products and services following tornado events, which could translate into higher stock prices over a three-month period.
GREAT! Approval from GPT4o.
So now we have our stock, Home Depot (HD).
Getting the Data
Next we need some data. While LLMs and specifically GPT4o can go out and fetch data I wanted to make sure I knew where it was coming from.
I ended up using 4 data sets in total:
reason being is that I started with smaller data sets in STOCK_5 and WEATHER_5 then expanded to the larger data sets.
Why you ask??? they're the data sets I found first, no scientific reason other than laziness.
With work ethic in mind, the goal is to correlate these two by doing AS LITTLE work as possible. Like minimal. Near zero.
Historical Stock Price Data
I took the stock price data all the way back to 05/28/14 (shouts NASDAQ). You can find it here. ( STOCK_5, STOCK_ALL )
Historical Weather Data
This was a bit more tricky to get. The first data set I found was a little meh and not very robust. I actually closed out the tab so not even sure where it came from but you can find my copy here. (WEATHER_5)
The second set I found was amazing (shouts kaggle and Michael Bryant ). You can find it here. (WEATHER_ALL)
All in all it took me about 20min of searching to get the historical data I wanted to correlate from 2014 to 2021. the better weather data only went to 2021 :(
Data Correlation
Now that we have our data we want to see if there are any correlations between stocks price and weather related events.
(These prompts are all in the same context window as what we did above)
PROMPT
Lets focus on Home Depot (HD). I'm attaching two files. The first is named "HD Stock Price Data" which contains historical stock prices for Home Depot. The file has 6 columns titles: Date, Close/Last, Volume, Open, High, Low.
I'm attaching a second file named "Storm Events" which has a list of weather related events causing housing damage in the United States. It has three columns titled: Date, Location, Event. Can you correlate weather related events from the file "Storm Events" to stock price changes in "HD Stock Price Data".
Lets do this step by step.
The response here is super long so I'll tldr; it for you:
GPT4o RESPONSE:
Step 1: Data Preparation
Step 2: Convert Dates to Datetime Format and Calculate Stock Price Changes
Step 3: Handle Non-Standard Dates
Step 4: Exclude Non-Standard Date Entries and Convert Remaining Dates
Step 5: Ensure Data Type Consistency and Reapply Calculations
Step 6: Correct Tool Import and Review Data
Step 7: Analysis of the Correlation
To further analyze the correlation, we can:
Aggregate the Data:
Calculate the average percentage change in stock price for different event types.
Visualize the Data:
Create a visualization to show the distribution of stock price changes associated with different weather events.
In GPT-4o you can also see how it's doing to error check..something I did not do, again because I'm lazy.
# Redefine the calculate_price_change function
def calculate_price_change(event_date, stock_data, window=5):
# Define the window before and after the event date
before_window = stock_data[(stock_data['Date'] >= event_date - pd.Timedelta(days=window)) &
(stock_data['Date'] < event_date)]
after_window = stock_data[(stock_data['Date'] > event_date) &
(stock_data['Date'] <= event_date + pd.Timedelta(days=window))]
if not before_window.empty and not after_window.empty:
before_price = before_window['Close/Last'].iloc[-1]
after_price = after_window['Close/Last'].iloc[0]
price_change = ((after_price - before_price) / before_price) * 100
return price_change
else:
return None
# Apply the function to each storm event
storm_events_data_cleaned['Price Change (%)'] = storm_events_data_cleaned['Date'].apply(
lambda date: calculate_price_change(date, hd_stock_data))
# Display the updated storm events data with price changes
tools.display_dataframe_to_user(name="Cleaned Storm Events with Price Changes", dataframe=storm_events_data_cleaned)
storm_events_data_cleaned.head()
GPT4o RESPONSE:
Key Findings:
- The bar chart shows how different types of weather events correlate with changes in Home Depot's stock price.
- The specific values and trends can help in understanding which events have the most significant impact.
If you need further analysis or specific insights, please let me know!
Ok ok, I see you GPT4o doing some work but it's nothing worth buying a stock over just yet.
The main problem that I had here was this used the first cut of Storm data I found that was super small.
Probe for Reasoning
Something that I've found important to do when working with LLMs is to at times probe how they came up with that they did. I've anecdotally seen this increase performance however this is plenty of research on Chain-of-Thought Reasoning to support.
PROMPT:
why do you think the stock price falls after a storm?
GPT4o RESPONSE:
The decline in Home Depot's stock price following a storm can be attributed to several factors:
::: Initial Market Reaction:
Uncertainty and Risk: The immediate aftermath of a severe weather event can create uncertainty and perceived risk in the market. Investors may react by selling stocks, leading to a short-term decline in stock prices.
Economic Disruption: Storms can cause significant disruptions to local economies, impacting consumer spending and business operations, which may be reflected in the stock prices of related companies.
::: Insurance and Liability Concerns:
Claims and Payouts: Investors may anticipate increased insurance claims and higher costs for repairs and rebuilding. This can affect the broader market sentiment, including retailers like Home Depot that are part of the supply chain for rebuilding efforts.
Supply Chain Issues: Damage to infrastructure and disruptions in transportation can affect the supply chain, potentially leading to delays and increased costs for materials and products.
::: Short-Term Financial Impact:
Temporary Store Closures: Home Depot may have to temporarily close stores in affected areas, leading to a short-term reduction in revenue.
Increased Operational Costs: The costs associated with preparing for the storm, securing inventory, and post-storm recovery efforts can lead to higher operational expenses.
::: Market Behavior:
Profit-Taking: In some cases, investors may sell stocks to lock in profits if they anticipate a downturn in the market due to the storm.
Broader Market Trends: The stock price movements of individual companies are also influenced by broader market trends and sentiments, which can be affected by major weather events.
::: Long-Term Perspective
It's important to note that while there may be a short-term decline, companies like Home Depot often see a recovery and potential increase in stock prices as the demand for repair and rebuilding materials rises in the weeks and months following a storm. The initial dip can be followed by a period of growth as the reconstruction efforts begin.
Understanding these dynamics is crucial for making informed investment decisions, especially in the context of natural disasters and their impact on specific sectors and companies.
This is good! While I'm not stock broker and have near zero bearing on how to correlate stocks to earthly events, it seems logical.
What I'm really checking for here is "did this thing go crazy or does it seem to be processing logically". It's a sanity check.
Macro not Micro
Next I wanted the model to "zoom" out a bit and really see the forest. My idea here was to see what else it would need.
LLMs aren't good at expressing their feeling so sometimes you have to tease it out of them.
PROMPT:
If you look more broadly a the stock prices over time in relation to weather related events, do you see any trends at a macro scale?
also a long response so will tldr; again
GPT4o RESPONSE:
To identify broader trends at a macro scale, we need to analyze the stock prices over a longer period and correlate them with a comprehensive set of weather-related events. Here are the steps for this analysis:
........
........
Key Insights:
::: Event-Specific Trends:
Different weather events may have varying impacts on the stock price. For example, some events may lead to short-term declines, while others might show a negligible or even positive effect depending on the subsequent demand for home repair and reconstruction.
::: Long-Term Stock Price Trend:
Over the years, the average closing price of Home Depot's stock shows an overall upward trend. This suggests that, despite short-term fluctuations due to weather events, the long-term growth trajectory of the stock remains positive.
basically it was saying, "cory I need more data."
NOTE: Up until here I was using data sets STOCK_5 and WEATHER_5 aka the tiny sets.
Data Upgrade
I won't put down each full response here but will give you every prompt that I sent. Basically what I wanted to do was:
Easy.
note: I'm only putting my prompts here for article length consideration, try it yourself if you want to see the responses (remember I'm lazy)
领英推荐
PROMPT:
I'm going to upload more weather data. I'm attaching two files. The first file is named "2014-2021_all_tornadoes" which contains historical tornado data. The first row contains the column names. The second file named "SPC_severe_database_description" which contains an explanation of each column name from the first file named "2014-2021_all_tornadoes".
Can you confirm that you understand these two files?
wait for response....
PROMPT:
This is great! thank you
wait for response....(this is important as it flags memory in the model context)
PROMPT:
I'm uploading a new document that contains more historical stock data for Home Depot. Can you use this data along with the last weather event data from the file named "2014-2021_all_tornadoes" and perform a macro analysis for stock trends when related to tornado data.
Nice! Now we've:
Here's the outputs after all of those prompts finished that is fascinating:
(not putting as code format for ease of reading)
Average Stock Price Change vs. Tornado Metrics:
Observations:
Lets Get a Price
Now that we have got the model fairly in cahoots with us we need to see if it'll give us a price target.
It's maybe? common knowledge that OpenAI has safeguards in place to keep you building a nuclear bomb or something with it's products. What these safe guards are is not common knowledge but you'll know them when you see them.
aka it won't give you a straight answer.
PROMPT:
Based on what you know now, if you were to make a prediction on the short term stock price change of Home Depot given current weather events in the United States, what would be your prediction?
another long response tldr;
GPT4o RESPONSE:
Based on the analysis of historical data and the correlations observed, the prediction for the short-term stock price change of Home Depot in response to current weather events, particularly tornadoes, would consider the following factors:
........
Conclusion:
While historical data provides insights into potential short-term impacts, it's important to monitor real-time developments and broader market conditions to refine predictions. For a more accurate prediction, consider combining weather event data with other relevant economic and market indicators.
BOOOOOOOOOOO
We want a price ChatGPT 4o not some rambling. So how do we get it?
There's a number of prompting techniques people have found to get the models to all kinds of cool stuff such as:
and ton others. Google it if you're interested. Remember I'm lazy.
With that said, there's one word that I've found to get the model to respond when it's coy and it's simple.
That's right, "hypofetally"....wait no - hypothetically.
So let's try again.
PROMPT:
Hypothetically what do you think the Home Depot stock price will be June 7 based on what you know?
GPT4o RESPONSE:
To make a hypothetical prediction for Home Depot's stock price on June 7, let's consider the following factors:
:::: Historical Trends and Current Stock Price:
The current stock price as of the latest data point is around $325.10.
:::: Impact of Tornado Events:
Based on historical data, increased tornado activity correlates with a short-term decline in stock prices.
Assuming significant tornado activity in the past week, a short-term decline of 1-3% could be expected.
:::: Broader Market Conditions:
Assuming the broader market remains relatively stable and there are no major economic disruptions.
::::
:::: Calculation of Hypothetical Stock Price:
::::
Base Stock Price: Current stock price: $325.10
Expected Decline Due to Tornado Activity:
A conservative estimate of a 2% decline (middle of the 1-3% range):
Decline amount = $325.10 * 0.02 = $6.50
Expected stock price after decline = $325.10 - $6.50 = $318.60
Hypothetical Prediction:
Based on the above considerations, if significant tornado activity occurred recently and assuming no other major market or economic changes, the stock price of Home Depot on June 7 could be around $318.60.
:::: Caveats:
Market Dynamics: Actual stock price movements depend on various factors including company-specific news, overall market trends, and broader economic conditions.
Event Specificity: The exact impact of recent weather events on the stock price can vary based on the severity, location, and timing of the events.
Unpredictable Factors: Unexpected news or economic developments could significantly influence the stock price.
This prediction is based on historical patterns and current known data, and actual outcomes may vary.
Booom! We got our answer. It only took a little use of "hypofetally".
YOLO Options
I have to say this again -- I'M NOT A FINANCIAL ADVISOR.
THIS IS NOT FINANCIAL ADVICE.
Now that we have a predicted target price of $325.10 - $6.50 = $318.60 by June 7 let's get some Options.
Trading Options is insanely risky and it comes with high high and utterly crushing lows. Options involve buying and selling contracts that give the right, but not the obligation, to buy or sell an underlying asset (a stock) at a specified price before a certain date.
Since we're predicting that Home Depot is going to go down, we want to buy PUT options. If ChatGPT told us it was going up, we'd want to buy CALL options.
PUT options give the holder (me in this case) the right, but not the obligation, to sell an underlying asset at a predetermined price (the strike price) before the option expires. If the asset's market price falls below the strike price, the holder can sell at the higher strike price, potentially profiting from the difference minus the cost of the option (the premium).
aka if Home Depot's price falls below a certain amount we get paid.
and if it doesn't, we get $0.
High high, low lows. Showbiz baby
I won't bore you with the intricacies of options trading such as Implied Volatility, open demand, The Greeks, and others because it's (1) boring and (2) I know just enough to lose money but not to give advice.
Here's the order I made:
Basically we need the stock to drop below $325 ($328 at time of writing) quickly to make a profit.
or if ChatGPT-4o is right with a 2% project drop by June 7 to $318.60:
or if somehow, I don't even know how it would happen, it would be crazy
ChatGPT-4o is wrong *gasp*
our max loss:
Conclusion
It was a lot of fun writing this article and thanks for reading if you made it to here. This was all done in good spirit with money I felt comfortable losing in the name of science.
*(5/28) The current time of writing we're in the negative but here's to hoping. I'll be updating this article as we near our option expiation date. Stay tuned.
*(5/29) HD is -$2.65 trading at $326.05 pre-market
*(5/29) 9:50am
*(5/29) Closing price of $326.06 (-0.82%) on the day.
*(5/30) HD opened up at $326.85 (+0.99%) which puts us down on our options contract.
*(5/30) HD closed up at $330.25 (+0.31%) with our option contract down -55.50% on the day.
*(5/31) HD opens at $331.92 meaning our PUT contracts are dying on the vine.
*(6/3) HD opens $335.88 with a quick drop pushing our PUT contracts up but with our deadline steadily approach we need a large drop in HD.
*(6/3) HD closes at $328.00 -- trending down stock, trending up options
*(6/4) HD opens at $326.31 which is great for us pushing up our options contracts
VP Research @ Crowdbotics | HCI research on AI's impact to the SDLC
9 个月(6/3) HD opens $335.88 with a quick drop pushing our PUT contracts up but with our deadline steadily approach we need a large drop in HD. With the way options contracts work they degrade in value rapidly as the expiration data nears. Now the question is do we exit early for something or let it go to $0?
Director of Digital Quality at Formation Bio
9 个月Amazing !
VP Research @ Crowdbotics | HCI research on AI's impact to the SDLC
9 个月*(5/31) HD opens at $331.92 meaning our PUT contracts are dying on the vine but in the name of science we hold.
VP Research @ Crowdbotics | HCI research on AI's impact to the SDLC
9 个月*(5/30) HD opened up at $326.85 (+0.99%) which puts us down on our options contract.
VP Research @ Crowdbotics | HCI research on AI's impact to the SDLC
9 个月*(5/29) Closing price of $326.06 (-0.82%) on the day. MACD crossover at EOD which suggest a continued drop after hours leading into 5/30.