--- pretty_name: Qlib native providers and A-share minute data language: - zh - en --- # stock_dataset [中文](#中文) | [English](#english) ## 中文 本数据集以**未压缩的原始文件**保存两类股票数据,保留原有目录结构和文件内容,可以直接按目录下载使用。 | 目录 | 内容 | 文件数 | 原始字节数 | |---|---|---:|---:| | `qlib/cn_data/` | A 股原生 Qlib provider,含 CSI300、CSI500、CSI1000 历史股票池定义 | 61,008 | 707,180,289 | | `qlib/us_data/` | 美股原生 Qlib provider,含 SP500 股票池及基准 | 3,744 | 59,236,967 | | `qlib/hk_data/` | 港股原生 Qlib provider,含 HSI90 股票池及 HKHSI 基准 | 1,604 | 15,714,170 | | `A股分钟/2000-2024/` | 2000—2024 年 A 股 1、5、15、30、60 分钟 CSV 行情 | 309,495 | 216,090,239,948 | | **合计** | | **375,851** | **216,872,371,374** | 数据文件合计约 **201.98 GiB**。分钟数据五种频率各有 **61,899** 个 CSV 文件。数据快照日期为 2026-10-29。 ### 目录结构 ```text qlib/ cn_data/{calendars,instruments,features,...} us_data/{calendars,instruments,features,...} hk_data/{calendars,instruments,features,...} A股分钟/2000-2024/<年份>/<1分钟|5分钟|15分钟|30分钟|60分钟>/<股票>.csv metadata/ manifest.json files.jsonl data_notes.md scripts/ download.py verify_download.py ``` Qlib 包含原生交易日历、股票池、`features/<代码>/*.bin` 行情字段、基准及 provider 说明。中证三个股票池共用 `cn_data`。日期范围、字段和数据情况见 [数据说明](metadata/data_notes.md)。 ### 下载与使用 完整下载: ```bash hf download OxFengyuan/stock_dataset --repo-type dataset --local-dir stock_dataset ``` 下载所需的一类数据(脚本需要 `huggingface_hub`): ```bash python3 scripts/download.py --collection qlib --destination ./stock_dataset python3 scripts/download.py --collection minutes --destination ./stock_dataset python3 scripts/download.py --repo-id OpenFinMind/stock_dataset --collection qlib --destination ./stock_dataset ``` 下载完成即可直接读取 CSV,或将 `./stock_dataset/qlib/cn_data`、`us_data`、`hk_data` 分别作为 `qlib.init(provider_uri=...)` 的 provider 目录。下载全部数据需要约 202 GiB 数据空间,另为下载缓存和元数据预留空间。 ### 文件清单与校验 [总体清单](metadata/manifest.json) 记录各目录文件数和字节数;[逐文件清单](metadata/files.jsonl) 记录每个数据文件的相对路径、字节数及 SHA256。 ```bash python3 scripts/verify_download.py --repo ./stock_dataset --collection all ``` `--collection qlib` 或 `--collection minutes` 可单独校验一类数据。 ## English This dataset stores two collections as **uncompressed original files**, preserving their directory structure and contents. Download the desired directories and use the files directly. | Directory | Contents | Files | Original bytes | |---|---|---:|---:| | `qlib/cn_data/` | Native A-share Qlib provider, including historical CSI300, CSI500, and CSI1000 universe definitions | 61,008 | 707,180,289 | | `qlib/us_data/` | Native US Qlib provider, including the SP500 universe and benchmark | 3,744 | 59,236,967 | | `qlib/hk_data/` | Native Hong Kong Qlib provider, including the HSI90 universe and HKHSI benchmark | 1,604 | 15,714,170 | | `A股分钟/2000-2024/` | A-share CSV market data for 2000–2024 at 1-, 5-, 15-, 30-, and 60-minute frequencies | 309,495 | 216,090,239,948 | | **Total** | | **375,851** | **216,872,371,374** | The data files total approximately **201.98 GiB**. Each minute frequency contains **61,899** CSV files. The data snapshot date is 2026-10-29. ### Directory structure ```text qlib/ cn_data/{calendars,instruments,features,...} us_data/{calendars,instruments,features,...} hk_data/{calendars,instruments,features,...} A股分钟/2000-2024//<1分钟|5分钟|15分钟|30分钟|60分钟>/.csv metadata/ manifest.json files.jsonl data_notes.md scripts/ download.py verify_download.py ``` Each Qlib provider contains native trading calendars, universe definitions, `features//*.bin` fields, benchmarks, and provider documentation. The three CSI universes share `cn_data`. See [data notes](metadata/data_notes.md) for dates, fields, and coverage details. ### Download and use Download the full repository: ```bash hf download OxFengyuan/stock_dataset --repo-type dataset --local-dir stock_dataset ``` Download one collection using the repository script (requires `huggingface_hub`): ```bash python3 scripts/download.py --collection qlib --destination ./stock_dataset python3 scripts/download.py --collection minutes --destination ./stock_dataset python3 scripts/download.py --repo-id OpenFinMind/stock_dataset --collection qlib --destination ./stock_dataset ``` Read the CSV files directly, or pass `./stock_dataset/qlib/cn_data`, `us_data`, or `hk_data` as the provider directory to `qlib.init(provider_uri=...)`. Allow approximately 202 GiB for all data files, plus space for download caches and metadata. ### Inventory and verification The [collection manifest](metadata/manifest.json) records file counts and byte totals. The [per-file inventory](metadata/files.jsonl) records each data file's relative path, byte size, and SHA256. ```bash python3 scripts/verify_download.py --repo ./stock_dataset --collection all ``` Use `--collection qlib` or `--collection minutes` to verify one collection.