S&P 500 (SPY) Price Movement: 2022 Review and 2023 Forecast in Python. (2023)

Analysis of SPY historical and future price movement. The Python code can be applied to any stock and timeframe.

S&P 500 (SPY) Price Movement: 2022 Review and 2023 Forecast in Python. (1)

In this blog post, we will quickly review the price movement of SPY in 2022 and look into its 2023 expected price move using the straddle options strategy.

Please take note that this post’s coverage period runs from 1 January through 23 December 2022.

The Python code used to run the computations and create the charts for this post is provided at the end. You can study any period of interest by adjusting the dates in the below code. And the code can be used on any stock and timeframe.

The post is divided into two sections: 2022 Review and 2023 Insight/Expected Price Move.

Price Performance

The SPY stock began trading in 2022 at $476.30 and closed at $382.91 on 23 December 2022. This represents a decline of -19.85%.

Year to date, SPY has had 107 positive days and 140 negative days.

S&P 500 (SPY) Price Movement: 2022 Review and 2023 Forecast in Python. (2)

The day with the highest daily return, which was close to 5.50%, was November 10, 2022. On the other hand, on September 13, 2022, the lowest return of -4.35% was recorded.

S&P 500 (SPY) Price Movement: 2022 Review and 2023 Forecast in Python. (3)
S&P 500 (SPY) Price Movement: 2022 Review and 2023 Forecast in Python. (4)

The mean price during this period was near the $409 level.

S&P 500 (SPY) Price Movement: 2022 Review and 2023 Forecast in Python. (5)

SPY closed 114 times above the mean and 132 times below the mean. Only once did SPY close at or close to the mean price. These stats are especially important in light of the mean reversion strategy.

Let’s now examine daily returns to see if they are normally distributed.

S&P 500 (SPY) Price Movement: 2022 Review and 2023 Forecast in Python. (6)

It appears to be normally distributed at first glance. The distribution is moderately skewed, according to the skewness value of 0.052.

(Video) MOST POWERFUL SPY STRATEGY OF 2022, 2023? (S&P 500) | TECHNICAL ANALYSIS

However, from the fat-tailed distribution, the kurtosis is 3.32, representing a leptokurtic type where the outlier frequency is significant. In other words, there is a significant number of large values among the daily returns. This indicates that extreme events are likely to occur more frequently than would be predicted by a perfect normal distribution.

Please see my earlier post on skewness and kurtosis to learn the differences between these two terms.

Risk Performance

The price trend for 2022 is depicted in the chart below, along with low and high values.

S&P 500 (SPY) Price Movement: 2022 Review and 2023 Forecast in Python. (7)

In a few cases, we can see that daily volatility, or the price swing between low and high, was substantial. The daily trader could have made significant profits or losses during the days of high volatility.

The highest price swing between low and high was observed on 24 January 2022. That day the difference between these low and high points was $20.

Here a few more details using the describe() method:

  • Average price swing: $7.54
  • Lowest price swing: $1
  • 25th percentile price swing: $5
  • 75th percentile price swing: $9

Volatility

The standard deviation, the historical volatility, for this period was around $29. The below chart shows the historical distribution of the prices within 1SD and 2SD. This translates to the following:

  • The mean price is $409 for the observed period
  • 68% of the prices of closing prices fall within one standard deviation (~$29), between the prices of ~$438 and ~$380
  • 95% of closing prices fall within two standard deviations (2 x $29), between ~$467 and ~$351.

You can find more details regarding historical volatility in this post.

S&P 500 (SPY) Price Movement: 2022 Review and 2023 Forecast in Python. (8)

Correlation

Let’s check how the SPY stock has been correlated to TLT, GLD, and BTC throughout this year.

S&P 500 (SPY) Price Movement: 2022 Review and 2023 Forecast in Python. (9)

Surprisingly, most of the aforementioned financial instruments that are typically used to balance or diversify the SPY risk have a rather high correlation with SPY. The correlation between GLD and SPY appears to be lower than for other instruments.

