File size: 5,528 Bytes
51f2e1e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
---
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/<year>/<1分钟|5分钟|15分钟|30分钟|60分钟>/<stock>.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/<symbol>/*.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.