commanderzee commited on
Commit
f059345
·
verified ·
1 Parent(s): c976a58

Update README: combined file structure + daily updater docs

Browse files
Files changed (1) hide show
  1. README.md +54 -28
README.md CHANGED
@@ -16,55 +16,81 @@ size_categories:
16
 
17
  # 1-Second Crypto OHLCV Data (Binance)
18
 
19
- Historical 1-second kline (candlestick) data for 6 major cryptocurrencies
20
  downloaded from [Binance Vision](https://data.binance.vision/).
 
21
 
22
  ## Assets
23
 
24
- | Symbol | Start | End |
25
  |----------|------------|------------|
26
- | BTCUSDT | 2019-01 | 2026-03 |
27
- | ETHUSDT | 2019-01 | 2026-03 |
28
- | BNBUSDT | 2019-01 | 2026-03 |
29
- | XRPUSDT | 2019-01 | 2026-03 |
30
- | DOGEUSDT | 2019-07 | 2026-03 |
31
- | SOLUSDT | 2020-10 | 2026-03 |
32
-
33
- ## Schema
34
-
35
- | Column | Type | Description |
36
- |--------------|---------|----------------------------------|
37
- | open_time_s | int64 | Unix timestamp in **seconds** |
38
- | open | float64 | 1-second open price |
39
- | high | float64 | 1-second high price |
40
- | low | float64 | 1-second low price |
41
- | close | float64 | 1-second close price |
42
- | volume | float64 | Base asset volume |
43
 
44
  ## File Structure
45
 
46
  ```
47
- data/{SYMBOL}/{SYMBOL}_{YEAR}.parquet
 
48
  ```
49
 
50
- Each file is one calendar year for one asset, Snappy-compressed Parquet.
 
 
 
 
 
 
 
 
 
51
 
52
  ## Usage
53
 
54
  ```python
55
  import pandas as pd
56
 
57
- # Load one asset, one year
58
  df = pd.read_parquet(
59
- "hf://datasets/commanderzee/1s-crypto-data/data/BTCUSDT/BTCUSDT_2024.parquet"
60
  )
61
 
62
- # Load all years for one asset
63
- from datasets import load_dataset
64
- ds = load_dataset("commanderzee/1s-crypto-data", data_files="data/BTCUSDT/*.parquet")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  ```
66
 
 
 
67
  ## Source
68
 
69
- All data sourced from [Binance Vision](https://data.binance.vision/) public archives.
70
- Timestamps normalised to Unix seconds (integer division of raw ms/μs timestamps).
 
 
16
 
17
  # 1-Second Crypto OHLCV Data (Binance)
18
 
19
+ Historical 1-second kline (OHLCV) data for 6 major cryptocurrencies
20
  downloaded from [Binance Vision](https://data.binance.vision/).
21
+ Updated daily — never more than 24h behind.
22
 
23
  ## Assets
24
 
25
+ | Symbol | Start | Updated |
26
  |----------|------------|------------|
27
+ | BTCUSDT | 2019-01 | daily |
28
+ | ETHUSDT | 2019-01 | daily |
29
+ | BNBUSDT | 2019-01 | daily |
30
+ | XRPUSDT | 2019-01 | daily |
31
+ | DOGEUSDT | 2019-07 | daily |
32
+ | SOLUSDT | 2020-10 | daily |
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  ## File Structure
35
 
36
  ```
37
+ data/{SYMBOL}_1s.parquet ← full history, one file per asset
38
+ scripts/daily_update.py ← run to append latest daily data
39
  ```
40
 
41
+ ## Schema
42
+
43
+ | Column | Type | Description |
44
+ |--------------|---------|-------------------------------|
45
+ | open_time_s | int64 | Unix timestamp in **seconds** |
46
+ | open | float64 | 1-second open price |
47
+ | high | float64 | 1-second high price |
48
+ | low | float64 | 1-second low price |
49
+ | close | float64 | 1-second close price |
50
+ | volume | float64 | Base asset volume |
51
 
52
  ## Usage
53
 
54
  ```python
55
  import pandas as pd
56
 
57
+ # Load one asset (full history, ~200M rows for BTC)
58
  df = pd.read_parquet(
59
+ "hf://datasets/commanderzee/1s-crypto-data/data/BTCUSDT_1s.parquet"
60
  )
61
 
62
+ # Load all assets
63
+ SYMBOLS = ["BTCUSDT","ETHUSDT","BNBUSDT","XRPUSDT","DOGEUSDT","SOLUSDT"]
64
+ frames = {
65
+ sym: pd.read_parquet(
66
+ f"hf://datasets/commanderzee/1s-crypto-data/data/{sym}_1s.parquet"
67
+ )
68
+ for sym in SYMBOLS
69
+ }
70
+ ```
71
+
72
+ ## Daily Auto-Update
73
+
74
+ The `scripts/daily_update.py` checks the latest timestamp in each asset's
75
+ Parquet, downloads any missing days from Binance Vision's
76
+ [daily 1s endpoint](https://data.binance.vision/?prefix=data/spot/daily/klines/),
77
+ appends new rows, and re-uploads.
78
+
79
+ ```bash
80
+ # Run manually (requires HF_TOKEN with write access):
81
+ HF_TOKEN=<your_token> python scripts/daily_update.py
82
+
83
+ # Dry-run (shows what would be fetched, no upload):
84
+ HF_TOKEN=<your_token> python scripts/daily_update.py --dry-run
85
+
86
+ # Update specific symbols only:
87
+ HF_TOKEN=<your_token> python scripts/daily_update.py --symbols BTCUSDT ETHUSDT
88
  ```
89
 
90
+ Binance publishes daily files roughly 2–4h after UTC midnight.
91
+
92
  ## Source
93
 
94
+ All data from [Binance Vision](https://data.binance.vision/) public archives.
95
+ Timestamps normalised to Unix seconds (integer division from raw ms/μs timestamps).
96
+ Duplicate bars removed; rows sorted ascending by `open_time_s`.