In a previous post, we learned how to use the straddle, one of the options strategies, to estimate the predicted price change of a stock over a specified period. The prices of options can be a reliable indicator of future market conditions since they reflect what the investor believes the trend will likely be during a specific time period. But since investor opinion can change at any time, it is important to keep in mind that there is no assurance that options will follow this pricing trend.

To determine the projected price range for SPY in 2023, within the first standard deviation, we will apply the function we defined in the linked post. We will use the options chains’ furthest expiration date in 2023, that is 2023–12–15.

The SPY stock closed at around $383 on 23 December 2022. From now until 15 December 2023, market participants anticipate SPY will fluctuate between $291 and $471. In more precise terms, there is a 68% likelihood that the SPY price will fall within this range. This indicates that the market will likely continue to be turbulent in 2023, according to the investors.

S&P 500 (SPY) Price Movement: 2022 Review and 2023 Forecast in Python. (10)
(Video) US Stock Market | S&P 500 SPY Cycle & Chart Analysis | Price Projections and Timing askSlim.com

Thank you for reading this post, I hope you enjoyed it. I wish you all a Happy and Prosperous New Year!

If you would like to receive stock market update three times a week, please subscribe to https://szymanskiresearch.substack.com/ . It is free!

The calculations presented in this blog post are not an investment advice. These are not trading signals.

import yfinance as yf
import pandas as pd
import matplotlib.pyplot as plt
import plotly.graph_objects as go
import plotly.express as px
import numpy as np
import seaborn as sns
from scipy.stats import kurtosis, skew
import matplotlib
import datetime
import warnings
warnings.filterwarnings("ignore")

SPY = yf.download('SPY', start = '2022-01-01')

#2022 ANALYSIS

SPY['Daily_Returns'] = (SPY['Close'].pct_change())*100

ytd = ((SPY['Close'][-1] - SPY['Close'][0]) / SPY['Close'][0])*100

#counting positive & negative days
SPY['Returns'] = SPY['Daily_Returns'].apply(lambda x: 'Positive days' if x >= 0 else 'Negative days')

#making a bar plot with negative/positive days

#pip install matplotlib --upgrade (required to run bar_label)

ax = SPY['Returns'].value_counts().plot(kind='bar', title='Positive/Negative Return Days', color=['r','b'], figsize=(15, 8), rot=0)
ax.set_ylabel('Count')
for p in ax.containers:
ax.bar_label(p, fmt='%.2f', label_type='edge')

#finding the highest daily return
SPY.query('Daily_Returns == Daily_Returns.max()')

#finding the lowest daily return
SPY.query('Daily_Returns == Daily_Returns.min()')

#Finding the mean of Close Price
avg = SPY['Close'].mean()

#Rounding the Close Price mean
round_avg = round(avg)

#Calculating days when the Closing prices were > than mean
greater_mean = SPY[SPY['Close'] > round_avg].value_counts().sum()

#Calculating days when the Closing prices were < than mean
less_mean = SPY[SPY['Close'] < round_avg].value_counts().sum()

#Calculating days when the Closing prices were equal to mean
mean_equal = SPY[SPY['Close'].between(409, 410)].value_counts().sum()

#Charting the mean stats using the bar plot
fig3 = plt.figure()
ax2 = fig3.add_axes([0,0,1,1])
bars = ['> than mean', '= mean', '< than mean' ]
values = [greater_mean, mean_equal, less_mean]
ax2.bar(bars, values, color=['r','b', 'g'])
plt.title('Closing Prices vs Close Price Mean')
for p in ax2.containers:
ax2.bar_label(p, fmt='%.0f', label_type='edge')
plt.show()

#Charting the distribution of Daily Returns
mean = round(SPY['Daily_Returns'].mean(),5)
fig = px.histogram(SPY, x="Daily_Returns", histnorm= 'probability density')
fig.add_vline(x=mean, line=dict(color = 'red', width =3), line_dash= 'dot', annotation_text= f'Daily Returns Mean: {mean} ', annotation_position = 'top')
fig.update_layout(bargap=0.05)
fig.show()

