CoolFace
Datasetpublic

sogosonnet/SP500-Chart-Dataset

SP500-Chart-Dataset A large-scale candlestick chart image dataset for financial image classification research, covering 501 S&P 500 stocks. Overview Item Value Stocks 501 S&P 500 constituents Total Images 1,374,694 Period 2010-01 – 2025-03 Image Size ~480×480 px (4×4 inch, 120 dpi) Chart Type Candlestick (OHLCV) with technical indicators Labels 6-class forward return (±1%/±2%/±3%) Download Download sp500_images.zip (26 GB)… See the full description on the dataset page: https://huggingface.co/datasets/sogosonnet/SP500-Chart-Dataset.

sourceHugging Facecc-by-4.0updated 6mo agoView on Hugging Face
2likes393downloads
Dataset Card

SP500-Chart-Dataset

A large-scale candlestick chart image dataset for financial image classification research, covering 501 S&P 500 stocks.

Overview

ItemValue
Stocks501 S&P 500 constituents
Total Images1,374,694
Period2010-01 – 2025-03
Image Size~480×480 px (4×4 inch, 120 dpi)
Chart TypeCandlestick (OHLCV) with technical indicators
Labels6-class forward return (±1%/±2%/±3%)

Download

Download sp500_images.zip (26 GB) from the Files tab and extract:

bash
unzip sp500_images.zip

Directory structure after extraction:

cross_sectional_data/images/{TICKER}/{CLASS}/{TICKER}_{INDEX}_{DATE}.png

Metadata JSON files are in the metadata/ folder.

Chart Specification

Each chart is a 20-trading-day candlestick chart rendered with mplfinance:

  • OHLCV candlestick bars (Charles style)
  • Volume bars (bottom panel)
  • MA5 (blue dotted) — 5-day moving average
  • MA60 (red dashed) — 60-day moving average
  • MA120 (green solid) — 120-day moving average
  • Bollinger Bands (grey shaded area, α=0.15) — 20-day ± 2σ
All technical indicators are guaranteed to be visible in every image. The y-axis is automatically scaled to include all indicator values. Prices are percentage-normalized relative to the first closing price in each window (0% baseline), making visual patterns scale-invariant across stocks.

Label Definition

Labels are based on the 5-day forward return:

LabelReturn Range
down_3plusr < −3%
down_2_3−3% ≤ r < −2%
down_1_2−2% ≤ r < −1%
up_1_21% < r ≤ 2%
up_2_32% < r ≤ 3%
up_3plusr > 3%
Returns in [−1%, +1%] are excluded as ambiguous.

Temporal Split

  • Train: end_date < 2022-12-21
  • Test: end_date >= 2023-01-01
  • Embargo: 10 calendar days

Usage

python
import json
from pathlib import Path
from PIL import Image

with open('metadata/samples_AAPL.json') as f:
    meta = json.load(f)

sample = meta['samples'][0]
img_path = Path('cross_sectional_data/images') / sample['ticker'] / sample['label'] / \
    f"{sample['ticker']}_{sample['index']}_{sample['end_date'].replace('-','')}.png"
img = Image.open(img_path)

Citation

bibtex
@misc{sp500chart2025,
  title={SP500-Chart-Dataset},
  author={Ahn, Jaehyun},
  year={2025},
  howpublished={\url{https://github.com/JaehyunAhn/SP500-Chart-Dataset}},
  note={Yonsei University}
}

License

CC BY 4.0