Update README.md
Browse files
README.md
CHANGED
|
@@ -28,66 +28,50 @@ configs:
|
|
| 28 |
path: data/ohlcv_*.parquet
|
| 29 |
---
|
| 30 |
|
|
|
|
| 31 |
|
| 32 |
-
|
| 33 |
|
| 34 |
-
|
| 35 |
|
| 36 |
-
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
```python
|
| 41 |
-
|
| 42 |
-
df = pd.read_parquet("https://huggingface.co/datasets/mito0o852/OHLCV-1m/resolve/main/data/ohlcv_1992-01.parquet")
|
| 43 |
|
|
|
|
|
|
|
| 44 |
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
This doesn't fix the viewer, but it makes it usable for others.
|
| 47 |
|
| 48 |
-
---
|
| 49 |
|
| 50 |
-
#
|
| 51 |
|
| 52 |
-
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
import datasets
|
| 57 |
-
|
| 58 |
-
class OHLCVDataset(datasets.GeneratorBasedBuilder):
|
| 59 |
-
def _info(self):
|
| 60 |
-
return datasets.DatasetInfo(
|
| 61 |
-
features=datasets.Features({
|
| 62 |
-
'timestamp': datasets.Value('timestamp[s]'),
|
| 63 |
-
'open': datasets.Value('float32'),
|
| 64 |
-
'high': datasets.Value('float32'),
|
| 65 |
-
'low': datasets.Value('float32'),
|
| 66 |
-
'close': datasets.Value('float32'),
|
| 67 |
-
'volume': datasets.Value('float32'),
|
| 68 |
-
'ticker': datasets.Value('string')
|
| 69 |
-
})
|
| 70 |
-
)
|
| 71 |
-
|
| 72 |
-
def _split_generators(self, dl_manager):
|
| 73 |
-
parquet_files = [f"data/ohlcv_{year}-{str(month).zfill(2)}.parquet"
|
| 74 |
-
for year in range(1992, 2025+1)
|
| 75 |
-
for month in range(1, 13)]
|
| 76 |
-
urls = [f"https://huggingface.co/datasets/mito0o852/OHLCV-1m/resolve/main/{f}" for f in parquet_files]
|
| 77 |
-
return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"files": dl_manager.download(urls)})]
|
| 78 |
-
|
| 79 |
-
def _generate_examples(self, files):
|
| 80 |
-
key = 0
|
| 81 |
-
for file in files:
|
| 82 |
-
df = pd.read_parquet(file)
|
| 83 |
-
for row in df.itertuples(index=False):
|
| 84 |
-
yield key, {
|
| 85 |
-
'timestamp': row.timestamp,
|
| 86 |
-
'open': row.open,
|
| 87 |
-
'high': row.high,
|
| 88 |
-
'low': row.low,
|
| 89 |
-
'close': row.close,
|
| 90 |
-
'volume': row.volume,
|
| 91 |
-
'ticker': row.ticker,
|
| 92 |
-
}
|
| 93 |
-
key += 1
|
|
|
|
| 28 |
path: data/ohlcv_*.parquet
|
| 29 |
---
|
| 30 |
|
| 31 |
+
# 📈 OHLCV-1m: US Stock Market Minute-Level Candlestick Data (1992–2025)
|
| 32 |
|
| 33 |
+
This dataset provides minute-level OHLCV (Open, High, Low, Close, Volume) candlestick data for thousands of U.S. stocks across multiple decades (1992 to 2025). The data was originally sourced from [Finnhub.io](https://finnhub.io), a real-time market data provider.
|
| 34 |
|
| 35 |
+
It has been aggregated and reformatted from monthly `.tar` archives into clean and unified Parquet files — one per month — and uploaded to the Hugging Face Hub for easy access.
|
| 36 |
|
| 37 |
+
## 🧾 Dataset Structure
|
| 38 |
|
| 39 |
+
Each row in the dataset represents **one minute** of trading for a given stock ticker, and includes the following columns:
|
| 40 |
+
|
| 41 |
+
| Column | Type | Description |
|
| 42 |
+
|------------|------------------------------|-------------------------------------|
|
| 43 |
+
| `timestamp`| `datetime64[ns, UTC]` | Start time of the minute |
|
| 44 |
+
| `open` | `float64` | Opening price |
|
| 45 |
+
| `high` | `float64` | Highest price within the minute |
|
| 46 |
+
| `low` | `float64` | Lowest price within the minute |
|
| 47 |
+
| `close` | `float64` | Closing price |
|
| 48 |
+
| `volume` | `float64` | Volume traded within the minute |
|
| 49 |
+
| `ticker` | `string` | Stock ticker symbol |
|
| 50 |
+
|
| 51 |
+
The data is split by month into files like:
|
| 52 |
+
|
| 53 |
+
data/ohlcv_1992-01.parquet
|
| 54 |
+
data/ohlcv_1992-02.parquet
|
| 55 |
+
...
|
| 56 |
+
data/ohlcv_2025-05.parquet
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
## 📚 Usage
|
| 60 |
|
| 61 |
```python
|
| 62 |
+
from datasets import load_dataset
|
|
|
|
| 63 |
|
| 64 |
+
# Load the dataset (will stream across all months)
|
| 65 |
+
ds = load_dataset("mito0o852/OHLCV-1m", split="train")
|
| 66 |
|
| 67 |
+
# View one row
|
| 68 |
+
print(ds[0])
|
| 69 |
|
|
|
|
| 70 |
|
|
|
|
| 71 |
|
| 72 |
+
# To convert it into a pandas DataFrame:
|
| 73 |
|
| 74 |
+
import pandas as pd
|
| 75 |
|
| 76 |
+
df = ds.to_pandas()
|
| 77 |
+
print(df.head())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|