#Calculating skewness and kurtosis
SPY['Daily_Returns']= SPY['Daily_Returns'].fillna(0)
skew(SPY['Daily_Returns'])
kurtosis(SPY['Daily_Returns'], fisher=False)

#Charting 2022 SPY price trend with low and high values
fig = go.Figure([
go.Scatter(
name='Prices',
x=SPY.index,
y=SPY['Close'],
mode=' lines',
line=dict(color='red', width=1),
showlegend=True
),
go.Scatter(
name='High',
x=SPY.index,
y=SPY['High'],
mode='lines',
marker=dict(color="grey"),
line=dict(width=2),
showlegend=True
),
go.Scatter(
name='Low',
x=SPY.index,
y=SPY['Low'],
marker=dict(color="grey"),
line=dict(width=2),
mode='lines',
fillcolor='rgba(68, 68, 68, 0.1)',
fill='tonexty',
showlegend=True
)

])
fig.update_layout(
yaxis_title='SPY Price',
title='SPY Performance',
hovermode="x"
)
fig.update_layout(height=900, width=2000)
fig.show()

#calculating volatility (Low-High Price differential)
SPY['volatility'] = round(SPY['High'] - SPY['Low'])

(Video) Is The Kiss of Death On The S&P500 About To Cause A Stock Market CRASH? (SPX QQQ IWM Investing) PT 2

#Finding the maximum volatility
SPY.query('volatility == volatility.max()')

#Using the describe() method on the 'volatility' column
SPY['volatility'].describe()

#Calculating standard deviation
std = (np.std(SPY['Close']))

#Charting historical volatility (68%-95% confidence levels)

fig2 = px.line(SPY, x=SPY.index, y=SPY['Close'], title = 'SPY 2022 Historical Volatility')
fig2.add_hline(y=avg, line = dict(color = 'orange', width =2), annotation_text=f'Mean: {round(avg)}',
annotation_position="bottom right")
fig2.add_hline(y=avg-std, line = dict(color = 'red', width =2), line_dash="dot", annotation_text="1 SD",
annotation_position="bottom right")
fig2.add_hline(y=avg+std, line = dict(color = 'red', width =2), line_dash="dot", annotation_text="1 SD",
annotation_position="bottom right")
fig2.add_hline(y=avg-2*std, line = dict(color = 'green', width =2), line_dash="dot", annotation_text="2 SD",
annotation_position="bottom right")
fig2.add_hline(y=avg+2*std, line = dict(color = 'green', width =2), line_dash="dot", annotation_text="2 SD",
annotation_position="bottom right")
fig2.update_yaxes(title_text="Stock Price")
fig2.update_xaxes(title_text="Date")
fig2.update_layout(height=700, width=1500,
showlegend=False)

fig2.show()

#Calculating and Charting Correlation

symbols = ['TLT', 'GLD', 'SPY', 'BTC-USD']

frames = []

for i in symbols:
data = yf.download(i, start='2022-01-01', end='2022-12-24')
data['Symbol'] = i
frames.append(data)

df = pd.concat(frames)
df = df.reset_index()

df = df[['Date', 'Close', 'Symbol']]
df1=df.pivot('Date','Symbol','Close').reset_index()
df_correlation = df1.corr(method='pearson')

df_correlation.head().reset_index()

plt.figure(figsize=(13, 8))
sns.heatmap(df_correlation, annot=True, cmap='RdYlGn')
plt.figure();

#Calculating 2023 Expected Move / Please also visit the following post for more details
#https://medium.com/@Piotr_Szymanski/calculating-expected-stock-move-using-options-straddles-in-python-40523a66839c

def options_chain(symbol):
'''Utility Method to Get Options for Stock'''
tk = yf.Ticker(symbol)
# Expiration dates
exps = tk.options

# Get options for each expiration
options = pd.DataFrame()
for e in exps:
opt = tk.option_chain(e)
opt = pd.DataFrame().append(opt.calls).append(opt.puts)
opt['expirationDate'] = e
options = options.append(opt, ignore_index=True)

