Update README.md
Browse files
README.md
CHANGED
@@ -11,5 +11,127 @@ tags:
|
|
11 |
- bitcoin
|
12 |
pretty_name: Multi‑Timeframe Market Regimes (HMM‑6) (BTCUSD)
|
13 |
---
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
- bitcoin
|
12 |
pretty_name: Multi‑Timeframe Market Regimes (HMM‑6) (BTCUSD)
|
13 |
---
|
14 |
+
|
15 |
+
# Multi‑Timeframe Market Regimes (HMM‑6)
|
16 |
+
|
17 |
+
## Dataset Summary
|
18 |
+
|
19 |
+
Labeled crypto market regimes derived from multi‑timeframe OHLCV features and technical indicators (5m, 15m, 1h). Labels come from a 6‑state Hidden Markov Model (HMM). Useful for regime detection and sequence modeling baselines (LSTM/Transformers). **No future leakage**: indicators computed only up to `timestamp` and labels correspond to the regime at that timestamp.
|
20 |
+
|
21 |
+
## Source & Licensing
|
22 |
+
|
23 |
+
* **Raw data**: describe the exchange(s), symbols (e.g., `BTCUSDT`), and the exact ToS allowing redistribution. Replace this section with precise citations/links.
|
24 |
+
* **License**: change the license above if the data source requires a specific license. If redistribution isn’t allowed, provide a script to regenerate labels from the original source instead of shipping raw candles.
|
25 |
+
|
26 |
+
## Files
|
27 |
+
|
28 |
+
```
|
29 |
+
.
|
30 |
+
├── README.md
|
31 |
+
└── data/
|
32 |
+
├── train.csv # chronological split (older → newer)
|
33 |
+
├── validation.csv # next chunk after train
|
34 |
+
└── test.csv # most recent chunk
|
35 |
+
```
|
36 |
+
|
37 |
+
Optionally provide Parquet equivalents:
|
38 |
+
|
39 |
+
```
|
40 |
+
└── data/
|
41 |
+
├── train.parquet
|
42 |
+
├── validation.parquet
|
43 |
+
└── test.parquet
|
44 |
+
```
|
45 |
+
|
46 |
+
## Columns
|
47 |
+
|
48 |
+
* `timestamp` \[UTC, ISO8601 or UNIX ms]
|
49 |
+
* **Multi‑TF OHLCV (5m, 15m, 1h)**: `open_*`, `high_*`, `low_*`, `close_*`, `volume_*`
|
50 |
+
* **Indicators (15m)**: `log_ret_1_15m`, `ema_slope_21_15m`, `price_vs_ema55_15m`, `macd_hist_15m`, `adx_15m`, `atr_norm_15m`, `bb_width_15m`, `realized_vol_20_15m`, `rsi_15m`, `roc_15m`, `stoch_k_15m`, `wick_ratio_15m`
|
51 |
+
* **Indicators (5m)**: `log_ret_1_5m`, `ema_slope_21_5m`, `price_vs_ema55_5m`, `macd_hist_5m`, `adx_5m`, `atr_norm_5m`, `bb_width_5m`, `realized_vol_20_5m`, `rsi_5m`, `roc_5m`, `stoch_k_5m`, `wick_ratio_5m`
|
52 |
+
* **Indicators (1h)**: `log_ret_1_1h`, `ema_slope_21_1h`, `price_vs_ema55_1h`, `macd_hist_1h`, `adx_1h`, `atr_norm_1h`, `bb_width_1h`, `realized_vol_20_1h`, `rsi_1h`, `roc_1h`, `stoch_k_1h`, `wick_ratio_1h`
|
53 |
+
* **Targets**: `state` (0‑5), `regime` (string label, optional), `post_prob_*` (optional soft posteriors per state)
|
54 |
+
|
55 |
+
## Label Semantics
|
56 |
+
|
57 |
+
```
|
58 |
+
0: Choppy High‑Vol
|
59 |
+
1: Range
|
60 |
+
2: Squeeze
|
61 |
+
3: Strong Trend
|
62 |
+
4: Volatility Spike
|
63 |
+
5: Weak Trend
|
64 |
+
```
|
65 |
+
|
66 |
+
* `state` is the integer id.
|
67 |
+
* `regime` is the human‑readable label (optional redundant column).
|
68 |
+
* If available, include HMM posterior probabilities per state: `post_prob_0` … `post_prob_5`.
|
69 |
+
|
70 |
+
## Splitting Protocol (leak‑free)
|
71 |
+
|
72 |
+
* Sort by `timestamp` ascending.
|
73 |
+
* Choose three **contiguous** time blocks: `train` (oldest), `validation` (middle), `test` (most recent).
|
74 |
+
* Do **not** shuffle.
|
75 |
+
* If training sequence models, consumers should build sliding windows of length `time_steps` (e.g., 64) **within** each split only.
|
76 |
+
|
77 |
+
## How to Load
|
78 |
+
|
79 |
+
Python (CSV):
|
80 |
+
|
81 |
+
```python
|
82 |
+
from datasets import load_dataset
|
83 |
+
# If you keep the README YAML above, this works without specifying data_files
|
84 |
+
ds = load_dataset("<user_or_org>/<repo>")
|
85 |
+
train = ds["train"]
|
86 |
+
valid = ds["validation"]
|
87 |
+
# Or explicitly with Parquet
|
88 |
+
ds = load_dataset("<user_or_org>/<repo>", data_files={
|
89 |
+
"train": "data/train.parquet",
|
90 |
+
"validation": "data/validation.parquet",
|
91 |
+
"test": "data/test.parquet",
|
92 |
+
})
|
93 |
+
```
|
94 |
+
|
95 |
+
PyTorch example (windowing):
|
96 |
+
|
97 |
+
```python
|
98 |
+
import torch
|
99 |
+
import numpy as np
|
100 |
+
FEATURES = [
|
101 |
+
"log_ret_1_15m","ema_slope_21_15m","price_vs_ema55_15m","macd_hist_15m","adx_15m","atr_norm_15m","bb_width_15m","realized_vol_20_15m","rsi_15m","roc_15m","stoch_k_15m","wick_ratio_15m",
|
102 |
+
"log_ret_1_5m","ema_slope_21_5m","price_vs_ema55_5m","macd_hist_5m","adx_5m","atr_norm_5m","bb_width_5m","realized_vol_20_5m","rsi_5m","roc_5m","stoch_k_5m","wick_ratio_5m",
|
103 |
+
"log_ret_1_1h","ema_slope_21_1h","price_vs_ema55_1h","macd_hist_1h","adx_1h","atr_norm_1h","bb_width_1h","realized_vol_20_1h","rsi_1h","roc_1h","stoch_k_1h","wick_ratio_1h"
|
104 |
+
]
|
105 |
+
TARGET = "state"
|
106 |
+
WINDOW = 64
|
107 |
+
|
108 |
+
def make_windows(table):
|
109 |
+
X = np.stack([table[f] for f in FEATURES], axis=1)
|
110 |
+
y = np.array(table[TARGET])
|
111 |
+
Xw, yw = [], []
|
112 |
+
for i in range(len(X) - WINDOW + 1):
|
113 |
+
Xw.append(X[i:i+WINDOW])
|
114 |
+
yw.append(y[i+WINDOW-1]) # label at window end
|
115 |
+
return np.stack(Xw), np.array(yw)
|
116 |
+
```
|
117 |
+
|
118 |
+
## Dataset Card Checklist
|
119 |
+
|
120 |
+
* [ ] Precise data source + collection dates + timezone
|
121 |
+
* [ ] License & ToS compliance
|
122 |
+
* [ ] Exact indicator definitions (lookback windows, smoothing, normalization)
|
123 |
+
* [ ] HMM configuration (n\_states=6, emissions, training window, seed)
|
124 |
+
* [ ] Train/val/test date ranges
|
125 |
+
* [ ] Class distribution per split
|
126 |
+
* [ ] Known caveats & failure modes
|
127 |
+
* [ ] Version tag (e.g., v1.0.0) and changelog
|
128 |
+
|
129 |
+
## Known Limitations
|
130 |
+
|
131 |
+
* Technical‑indicator engineered features; not raw trades.
|
132 |
+
* Single asset (if BTCUSDT only) may not generalize to alts/FX.
|
133 |
+
* Regimes are **model‑dependent**; HMM re‑fits may shift boundaries.
|
134 |
+
|
135 |
+
## Changelog
|
136 |
+
|
137 |
+
* v1.0.0 — Initial release.
|