Datasets:
|
Download README.md from ResearchRL/diffquant-data: direct link, hf CLI and curl.
- Browser
- Download file 12.1 kB
-
https://huggingface.co/datasets/ResearchRL/diffquant-data/resolve/main/README.md
- Command line
-
hf download hf://datasets/ResearchRL/diffquant-data/README.md
-
curl -L -o README.md https://huggingface.co/datasets/ResearchRL/diffquant-data/resolve/main/README.md
12.1 kB
| language: | |
| - en | |
| license: mit | |
| tags: | |
| - finance | |
| - trading | |
| - cryptocurrency | |
| - bitcoin | |
| - time-series | |
| - OHLCV | |
| - binance | |
| - futures | |
| - quantitative-finance | |
| - differentiable-trading | |
| pretty_name: BTCUSDT 1-Min Futures — 5-Year Research Dataset (2021–2025) | |
| size_categories: | |
| - 1M<n<10M | |
| task_categories: | |
| - time-series-forecasting | |
| # BTCUSDT 1-Min Futures — 5-Year Research Dataset (2021–2025) | |
| A gap-free 1-minute OHLCV dataset for **BTCUSDT Binance USDⓈ-M Perpetual Futures** | |
| covering five full calendar years: **2021-01-01 through 2025-12-31 (UTC)**. | |
| This repository contains **raw market bars only**. Feature engineering, aggregation, | |
| sample construction, normalization, and temporal splitting belong to the downstream | |
| [DiffQuant](https://github.com/YuriyKolesnikov/diffquant) pipeline, described below | |
| for reproducibility. | |
| Full codebase: [GitHub Repository](https://github.com/YuriyKolesnikov/diffquant) | |
| --- | |
| ## What this dataset is — and is not | |
| **Is:** | |
| - A clean, gap-free 1-minute futures bar dataset (2,629,440 bars) | |
| - A reproducible research input for intraday quantitative studies | |
| - The primary data source for the DiffQuant differentiable trading pipeline | |
| **Is not:** | |
| - A trading signal or strategy | |
| - A labelled prediction dataset | |
| - An RL environment with rewards or actions | |
| - Order-book, trades, funding rates, open interest, or liquidation data | |
| --- | |
| ## Dataset card | |
| | | | | |
| |---|---| | |
| | **Asset** | BTCUSDT Binance USDⓈ-M Perpetual Futures | | |
| | **Resolution** | 1-minute bars, close-time convention | | |
| | **Period** | 2021-01-01 00:00 UTC → 2025-12-31 23:59 UTC | | |
| | **Total bars** | 2,629,440 | | |
| | **Coverage** | 100.00% — zero gaps | | |
| | **File** | `btcusdt_1min_2021_2025.npz` (40.6 MB, NumPy compressed) | | |
| | **Price range** | $15,502 → $126,087 | | |
| | **OHLC violations** | 0 ✓ | | |
| | **Duplicate timestamps** | 0 ✓ | | |
| | **License** | MIT | | |
| --- | |
| ## Collection and quality assurance | |
| Source: Binance USDⓈ-M Futures public API via internal database. | |
| All bars use **close-time convention** — each timestamp marks the end of the bar. | |
| QA checks applied before release: | |
| - Duplicate timestamp detection | |
| - Full date-range gap scan (minute-level) | |
| - OHLC consistency: `low ≤ min(open, close)` and `high ≥ max(open, close)` | |
| - Negative price and volume checks | |
| - Schema validation across all columns | |
| Results for this release: | |
| | Check | Result | | |
| |---|---| | |
| | Duplicate timestamps | 0 ✓ | | |
| | Missing minutes | 0 ✓ | | |
| | OHLC violations | 0 ✓ | | |
| | Negative prices | 0 ✓ | | |
| | Zero-volume bars | 213 (retained — valid observations) | | |
| --- | |
| ## File structure | |
| ```python | |
| import numpy as np | |
| data = np.load("btcusdt_1min_2021_2025.npz", allow_pickle=True) | |
| bars = data["bars"] # (2_629_440, 6) float32 — raw exchange bars | |
| timestamps = data["timestamps"] # (2_629_440,) int64 — Unix ms UTC, close-time | |
| columns = list(data["columns"]) # ['open', 'high', 'low', 'close', 'volume', 'num_trades'] | |
| meta = str(data["meta"][0]) # provenance string | |
| ``` | |
| ### Channels (raw values) | |
| | Index | Name | Description | | |
| |---|---|---| | |
| | 0 | `open` | First trade price in the bar | | |
| | 1 | `high` | Highest trade price in the bar | | |
| | 2 | `low` | Lowest trade price in the bar | | |
| | 3 | `close` | Last trade price in the bar | | |
| | 4 | `volume` | Total base asset volume (BTC) | | |
| | 5 | `num_trades` | Number of individual trades | | |
| All values are stored as raw floats with no pre-processing applied. | |
| ### Summary statistics | |
| | Channel | Min | Max | Mean | | |
| |---|---|---|---| | |
| | open | 15,502.00 | 126,086.70 | 54,382.59 | | |
| | high | 15,532.20 | 126,208.50 | 54,406.74 | | |
| | low | 15,443.20 | 126,030.00 | 54,358.47 | | |
| | close | 15,502.00 | 126,086.80 | 54,382.60 | | |
| | volume | 0.00 | 40,256.00 | 241.90 | | |
| | num_trades | 0.00 | 263,775.00 | 2,551.55 | | |
| ### Bars by year | |
| ``` | |
| 2021: 525,600 ██████████████████████████████ | |
| 2022: 525,600 ██████████████████████████████ | |
| 2023: 525,600 ██████████████████████████████ | |
| 2024: 527,040 ██████████████████████████████ (leap year) | |
| 2025: 525,600 ██████████████████████████████ | |
| ``` | |
| ### Sample bars | |
| **First 5 bars (2021-01-01):** | |
| | # | Datetime UTC | open | high | low | close | volume | num_trades | | |
| |---|---|---|---|---|---|---|---| | |
| | 0 | 2021-01-01 00:00 | 28939.90 | 28981.55 | 28934.65 | 28951.68 | 126.0 | 929 | | |
| | 1 | 2021-01-01 00:01 | 28948.19 | 28997.16 | 28935.30 | 28991.01 | 143.0 | 1120 | | |
| | 2 | 2021-01-01 00:02 | 28992.98 | 29045.93 | 28991.01 | 29035.18 | 256.0 | 1967 | | |
| | 3 | 2021-01-01 00:03 | 29036.41 | 29036.97 | 28993.19 | 29016.23 | 102.0 | 987 | | |
| | 4 | 2021-01-01 00:04 | 29016.23 | 29023.87 | 28995.50 | 29002.92 | 85.0 | 832 | | |
| **Mid-dataset (2023-07-03):** | |
| | # | Datetime UTC | open | high | low | close | volume | num_trades | | |
| |---|---|---|---|---|---|---|---| | |
| | 1314720 | 2023-07-03 00:00 | 30611.70 | 30615.70 | 30611.70 | 30612.70 | 42.0 | 649 | | |
| | 1314721 | 2023-07-03 00:01 | 30612.70 | 30624.40 | 30612.70 | 30613.90 | 150.0 | 1846 | | |
| | 1314722 | 2023-07-03 00:02 | 30613.90 | 30614.00 | 30600.00 | 30600.00 | 241.0 | 1796 | | |
| **Last 5 bars (2025-12-31):** | |
| | # | Datetime UTC | open | high | low | close | volume | num_trades | | |
| |---|---|---|---|---|---|---|---| | |
| | 2629435 | 2025-12-31 23:55 | 87608.40 | 87608.40 | 87608.30 | 87608.30 | 10.0 | 182 | | |
| | 2629436 | 2025-12-31 23:56 | 87608.40 | 87613.90 | 87608.30 | 87613.90 | 14.0 | 343 | | |
| | 2629437 | 2025-12-31 23:57 | 87613.90 | 87621.70 | 87613.80 | 87621.70 | 7.0 | 231 | | |
| | 2629438 | 2025-12-31 23:58 | 87621.60 | 87631.90 | 87603.90 | 87608.10 | 38.0 | 815 | | |
| | 2629439 | 2025-12-31 23:59 | 87608.10 | 87608.20 | 87608.10 | 87608.20 | 11.0 | 206 | | |
| --- | |
| ## Quick start | |
| ```python | |
| from huggingface_hub import hf_hub_download | |
| import numpy as np | |
| import pandas as pd | |
| path = hf_hub_download( | |
| repo_id = "ResearchRL/diffquant-data", | |
| filename = "btcusdt_1min_2021_2025.npz", | |
| repo_type = "dataset", | |
| ) | |
| data = np.load(path, allow_pickle=True) | |
| bars = data["bars"] # (2_629_440, 6) float32 | |
| ts = data["timestamps"] # Unix ms UTC | |
| index = pd.to_datetime(ts, unit="ms", utc=True) | |
| df = pd.DataFrame(bars, columns=list(data["columns"]), index=index) | |
| print(df.head()) | |
| ``` | |
| --- | |
| ## Reference pipeline: DiffQuant | |
| The dataset is designed to be used with the DiffQuant data pipeline. | |
| Below is a precise description of the transformations applied — included | |
| here so the dataset can be used reproducibly outside DiffQuant as well. | |
| ### Step 1 — Aggregation | |
| Resample from 1-min to any target resolution using clock-aligned buckets. | |
| `origin="epoch"` ensures bars always land on exact boundaries (`:05`, `:10`, …). | |
| Partial buckets at series edges are dropped. | |
| ```python | |
| from data.aggregator import aggregate | |
| from configs.base_config import MasterConfig | |
| cfg = MasterConfig() | |
| cfg.data.timeframe_min = 5 # valid: {1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60} | |
| bars_5m, ts_5m = aggregate(bars_1m, timestamps, cfg) | |
| ``` | |
| ### Step 2 — Feature engineering | |
| Applied channel-by-channel after aggregation. The first bar is always dropped | |
| (no prior close available for log-return computation). | |
| | Channel | Transformation | | |
| |---|---| | |
| | open, high, low, close | `log(price_t / close_{t-1})` — log-return vs previous bar close | | |
| | volume | `log(volume_t / rolling_mean(volume, window) + eps)` — relative intensity | | |
| | num_trades | `log(num_trades_t / rolling_mean(num_trades, window) + eps)` — same | | |
| | typical_price (optional) | `log(((H+L+C)/3)_t / close_{t-1})` | | |
| | time features (optional) | `[sin_hour, cos_hour, sin_dow, cos_dow]` — cyclic UTC encoding | | |
| ### Step 3 — Feature presets | |
| ```python | |
| cfg.data.preset = "ohlc" # 4 channels | |
| cfg.data.preset = "ohlcv" # 5 channels (default) | |
| cfg.data.preset = "full" # 6 channels | |
| cfg.data.add_typical_price = True # +1 channel | |
| cfg.data.add_time_features = True # +4 channels | |
| # Or fully custom: | |
| cfg.data.preset = "custom" | |
| cfg.data.feature_columns = ["close", "volume"] | |
| ``` | |
| ### Step 4 — Temporal splits | |
| The full dataset supports arbitrary split boundaries via `SplitConfig`. | |
| The primary DiffQuant experiment used the following non-overlapping splits: | |
| ``` | |
| Train : 2024-01-01 → 2025-03-31 (15 months — intentionally recent) | |
| Val : 2025-04-01 → 2025-06-30 (3 months) | |
| Test : 2025-07-01 → 2025-09-30 (3 months, out-of-sample) | |
| Backtest : 2025-10-01 → 2025-12-31 (3 months, final hold-out) | |
| ``` | |
| The training window is deliberately limited to 15 months rather than the full | |
| historical record. This keeps the training regime close to the evaluation periods | |
| and minimizes distribution shift. Extending to earlier data is the recommended | |
| first ablation and is straightforward via `SplitConfig.train_start`. | |
| ### Step 5 — Full pipeline one-liner | |
| ```python | |
| from data.pipeline import load_or_build | |
| from configs.base_config import MasterConfig | |
| cfg = MasterConfig() | |
| splits = load_or_build("btcusdt_1min_2021_2025.npz", cfg, cache_dir="data_cache/") | |
| # splits["train"]["full_sequences"] — (N, ctx+hor, F) sliding windows for training | |
| # splits["val"]["raw_features"] — continuous array for walk-forward evaluation | |
| ``` | |
| Results are MD5-hashed and cached on disk. Cache is invalidated automatically | |
| when the config changes (timeframe, preset, split boundaries, feature flags). | |
| --- | |
| ## Project context | |
| This dataset is the data foundation for **DiffQuant**, a research framework | |
| studying direct optimization of trading objectives. | |
| Most ML trading systems face a structural misalignment: models are trained | |
| on proxy losses — MSE, cross-entropy, TD-error — while performance is measured in | |
| realized PnL, Sharpe ratio, and drawdown. DiffQuant studies what happens when | |
| this proxy is removed entirely: the full pipeline from raw features through a | |
| differentiable mark-to-market simulator to the Sharpe ratio becomes a single | |
| computation graph. `loss.backward()` optimizes what the strategy actually earns, | |
| with transaction costs and slippage accounted for in every gradient update. | |
| **Key references:** | |
| - Buehler, H., Gonon, L., Teichmann, J., Wood, B. (2019). *Deep Hedging.* | |
| Quantitative Finance, 19(8). [`arXiv:1802.03042`](https://arxiv.org/abs/1802.03042) | |
| — foundational framework for end-to-end differentiable financial objectives. | |
| - Moody, J., Saffell, M. (2001). *Learning to Trade via Direct Reinforcement.* | |
| IEEE Transactions on Neural Networks, 12(4). | |
| — original formulation of direct PnL optimization as a training objective. | |
| - Khubiev, K., Semenov, M., Podlipnova, I., Khubieva, D. (2026). | |
| *Finance-Grounded Optimization For Algorithmic Trading.* | |
| [`arXiv:2509.04541`](https://arxiv.org/abs/2509.04541) | |
| — closest parallel work on financial loss functions for return prediction. | |
| <p> | |
| <strong>Research article (English · Medium):</strong><br> | |
| <a href="https://medium.com/@YuriKolesnikovAI/diffquant-end-to-end-sharpe-optimization-through-a-differentiable-trading-simulator-a64d428f0fd4">DiffQuant: End-to-End Sharpe Optimization Through a Differentiable Trading Simulator</a> | |
| </p> | |
| <p> | |
| <strong>Статья (Русский · Habr):</strong><br> | |
| <a href="https://habr.com/ru/articles/1022254/">DiffQuant: прямая оптимизация коэффициента Шарпа через дифференцируемый торговый симулятор</a> | |
| </p> | |
| <p> | |
| <strong>DiffQuant pipeline:</strong> | |
| <a href="https://github.com/YuriyKolesnikov/diffquant">github.com/YuriyKolesnikov/diffquant</a> | |
| </p> | |
| --- | |
| ## Citation | |
| ```bibtex | |
| @dataset{Kolesnikov2026diffquant_data, | |
| author = {Kolesnikov, Yuriy}, | |
| title = {{BTCUSDT} 1-Min Futures — 5-Year Research Dataset (2021--2025)}, | |
| year = {2026}, | |
| publisher = {Hugging Face}, | |
| url = {https://huggingface.co/datasets/ResearchRL/diffquant-data}, | |
| } | |
| ``` |