options['expirationDate'] = pd.to_datetime(
options['expirationDate'])
options['dte'] = (options['expirationDate'] -
datetime.datetime.today()).dt.days / 365

# Boolean column if the option is a CALL, to distinguish calls from puts
options['CALL'] = options['contractSymbol'].str[4:].apply(
lambda x: "C" in x)

return options

def get_expected_move(stock, expiration_date):
ticker = yf.Ticker(stock)
current_price = ticker.info['regularMarketPrice']

data = options_chain(stock)
dates = np.sort(data['expirationDate'].unique())

closest = data[data['expirationDate'] == expiration_date]

#to match stock's price with the strike price
closest['abs'] = abs(current_price - closest['strike'])
closest = closest.sort_values('abs')
move = (closest[closest['CALL'] == True]['lastPrice'].iloc[0] +
closest[closest['CALL'] == False]['lastPrice'].iloc[0]) * 1.25
return current_price, round(move), expiration_date

(Video) Stock Market CRASH Wave 3 Likely Now In Progress- S&P 500 Triggers A BULL FAKE Crash Signal- QQQ SPX

move = get_expected_move('SPY', '2023-12-15')
#move variable is a list
upper_move = move[0] + move[1]
lower_move = move[0] - move[1]
print("Expected price move between", upper_move, "and", lower_move, "until", move[2])

#extending time period into the future
b = pd.date_range(start ='2022-12-22', periods = 365)
data = yf.download('SPY', start = '2022-01-01')
#adding the future dates into the data dataframe
data.index.append(b)
fig = px.line(data, x=data.index, y=data['Close'], title = 'SPY Expected Move in 2023 (Using Straddle Prices)')
fig.update_xaxes(range=["2022-01-01", "2023-12-15" ])
fig.add_hline(y=upper_move, line = dict(color = 'red', width =2), line_dash="dot", annotation_text=upper_move,
annotation_position="bottom right")
fig.add_hline(y=lower_move, line = dict(color = 'red', width =2), line_dash="dot", annotation_text=lower_move,
annotation_position="bottom right")
fig.update_yaxes(title_text="Stock Price")
fig.update_xaxes(title_text="Date")
fig.update_layout(height=700, width=1500,
showlegend=False)

fig.show()

Related Posts:

Market Volatility in PythonDefining and Calculating Market Volatility Using Pythonmedium.com
Explaining Implied Volatility using Python.From Theory to Practice: Defining and calculating implied volatility using Black-Scholes-Merton model. Comprehensive…medium.datadriveninvestor.com
Calculating Expected Stock Move Using Options Straddles in Python.Creating a function along with visualizationmedium.com

Disclaimer: The information contained in this blog post is strictly for educational and entertainment purposes only. This is also not an investment advice. All views expressed in this blog are my own and do not represent the opinions of any entity whatsoever with which I have been, am now, or will be affiliated.

Subscribe to DDIntel Here.

Visit our website here: https://www.datadriveninvestor.com

Join our network here: https://datadriveninvestor.com/collaborate

(Video) WHAT'S GOING ON WITH SPY? (S&P 500 WHAT TO WATCH) | TECHNICAL ANALYSIS

FAQs

Will SPY go up? ›

Spdr S&p 500 quote is equal to 399.605 USD at 2023-01-24. Based on our forecasts, a long-term increase is expected, the "SPY" fund price prognosis for 2028-01-19 is 615.640 USD. With a 5-year investment, the revenue is expected to be around +54.06%. Your current $100 investment may be up to $154.06 in 2028.

Is SPY a buy sell or hold? ›

1 Wall Street analysts have issued "buy," "hold," and "sell" ratings for SPDR S&P 500 ETF Trust in the last year. There are currently 1 hold rating for the stock. The consensus among Wall Street analysts is that investors should "hold" SPY shares.

Is it always a good time to buy SPY? ›

