Datasets:
language:
- en
license: mit
pretty_name: BTCUSDT Microbar v2
tags:
- finance
- cryptocurrency
- market-microstructure
- binance
- futures
- btcusdt
size_categories:
- 10M<n<100M
BTCUSDT Microbar v2
Sub-candle microstructure data for Binance USD-M Futures BTCUSDT, collected continuously over six WebSocket streams. Successor to Torch-Trade/btcusdt-microbar.
A standard OHLCV candle compresses thousands of trades into 6 numbers. This dataset preserves the raw event-level data — every individual trade, every best bid/ask change, every depth snapshot — so the underlying microstructure features can be reconstructed at any timeframe.
Why v2?
In April 2026 we discovered that the v1 collector had a silent routing bug. Binance USD-M Futures split market data across two WebSocket routing paths (/public and /market) — the legacy unified endpoint silently delivered streams that mapped to /public and dropped the rest without error.
Concretely, in v1:
| Stream | v1 status | v2 status |
|---|---|---|
trade |
working | working |
bookTicker |
working | working |
depth5@500ms |
partial (missing during routing migration) | working |
markPrice |
broken (subscriptions silently dropped) | fixed |
miniTicker |
broken (subscriptions silently dropped) | fixed |
forceOrder |
broken (subscriptions silently dropped) | fixed |
If you only need trades and book_ticks, the v1 dataset remains usable. If you need funding rate, mark price, 24h stats, liquidations, or full depth — use v2. We renamed the repo (rather than appending) so consumers get a clean discontinuity instead of a silent quality jump.
The fix is in binance-microbar collector commit f88a52a (group streams by routing path and open one WebSocket per group).
Layout
data/btcusdt/
├── trades/<YYYY-MM-DD>/<HHMMSS>.parquet # individual trades
├── book_ticks/<YYYY-MM-DD>/<HHMMSS>.parquet # best bid/ask updates
├── depth/<YYYY-MM-DD>/<HHMMSS>.parquet # top-5 order book snapshots
├── liquidations/<YYYY-MM-DD>/<HHMMSS>.parquet # forced liquidations
├── mark_price/<YYYY-MM-DD>/<HHMMSS>.parquet # mark price + funding
└── mini_ticker/<YYYY-MM-DD>/<HHMMSS>.parquet # 24h rolling stats
Files are flushed to disk every 60 seconds. Each row carries a timestamp_ms (exchange clock, UTC) which is the only safe key for joins — wall-clock arrival times are not preserved.
Schemas
trades/
| column | type | description |
|---|---|---|
timestamp_ms |
int64 | exchange trade time, ms since epoch UTC |
price |
float64 | trade price (USDT) |
quantity |
float64 | trade quantity (BTC) |
is_buyer_maker |
bool | True = aggressive sell, False = aggressive buy |
Volume: ~50 trades/sec → ~4M rows/day.
book_ticks/
| column | type | description |
|---|---|---|
timestamp_ms |
int64 | exchange event time |
bid_price |
float64 | best bid price |
bid_qty |
float64 | best bid quantity |
ask_price |
float64 | best ask price |
ask_qty |
float64 | best ask quantity |
Volume: ~100 updates/sec → ~8M rows/day.
depth/
Top 5 order book levels. Columns: timestamp_ms, bid_price_0..4, bid_qty_0..4, ask_price_0..4, ask_qty_0..4. Snapshots arrive every 500 ms → ~170k rows/day.
liquidations/
| column | type | description |
|---|---|---|
timestamp_ms |
int64 | liquidation time |
price |
float64 | average fill price |
quantity |
float64 | liquidated size |
side |
string | "BUY" = short squeezed (bullish), "SELL" = long liquidated (bearish) |
Sparse — bursts during volatile moves.
mark_price/
Updates every 3 seconds. Columns: timestamp_ms, mark_price, index_price, funding_rate, next_funding_time_ms. Funding rate is the most predictive macro signal in crypto futures.
mini_ticker/
Updates every second. Columns: timestamp_ms, open_24h, high_24h, low_24h, close, volume_24h, quote_volume_24h. Distance from 24h high/low is a support/resistance signal.
Loading
from huggingface_hub import snapshot_download
import pandas as pd
from pathlib import Path
local = snapshot_download(
"Torch-Trade/btcusdt-microbar-v2",
repo_type="dataset",
allow_patterns=["trades/2026-04-29/*.parquet"],
)
trades = pd.concat(
pd.read_parquet(f) for f in sorted(Path(local, "trades/2026-04-29").glob("*.parquet"))
)
To compute aggregated microstructure features over arbitrary timeframes, use the binance-microbar library — examples/build_feature_dataset.py rebuilds 54-feature ML-ready datasets directly from these raw streams.
Collection
- Source: Binance USD-M Futures public WebSocket streams (no auth required)
- Collector:
binance-microbarat commitf88a52aor later - Host: continuous collection on a Raspberry Pi 5 (
colony1), uploads daily at 03:00 UTC - Coverage: starts 2026-04-29; the immediate prior period (2026-04-28 → 2026-04-29) is missing because the collector was offline for the routing-fix deployment
License
MIT. Market data is sourced from Binance's public WebSocket streams and is provided as-is. No financial advice; not affiliated with Binance.