wangdx25's picture
Add TsFile (converted from ronantakizawa/trending-stocks-yahoo-finance)
8c8f275 verified
|
Raw
History Blame Contribute Delete
2.26 kB
metadata
license: mit
task_categories:
  - time-series-forecasting
tags:
  - tsfile
  - timeseries
  - time-series
  - finance
  - stocks
  - trending
  - yahoo-finance
  - market-data
  - format:tsfile
pretty_name: Trending Stocks (Yahoo Finance) (TsFile)
size_categories:
  - 10K<n<100K

Trending Stocks (Yahoo Finance) (TsFile)

Apache TsFile version of ronantakizawa/trending-stocks-yahoo-finance.

Overview

Ranked dataset of the most trending stocks on Yahoo Finance from July 2024 to October 2025 (16 months), based on weighted scoring of their monthly trending appearances. Sourced from Wayback Machine snapshots of Yahoo Finance Trending Stocks, at monthly granularity. Multiple intra-day snapshots per stock are collapsed to the latest snapshot per day.

Schema (TsFile structure)

  • Time (INT64, milliseconds) — the snapshot date.
  • symbol (TAG) — the stock ticker (device dimension).
  • price / change / change_pct (FIELD, FLOAT).
  • volume / avg_volume_3m (FIELD, FLOAT).
  • market_cap / pe_ratio (FIELD, FLOAT).
  • rank (FIELD, INT64) — the monthly rank.

Usage

Install the Apache TsFile Python SDK (pip install tsfile) and read a converted file:

from pathlib import Path
from tsfile import TsFileReader

path = Path("trending_stocks_yahoo_finance.tsfile")
with TsFileReader(str(path)) as reader:
    schemas = reader.get_all_table_schemas()
    print("tables:", list(schemas))
    table_name = next(iter(schemas))
    table = schemas[table_name]
    columns = [column.get_column_name() for column in table.get_columns()]
    print("columns:", columns)
    field_names = [
        column.get_column_name()
        for column in table.get_columns()
        if column.get_column_name() not in {"Time", "time"}
    ]
    if field_names:
        with reader.query_table(table_name, field_names[:3], batch_size=1024) as result:
            batch = result.read_arrow_batch()
            if batch is not None:
                print(batch.to_pandas().head())

Source & license