If you're a long-term investor, any time is a good time to buy SPY stock. Given how diversified it is, SPY is the ultimate "set it and forget it" stock. Over the long term, the S&P 500 has returned 9.9% a year on average since 1928 including dividends, says IFA.com.

Is SPY bullish or bearish? ›

[Positioning] Intermediate trend possibly bearish, Sideways trend near upper resistance. Indicators for positioning trade entry and exits. flat (+0.33, +0.1%) from yesterday's close.

Does the SPY pay a dividend? ›

Historical dividend payout and yield for SPDR S&P 500 ETF (SPY) since 1995. The current TTM dividend payout for SPDR S&P 500 ETF (SPY) as of January 23, 2023 is $6.32. The current dividend yield for SPDR S&P 500 ETF as of January 23, 2023 is 1.58%.

Should I reinvest dividends in SPY? ›

Since dividends cannot be reinvested, a 'dividend drag' is created where during climbing markets dividends are not reinvested to add to the return of SPY. During descending market periods holding the dividends in cash is more profitable.

Should I invest in SPY or SPX? ›

SPY Vs SPX: which one is for beginners? Most people think they can beat the market by buying and selling stocks absurdly, but they don't. So, as a beginner, you should consider the SPY if you are a long-term investor. If you want to trade and be a day trader, then the SPX is better suited for you.

Is it good to buy SPY stock? ›

Is the SPDR S&P 500 ETF Trust a Good Investment? Yes. The SPY ETF diversifies exposure to the U.S. equity market and is suitable for investors willing to take on a moderate level of risk.

How much to invest in S&P 500 to be a millionaire? ›

When most people think about average market returns, those are the commonly cited numbers that they expect to achieve. At an 8% rate of return, $100,000 would turn into $1,000,000 after 30 years. If you have 30 years and $100,000, then there's a good chance that the S&P 500 can make you a millionaire retiree.

Is Vanguard or SPY better? ›

Key Takeaways

One of the primary differences between the two is that Vanguard's VFIAX has a lower expense ratio of 0.04% versus the SPY's 0.0945%. The SPY ETF may have a slight tax advantage over the VFIAX mutual fund since it's not actively managed, meaning there's less buying and selling of trades.

How much would $8000 invested in the S&P 500 in 1980 be worth today? ›

Comparison to S&P 500 Index

To help put this inflation into perspective, if we had invested $8,000 in the S&P 500 index in 1980, our investment would be nominally worth approximately $798,165.88 in 2023. This is a return on investment of 9,877.07%, with an absolute return of $790,165.88 on top of the original $8,000.

Is SPY in a downtrend? ›

Summary. SPY has moved sideways as suggested in my last update on November 14, 2022. The recent weakness observed in the past week may lead to a new short-term downtrend but SPY has built up some support levels which should be observed.

Is SPY the best ETF? ›

SPDR S&P 500 ETF (SPY)

The State Street SPDR S&P 500 ETF is not only the oldest U.S. listed exchange-traded fund, but it also typically has both the largest assets under management (AUM) and highest trading volume of all ETFs. This alone makes the SPY the mother of all S&P 500 ETFs.

Should I just put my money in S&P 500? ›

Conclusion. Investing in the S&P 500 can be a great option if you want exposure to some of the biggest companies in the U.S. It's one of the best-known indexes and most of the best stock brokers offer low-cost S&P 500 mutual funds and ETFs.

Is it smart to buy S&P 500? ›

Is Investing in the S&P 500 Less Risky Than Buying a Single Stock? Generally, yes. The S&P 500 is considered well-diversified by sector, which means it includes stocks in all major areas, including technology and consumer discretionary—meaning declines in some sectors may be offset by gains in other sectors.

What is the next SPY dividend? ›

16, 2022.

What is the average dividend yield of SPY? ›

24, 2023.

How much do you make in dividends from the S&P 500? ›

S&P 500 Dividend Yield is at 1.74%, compared to 1.82% last month and 1.27% last year. This is lower than the long term average of 1.85%.

Will the stock market run tomorrow? ›

