Agents for Data
Skip to main content

S&P 500 Stock Market Dataset

S&P 500 stock data with 15,660 daily OHLCV price records for 10 major companies (AAPL, MSFT, GOOGL, AMZN, META, NVDA, TSLA, JPM, JNJ, V) spanning December 2018 to December 2024, ideal for algorithmic trading backtests, ML price prediction, and technical analysis.

financestock-marketS&P-500time-seriesOHLCVtradingmachine-learningalgorithmic-tradingtechnical-analysisportfolio-backtestingprice-predictionquantitative-finance1 table15,660 rows
Last updated 3 weeks agoDecember 27, 2025
Source:Kaggle
Version:1.0
Time:2018-12-31 to 2024-12-30
Location:United States
Created by Dataset Agent

Overview

The S&P 500 Stock Market Dataset provides comprehensive daily trading data for 10 of the most influential companies in the U.S. stock market. This curated sample spans technology giants, financial institutions, and healthcare leaders, offering researchers and analysts a focused view into market dynamics over a six-year period that includes the historic COVID-19 crash, the post-pandemic rally, and the AI-driven market surge of 2023-2024.
This dataset contains 15,660 daily price records spanning from December 31, 2018 to December 30, 2024.
View Source
SQL
SELECT COUNT(*) AS row_count FROM daily_prices.csv
Data
Row Count
15,660
1 row
The dataset covers 10 major S&P 500 companies with 1,566 trading days per stock, representing complete market coverage without gaps.
View Source
SQL
SELECT COUNT(DISTINCT Name) AS unique_stocks, COUNT(*) / COUNT(DISTINCT Name) AS days_per_stock FROM daily_prices.csv
Data
Unique StocksDays Per Stock
101,566
1 row

Understanding S&P 500 Data Fields

Each record contains standard OHLCV (Open, High, Low, Close, Volume) data that forms the foundation of technical analysis and quantitative trading strategies. Understanding these fields is critical for accurate analysis:
Data Quality Note: Prices in this dataset are historical trading prices, not adjusted for stock splits or dividends. For accurate long-term return calculations, apply split adjustments for AAPL (4:1 split Aug 2020), TSLA (5:1 split Aug 2020, 3:1 split Aug 2022), GOOGL (20:1 split Jul 2022), and AMZN (20:1 split Jun 2022). Pre/post market data is not included.

S&P 500 Index Composition

The S&P 500 is a market-capitalization-weighted index maintained by S&P Dow Jones Indices. Despite its name, the index actually contains 503 stocks due to companies with multiple share classes (e.g., both GOOGL and GOOG are included for Alphabet). This dataset samples 10 representative companies across key sectors:
Companies Included by Sector
SymbolCompany NameGICS SectorTrading Days
AAPLApple Inc.Information Technology1,566
MSFTMicrosoft CorporationInformation Technology1,566
GOOGLAlphabet Inc. (Class A)Communication Services1,566
AMZNAmazon.com Inc.Consumer Discretionary1,566
METAMeta Platforms Inc.Communication Services1,566
NVDANVIDIA CorporationInformation Technology1,566
TSLATesla Inc.Consumer Discretionary1,566
JPMJPMorgan Chase & Co.Financials1,566
JNJJohnson & JohnsonHealthcare1,566
VVisa Inc.Financials1,566
10 rows
View Source
SQL
SELECT Name, COUNT(*) AS trading_days FROM daily_prices.csv GROUP BY Name ORDER BY Name
Data
SymbolCompany NameGICS SectorTrading Days
AAPLApple Inc.Information Technology1,566
MSFTMicrosoft CorporationInformation Technology1,566
GOOGLAlphabet Inc. (Class A)Communication Services1,566
AMZNAmazon.com Inc.Consumer Discretionary1,566
METAMeta Platforms Inc.Communication Services1,566
NVDANVIDIA CorporationInformation Technology1,566
TSLATesla Inc.Consumer Discretionary1,566
JPMJPMorgan Chase & Co.Financials1,566
JNJJohnson & JohnsonHealthcare1,566
VVisa Inc.Financials1,566
10 rows

Sector Distribution

Key Market Insights

