akashkumar5's picture
Update README.md
8603943 verified
metadata
license: cc-by-4.0
tags:
  - datasets
  - finance
  - timeseries
  - tabular
  - classification
  - market-regime
  - technical-indicators
  - bitcoin
pretty_name: Multi‑Timeframe Market Regimes (HMM‑6) (BTCUSD)

Multi‑Timeframe Market Regimes (HMM‑6)

Dataset Summary

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.

Source & Licensing

  • Raw data: describe the exchange(s), symbols (e.g., BTCUSDT), and the exact ToS allowing redistribution. Replace this section with precise citations/links.
  • 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.

Files

.
├── README.md
└── data/
    ├── train.csv         # chronological split (older → newer)
    ├── validation.csv    # next chunk after train
    └── test.csv          # most recent chunk

Optionally provide Parquet equivalents:

└── data/
    ├── train.parquet
    ├── validation.parquet
    └── test.parquet

Columns

  • timestamp [UTC, ISO8601 or UNIX ms]
  • Multi‑TF OHLCV (5m, 15m, 1h): open_*, high_*, low_*, close_*, volume_*
  • 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
  • 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
  • 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
  • Targets: state (0‑5), regime (string label, optional), post_prob_* (optional soft posteriors per state)

Label Semantics

0: Choppy High‑Vol
1: Range
2: Squeeze
3: Strong Trend
4: Volatility Spike
5: Weak Trend
  • state is the integer id.
  • regime is the human‑readable label (optional redundant column).
  • If available, include HMM posterior probabilities per state: post_prob_0post_prob_5.

Splitting Protocol (leak‑free)

  • Sort by timestamp ascending.
  • Choose three contiguous time blocks: train (oldest), validation (middle), test (most recent).
  • Do not shuffle.
  • If training sequence models, consumers should build sliding windows of length time_steps (e.g., 64) within each split only.

How to Load

Python (CSV):

from datasets import load_dataset
# If you keep the README YAML above, this works without specifying data_files
ds = load_dataset("<user_or_org>/<repo>")
train = ds["train"]
valid = ds["validation"]
# Or explicitly with Parquet
ds = load_dataset("<user_or_org>/<repo>", data_files={
    "train": "data/train.parquet",
    "validation": "data/validation.parquet",
    "test": "data/test.parquet",
})

PyTorch example (windowing):

import torch
import numpy as np
FEATURES = [
    "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",
    "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",
    "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"
]
TARGET = "state"
WINDOW = 64

def make_windows(table):
    X = np.stack([table[f] for f in FEATURES], axis=1)
    y = np.array(table[TARGET])
    Xw, yw = [], []
    for i in range(len(X) - WINDOW + 1):
        Xw.append(X[i:i+WINDOW])
        yw.append(y[i+WINDOW-1])  # label at window end
    return np.stack(Xw), np.array(yw)

Dataset Card Checklist

  • Precise data source + collection dates + timezone
  • License & ToS compliance
  • Exact indicator definitions (lookback windows, smoothing, normalization)
  • HMM configuration (n_states=6, emissions, training window, seed)
  • Train/val/test date ranges
  • Class distribution per split
  • Known caveats & failure modes
  • Version tag (e.g., v1.0.0) and changelog

Known Limitations

  • Technical‑indicator engineered features; not raw trades.
  • Single asset (if BTCUSDT only) may not generalize to alts/FX.
  • Regimes are model‑dependent; HMM re‑fits may shift boundaries.

Changelog

  • v1.0.0 — Initial release.