NSE or National Stock Exchange is open on the weekdays from Monday to Friday and is closed on Saturday and Sunday, except for any special trading sessions that are announced.

Will S&P rise again? ›

Between 2009 and 2021, the S&P 500's average annual return was a hefty 16.4%, according to New York University. But don't expect anything like those gains in 2023. Investment banks' average price target for the S&P 500 next year is roughly 4,000, implying stocks will rise just 4%.

What happens between 9 to 9.15 in stock market? ›

What does the pre-market session involve? The pre-market session on, National Stock Exchange, for example, runs from 9 AM to 9.15 AM. In these 15 minutes, the first eight minutes are dedicated to order collection, entry, modification, and cancellations.

How can I predict tomorrow's stock market? ›

If stock returns are essentially random, the best prediction for tomorrow's market price is simply today's price, plus a very small increase.

How do you know which stock will rise tomorrow? ›

This method of predicting future price of a stock is based on a basic formula. The formula is shown above (P/E x EPS = Price). According to this formula, if we can accurately predict a stock's future P/E and EPS, we will know its accurate future price.

What is the S&P 500 prediction for 2023? ›

Most stock market forecasts for 2023 see moderate improvement. UBS targets a year-end 2023 S&P 500 at 3900 and KKR sees it at 4150. CFRA expects a 2.9% gain, which would put the S&P over 3900. It closed the year around 3840.

How will the S&P 500 perform in 2023? ›

In light of these factors, J.P. Morgan Research is reducing its below consensus 2023 S&P 500 earnings per share (EPS) of $225 to $205 due to weaker demand and pricing power, further margin compression and lower buyback activity.

What is the prediction for the stock market in 2023? ›

But those headwinds, which experts warn could broaden into a recession, may convince the Fed to pause on its series of rate hikes, JPMorgan noted. That could drive the stock market higher, pushing the S&P 500 to 4,200 by the end of 2023, or about 10% higher than its current levels, the investment firm predicts.

Should I put all my money in S&P 500? ›

That said, you shouldn't necessarily invest exclusively in the S&P 500. There are other indices, sectors, and groups of stocks you can invest in through mutual funds and ETFs, and there are some excellent individual stocks you can invest in.

Should I invest in SPX or SPY? ›

SPY Vs SPX: which one is for beginners? Most people think they can beat the market by buying and selling stocks absurdly, but they don't. So, as a beginner, you should consider the SPY if you are a long-term investor. If you want to trade and be a day trader, then the SPX is better suited for you.

Videos

1. S&P 500 & QQQ Stock Market CRASH: Will The PCE Data Mark A Short Term Bottom? It Marked The Top PT 1
(Ron Walker)
2. 20 % Stock Market Now In Progress On S&P 500 - The Momentum Cloud Warned That The CPI Rally Was Fake
(Ron Walker)
3. S&P 500 Price Predictions
(Pagetrader - Daytrading Forecasts and Education)
4. Stock Market CRASH: BULL TRAP - The S&P 500 Rally Is About To Unravel (SPX QQQ DIA IWM)
(Ron Walker)
5. An 18 to 20 % Stock Market CRASH Is About To Start That Will Take The S&P 500 Down To 3200-3300 Area
(Ron Walker)
6. CPI Data - 12 Jan 2023 – US Stocks Signal Using Python Technical (Support & Resistance)
(Nerdish Daily Stock Signal)
Top Articles
Latest Posts
Article information

Author: Msgr. Refugio Daniel

Last Updated: 11/21/2022

Views: 5552

Rating: 4.3 / 5 (54 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Msgr. Refugio Daniel

Birthday: 1999-09-15

Address: 8416 Beatty Center, Derekfort, VA 72092-0500

Phone: +6838967160603

Job: Mining Executive

Hobby: Woodworking, Knitting, Fishing, Coffee roasting, Kayaking, Horseback riding, Kite flying

Introduction: My name is Msgr. Refugio Daniel, I am a fine, precious, encouraging, calm, glamorous, vivacious, friendly person who loves writing and wants to share my knowledge and understanding with you.