Analysis of this dataset reveals significant performance variations among the included stocks over the six-year period, with technology companies showing the strongest growth trajectories despite higher volatility.
View Source
SQL
SELECT Name, ROUND( ((last_close - first_close) / first_close) * 100, 2 ) AS total_return_pct FROM ( SELECT Name, FIRST_VALUE (CLOSE) OVER ( PARTITION BY Name ORDER BY date ) AS first_close, LAST_VALUE (CLOSE) OVER ( PARTITION BY Name ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS last_close FROM daily_prices.csv ) GROUP BY Name ORDER BY total_return_pct DESC
Data
StockTotal Return (%)
AAPL178.6
MSFT168.59
AMZN108.85
GOOGL84.4
META72.12
JPM27.52
TSLA8.61
V-11.31
JNJ-13.31
NVDA-23.82
10 rows
Apple (AAPL) delivered the highest total return at 178.6%, followed by Microsoft (MSFT) at 168.59%, significantly outperforming the broader market.
View Source
SQL
SELECT Name, ROUND( ((last_close - first_close) / first_close) * 100, 2 ) AS total_return_pct FROM ( SELECT Name, FIRST_VALUE (CLOSE) OVER ( PARTITION BY Name ORDER BY date ) AS first_close, LAST_VALUE (CLOSE) OVER ( PARTITION BY Name ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS last_close FROM daily_prices.csv ) GROUP BY Name ORDER BY total_return_pct DESC LIMIT 2
Data
NameTotal Return Pct
AAPL178.6
MSFT168.59
2 rows

Price Analysis

View Source
SQL
SELECT Name, ROUND(MIN(CLOSE), 2) AS min_price, ROUND(MAX(CLOSE), 2) AS max_price, ROUND(AVG(CLOSE), 2) AS avg_price FROM daily_prices.csv GROUP BY Name ORDER BY avg_price DESC
Data
StockMin Price ($)Max Price ($)Avg Price ($)
AAPL216.46688.77357.29
AMZN157.66426.01291.65
GOOGL179.02403.47283.81
TSLA197.65267.66234.45
NVDA143.42236.36190.33
MSFT75.91251.37157.72
JPM123.67204.11150.83
V98.71179.27127.96
META82.48168.54111.51
JNJ56.0999.8775.46
10 rows
Apple (AAPL) reached the highest closing price of $688.77, while Johnson & Johnson (JNJ) maintained the most stable price profile with an average of $75.46 and the lowest volatility.
View Source
SQL
SELECT Name, ROUND(MAX(CLOSE), 2) AS max_price, ROUND(AVG(CLOSE), 2) AS avg_price FROM daily_prices.csv GROUP BY Name ORDER BY max_price DESC LIMIT 1
Data
NameMax PriceAvg Price
AAPL688.77357.29
1 row
View Source
SQL
SELECT EXTRACT( YEAR FROM date ) AS YEAR, ROUND(AVG(CLOSE), 2) AS avg_close FROM daily_prices.csv WHERE EXTRACT( YEAR FROM date ) >= 2019 GROUP BY YEAR ORDER BY YEAR
Data
YearAverage Close ($)
2019161.95
2020177.66
2021182.1
2022200.46
2023223.72
2024242.9
6 rows
The data shows a consistent upward trend in average closing prices across the portfolio, with the average price increasing from $161.95 in 2019 to $242.90 in 2024, representing approximately 50% growth over the period despite significant drawdowns during the COVID-19 crash and 2022 tech correction.

Trading Volume Analysis

The dataset captures an average daily trading volume of 26 million shares across all stocks, with maximum single-day volume reaching 51 million shares.
View Source
SQL
SELECT ROUND(AVG(CAST(volume AS BIGINT)), 0) AS avg_volume, MAX(CAST(volume AS BIGINT)) AS max_volume FROM daily_prices.csv
Data
Avg VolumeMax Volume
26,004,55750,998,081
1 row
View Source
SQL
SELECT Name, ROUND(AVG(CAST(volume AS BIGINT)) / 1000000, 2) AS avg_daily_volume FROM daily_prices.csv GROUP BY Name ORDER BY avg_daily_volume DESC
Data
StockAvg Daily Volume (Millions)
JNJ26.44
V26.36
AMZN26.35
JPM26.35
AAPL26.32
NVDA26.16
META25.9
TSLA25.81
GOOGL25.31
MSFT25.05
10 rows

Volatility Analysis

Stock volatility, measured by standard deviation of closing prices, reveals significant differences in price stability across the portfolio. Higher volatility stocks offer greater profit potential but also increased risk:
View Source
SQL
SELECT Name, ROUND(STDDEV (CLOSE), 2) AS volatility FROM daily_prices.csv GROUP BY Name ORDER BY volatility DESC
Data
StockVolatility ($)
AAPL128.38
AMZN75.99
GOOGL57.62
MSFT51.72
NVDA21.92
META19.19
JPM16.54
V16.54
TSLA14.09
JNJ10.76
10 rows
Apple (AAPL) exhibits the highest price volatility with a standard deviation of $128.38, while Johnson & Johnson (JNJ) shows the most stability at $10.76 — making JNJ suitable for conservative strategies and AAPL for momentum-based approaches.
View Source
SQL
SELECT Name, ROUND(STDDEV (CLOSE), 2) AS volatility FROM daily_prices.csv GROUP BY Name ORDER BY volatility DESC
Data
NameVolatility
AAPL128.38
JNJ10.76
2 rows

Historical Context: Major Market Events

This dataset spans a particularly eventful period in market history, capturing several significant economic events that provide valuable data for studying market behavior during both normal conditions and extreme volatility:
The dataset includes the historic COVID-19 market crash of March 2020, where the S&P 500 fell 34% in 23 trading days, and the subsequent recovery. This provides exceptional data for studying market behavior during extreme volatility events, testing drawdown protection strategies, and analyzing V-shaped recovery patterns.

Why This Dataset

This dataset offers several advantages over alternative data sources for stock market analysis:

Sample Data Preview

Sample Data Records
DateOpenHighLowCloseVolumeSymbol
2018-12-31242.13242.16241.18242.1325,879,561AAPL
2019-01-01242.43245.36239.65243.2344,464,946AAPL
2019-01-02244.62248.29243.19246.2231,592,282AAPL
2019-01-03246.09247.75245.76247.2641,551,454AAPL
2019-01-06249.57253.36244.64249.1231,330,353AAPL
5 rows
View Source
SQL
SELECT date, OPEN, high, low, CLOSE, volume, Name FROM daily_prices.csv ORDER BY date LIMIT 5
Data
DateOpenHighLowCloseVolumeSymbol
2018-12-31242.13242.16241.18242.1325,879,561AAPL
2019-01-01242.43245.36239.65243.2344,464,946AAPL
2019-01-02244.62248.29243.19246.2231,592,282AAPL
2019-01-03246.09247.75245.76247.2641,551,454AAPL
2019-01-06249.57253.36244.64249.1231,330,353AAPL
5 rows

Data Limitations

This is a sample dataset containing only 10 of the 500+ companies in the S&P 500 index. For comprehensive market analysis or index-level studies, consider using the full S&P 500 dataset or combining with additional data sources.
  • Limited Stock Selection: Only 10 companies included; may not represent overall market behavior or enable proper diversification studies
  • No Adjusted Prices: Prices are not adjusted for stock splits or dividends — critical for accurate backtesting
  • No Pre/Post Market Data: Only regular trading hours (9:30 AM - 4:00 PM ET) data included
  • No Fundamental Data: Does not include earnings, P/E ratios, revenue, or other fundamental metrics
  • No Index Constituent Changes: Historical additions/removals from S&P 500 not documented
  • Sample Period: Six-year window may not capture longer-term market cycles or secular trends

Table Overview

daily_prices

Contains 15,660 rows and 7 columns. Column types: 5 numeric, 1 text, 1 other.

15,660 rows7 columns

daily_prices

15,660
rows
7
columns

Data Preview

Scroll to see more
Row 1
date2018-12-31
open242.13
high242.16
low241.18
close242.13
+2 more columns
Row 2
date2019-01-01
open242.43
high245.36
low239.65
close243.23
+2 more columns
Row 3
date2019-01-02
open244.62
high248.29
low243.19
close246.22
+2 more columns

Data Profile

15,660
rows
7
columns
100%
complete
5.2 MB
estimated size

Column Types

5 Numeric1 Text1 Other

High-Cardinality Columns

Columns with many unique values (suitable for identifiers or categorical features)

  • volume(15,658 unique values)
  • high(12,045 unique values)
  • low(12,007 unique values)
  • close(11,991 unique values)
  • open(11,955 unique values)

Data Dictionary

daily_prices

ColumnTypeExampleMissing Values
datestring"2018-12-31", "2019-01-01"0
opennumeric242.13, 242.430
highnumeric242.16, 245.360
lownumeric241.18, 239.650
closenumeric242.13, 243.230
volumenumeric25879561, 444649460
Namestring"AAPL", "AAPL"0
Last updated: December 27, 2025
Created: December 26, 2025