Update README.md
Browse files
README.md
CHANGED
|
@@ -16,12 +16,18 @@ pretty_name: Multi‑Timeframe Market Regimes (HMM‑6) (BTCUSD)
|
|
| 16 |
|
| 17 |
## Dataset Summary
|
| 18 |
|
| 19 |
-
|
|
|
|
| 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 |
|
|
@@ -29,9 +35,9 @@ Labeled crypto market regimes derived from multi‑timeframe OHLCV features and
|
|
| 29 |
.
|
| 30 |
├── README.md
|
| 31 |
└── data/
|
| 32 |
-
├── train.csv #
|
| 33 |
-
├── validation.csv #
|
| 34 |
-
└── test.csv # most recent
|
| 35 |
```
|
| 36 |
|
| 37 |
Optionally provide Parquet equivalents:
|
|
@@ -42,90 +48,144 @@ Optionally provide Parquet equivalents:
|
|
| 42 |
├── validation.parquet
|
| 43 |
└── test.parquet
|
| 44 |
```
|
|
|
|
|
|
|
| 45 |
|
| 46 |
## Columns
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 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 |
-
##
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
2: Squeeze
|
| 61 |
-
3: Strong Trend
|
| 62 |
-
4: Volatility Spike
|
| 63 |
-
5: Weak Trend
|
| 64 |
-
```
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
-
|
| 71 |
|
| 72 |
-
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
```python
|
| 82 |
from datasets import load_dataset
|
| 83 |
-
|
| 84 |
-
ds = load_dataset("
|
| 85 |
train = ds["train"]
|
| 86 |
valid = ds["validation"]
|
| 87 |
-
|
| 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.
|
|
|
|
| 16 |
|
| 17 |
## Dataset Summary
|
| 18 |
|
| 19 |
+
This dataset provides labeled crypto market regimes derived from multi-timeframe (5m, 15m) OHLCV data and technical indicators.
|
| 20 |
+
Market regimes are inferred using a 6-state Hidden Markov Model (HMM).
|
| 21 |
|
| 22 |
+
The dataset is suitable for market regime detection, regime-aware modeling, and sequence modeling baselines (LSTM / Transformers).
|
| 23 |
+
|
| 24 |
+
No future leakage: all indicators are computed using information available up to the timestamp, and labels correspond to the inferred regime at that timestamp only.
|
| 25 |
## Source & Licensing
|
| 26 |
+
* **Asset**: BTC (BTCUSD / BTCUSDT – specify exact symbol)
|
| 27 |
+
* **Exchange**: specify exchange (e.g., Binance)
|
| 28 |
+
* **Market**: spot or perpetual futures
|
| 29 |
+
* **Timezone**: UTC
|
| 30 |
|
|
|
|
|
|
|
| 31 |
|
| 32 |
## Files
|
| 33 |
|
|
|
|
| 35 |
.
|
| 36 |
├── README.md
|
| 37 |
└── data/
|
| 38 |
+
├── train.csv # oldest part
|
| 39 |
+
├── validation.csv # middle part
|
| 40 |
+
└── test.csv # most recent data
|
| 41 |
```
|
| 42 |
|
| 43 |
Optionally provide Parquet equivalents:
|
|
|
|
| 48 |
├── validation.parquet
|
| 49 |
└── test.parquet
|
| 50 |
```
|
| 51 |
+
All splits are chronological.
|
| 52 |
+
No shuffling is performed.
|
| 53 |
|
| 54 |
## Columns
|
| 55 |
|
| 56 |
+
### Core
|
| 57 |
+
- `timestamp` — UTC timestamp (ISO8601 or UNIX ms)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
+
### OHLCV (contextual)
|
| 60 |
+
- `open_5m`, `high_5m`, `low_5m`, `close_5m`, `volume_5m`
|
| 61 |
+
- `open_15m`, `high_15m`, `low_15m`, `close_15m`, `volume_15m`
|
| 62 |
|
| 63 |
+
OHLCV columns are included for **context and visualization** and are **not required** for training the HMM.
|
| 64 |
+
|
| 65 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
+
### Technical Indicators (5m)
|
| 68 |
+
- `log_ret_1_5m`
|
| 69 |
+
- `ema_ratio_9_21_5m`
|
| 70 |
+
- `macd_hist_5m`
|
| 71 |
+
- `adx_5m`
|
| 72 |
+
- `atr_norm_5m`
|
| 73 |
+
- `bb_width_5m`
|
| 74 |
+
- `rsi_14_5m`
|
| 75 |
+
- `volume_zscore_50_5m`
|
| 76 |
+
|
| 77 |
+
### Technical Indicators (15m)
|
| 78 |
+
- `log_ret_1_15m`
|
| 79 |
+
- `ema_ratio_9_21_15m`
|
| 80 |
+
- `macd_hist_15m`
|
| 81 |
+
- `adx_15m`
|
| 82 |
+
- `atr_norm_15m`
|
| 83 |
+
- `bb_width_15m`
|
| 84 |
+
- `rsi_14_15m`
|
| 85 |
+
- `volume_zscore_50_15m`
|
| 86 |
|
| 87 |
+
---
|
| 88 |
|
| 89 |
+
## Targets
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
+
- `state` — integer HMM state label (0–5)
|
| 92 |
+
- `regime` — human-readable semantic label mapped from `state`
|
| 93 |
+
|
| 94 |
+
### Regime Semantics
|
| 95 |
+
|
| 96 |
+
| State | Regime |
|
| 97 |
+
|------:|--------|
|
| 98 |
+
| 0 | Choppy High-Vol |
|
| 99 |
+
| 1 | Range |
|
| 100 |
+
| 2 | Squeeze |
|
| 101 |
+
| 3 | Strong Trend |
|
| 102 |
+
| 4 | Volatility Spike |
|
| 103 |
+
| 5 | Weak Trend |
|
| 104 |
+
|
| 105 |
+
**Notes**
|
| 106 |
+
- `state` IDs are **model-dependent and arbitrary**
|
| 107 |
+
- `regime` labels are **post-hoc human interpretations**
|
| 108 |
+
- For modeling, use `state` as the target
|
| 109 |
|
| 110 |
+
---
|
| 111 |
+
## Columns
|
| 112 |
+
|
| 113 |
+
### Core
|
| 114 |
+
- `timestamp` �� UTC timestamp (ISO8601 or UNIX ms)
|
| 115 |
+
|
| 116 |
+
### OHLCV (contextual)
|
| 117 |
+
- `open_5m`, `high_5m`, `low_5m`, `close_5m`, `volume_5m`
|
| 118 |
+
- `open_15m`, `high_15m`, `low_15m`, `close_15m`, `volume_15m`
|
| 119 |
+
|
| 120 |
+
OHLCV columns are included for **context and visualization** and are **not required** for training the HMM.
|
| 121 |
+
|
| 122 |
+
---
|
| 123 |
+
|
| 124 |
+
### Technical Indicators (5m)
|
| 125 |
+
- `log_ret_1_5m`
|
| 126 |
+
- `ema_ratio_9_21_5m`
|
| 127 |
+
- `macd_hist_5m`
|
| 128 |
+
- `adx_5m`
|
| 129 |
+
- `atr_norm_5m`
|
| 130 |
+
- `bb_width_5m`
|
| 131 |
+
- `rsi_14_5m`
|
| 132 |
+
- `volume_zscore_50_5m`
|
| 133 |
+
|
| 134 |
+
### Technical Indicators (15m)
|
| 135 |
+
- `log_ret_1_15m`
|
| 136 |
+
- `ema_ratio_9_21_15m`
|
| 137 |
+
- `macd_hist_15m`
|
| 138 |
+
- `adx_15m`
|
| 139 |
+
- `atr_norm_15m`
|
| 140 |
+
- `bb_width_15m`
|
| 141 |
+
- `rsi_14_15m`
|
| 142 |
+
- `volume_zscore_50_15m`
|
| 143 |
+
|
| 144 |
+
---
|
| 145 |
+
|
| 146 |
+
## Targets
|
| 147 |
+
|
| 148 |
+
- `state` — integer HMM state label (0–5)
|
| 149 |
+
- `regime` — human-readable semantic label mapped from `state`
|
| 150 |
+
|
| 151 |
+
### Regime Semantics
|
| 152 |
+
|
| 153 |
+
| State | Regime |
|
| 154 |
+
|------:|--------|
|
| 155 |
+
| 0 | Choppy High-Vol |
|
| 156 |
+
| 1 | Range |
|
| 157 |
+
| 2 | Squeeze |
|
| 158 |
+
| 3 | Strong Trend |
|
| 159 |
+
| 4 | Volatility Spike |
|
| 160 |
+
| 5 | Weak Trend |
|
| 161 |
+
|
| 162 |
+
**Notes**
|
| 163 |
+
- `state` IDs are **model-dependent and arbitrary**
|
| 164 |
+
- `regime` labels are **post-hoc human interpretations**
|
| 165 |
+
- For modeling, use `state` as the target
|
| 166 |
+
|
| 167 |
+
---
|
| 168 |
+
## Splitting Protocol (Leak-Free)
|
| 169 |
+
|
| 170 |
+
1. Sort data by `timestamp` (ascending)
|
| 171 |
+
2. Split into **contiguous** blocks:
|
| 172 |
+
- train → validation → test
|
| 173 |
+
3. Do **not** shuffle
|
| 174 |
+
4. Sliding windows for sequence models must be constructed **within each split only**
|
| 175 |
+
|
| 176 |
+
---
|
| 177 |
+
|
| 178 |
+
## How to Load
|
| 179 |
|
| 180 |
```python
|
| 181 |
from datasets import load_dataset
|
| 182 |
+
|
| 183 |
+
ds = load_dataset("akashkumar5/Multi_Timeframe_Market_Regimes_HMM6_BTCUSD")
|
| 184 |
train = ds["train"]
|
| 185 |
valid = ds["validation"]
|
| 186 |
+
test = ds["test"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
```
|
| 188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
## Known Limitations
|
| 190 |
|
| 191 |
* Technical‑indicator engineered features; not raw trades.
|