File size: 12,955 Bytes
95255d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
06adfab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
---
dataset_info:
  features:
  - name: series
    list:
      list: float64
  - name: timestamps
    list: float64
  - name: sequence_length
    dtype: int64
  - name: num_variates
    dtype: int64
  - name: series_id
    dtype: string
  - name: sampling_start_time
    dtype: float64
  - name: sampling_frequency
    dtype: string
  - name: domain
    dtype: string
  - name: metric_type
    dtype: string
  - name: subcategory
    dtype: string
  - name: ticker
    dtype: string
  - name: window_start_date
    dtype: string
  - name: window_end_date
    dtype: string
  - name: target_next_close
    dtype: float64
  - name: target_next_return
    dtype: float64
  - name: target_direction
    dtype: int64
  - name: feature_names
    list: string
  splits:
  - name: train
    num_bytes: 4197315557
    num_examples: 89901
  - name: test
    num_bytes: 524728706
    num_examples: 11239
  - name: validation
    num_bytes: 524635198
    num_examples: 11237
  download_size: 4791768007
  dataset_size: 5246679461
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
  - split: test
    path: data/test-*
  - split: validation
    path: data/validation-*
---

# Dataset Card for FinTime Dataset


![image/png](https://cdn-uploads.huggingface.co/production/uploads/6324ce4d5d0cf5c62c6e3c5a/BFHYZ0_BO_N_YxrX3dNKl.png)

## Dataset Summary

**FinTime Dataset** is a comprehensive, large-scale financial time series dataset designed for training and evaluating decoder-only models on financial forecasting tasks across diverse asset classes and market conditions.
Composed of real-world market data spanning equities, cryptocurrencies, forex, commodities, and indices, the dataset captures the complexity, volatility, and multi-scale dynamics typical of financial markets. Enhanced with 80+ technical indicators and statistical features, FinTime provides a rich foundation for developing and benchmarking time series foundation models in financial domains.

The dataset covers 697 carefully curated financial instruments from January 2010 to July 2025, encompassing major market cycles including the 2020 pandemic crash, crypto boom/bust cycles, and various economic regimes. Unlike synthetic or limited-scope financial datasets, FinTime reflects the full spectrum of market behaviors observed across different asset classes and time periods.

FinTime consists of approximately 2-5 million sequences across 697 tickers, with each sequence containing 64 timesteps and 87 features. The dataset employs a sliding window approach with configurable overlap to maximize training data while maintaining temporal consistency. Each sequence represents a comprehensive view of market dynamics through multiple lenses:

- **Price Action**: OHLCV data capturing basic market movements
- **Momentum Indicators**: RSI, Stochastic, Williams %R revealing market sentiment
- **Trend Analysis**: Moving averages, MACD, ADX identifying directional bias  
- **Volatility Measures**: ATR, Bollinger Bands, VIX-like indicators capturing risk
- **Volume Dynamics**: VWAP, OBV, accumulation/distribution patterns
- **Statistical Features**: Z-scores, percentile ranks, higher-order moments
- **Temporal Context**: Calendar effects, seasonality, time-based features

Key characteristics that make FinTime particularly challenging and realistic:

- **Regime Changes**: Captures bull/bear markets, crisis periods, and structural shifts
- **Cross-Asset Correlations**: Includes correlated and uncorrelated instrument pairs
- **High-Frequency Patterns**: Intraday volatility, gap dynamics, and microstructure effects
- **Non-Stationarity**: Evolving market relationships and changing volatility regimes
- **Heavy-Tailed Distributions**: Extreme events, fat tails, and asymmetric returns
- **Multi-Scale Dependencies**: Short-term noise, medium-term trends, long-term cycles

## Evaluating Models on FinTime

We provide comprehensive evaluation frameworks and baseline implementations; see the [code repository](https://github.com/your-username/fintime-dataset).

## Dataset Structure

Each entry in the dataset consists of:

- A multivariate time series with 87 features across 64 timesteps (daily frequency)
- Comprehensive metadata including timestamps, sampling information, and asset classification
- Target variables for next-period forecasting (price, returns, direction)
- Feature attribution for interpretability and ablation studies

### Data Schema (BOOM-Compatible Format)

```json
{
  "series": [[...], [...], ...],           // 87 features × 64 timesteps
  "timestamps": [1577836800, ...],         // Unix timestamps  
  "sequence_length": 64,
  "num_variates": 87,
  
  "series_id": "AAPL_0",
  "sampling_start_time": 1577836800.0,
  "sampling_frequency": "daily",
  "domain": "financial",
  "metric_type": "equity",
  "subcategory": "sp500",
  
  "ticker": "AAPL",
  "window_start_date": "2023-01-01", 
  "window_end_date": "2023-03-05",
  
  "target_next_close": 150.25,
  "target_next_return": 0.0123,
  "target_direction": 1,
  
  "feature_names": ["open", "high", "low", ...]
}
```

### Feature Categories

| Category | Features | Count | Description |
|----------|----------|-------|-------------|
| **Basic OHLCV** | Open, High, Low, Close, Volume, Adj Close | 6 | Core price and volume data |
| **Momentum** | RSI, Stochastic, Williams %R, ROC, MFI | 7 | Oscillators and momentum indicators |
| **Trend** | SMA, EMA, MACD, PSAR, ADX, Aroon | 12 | Trend-following and directional indicators |
| **Volatility** | ATR, Bollinger Bands, Donchian, Keltner | 10 | Volatility and range-based measures |
| **Volume** | VWAP, OBV, A/D Line, CMF, EOM, VPT | 8 | Volume-weighted and flow indicators |
| **Price Patterns** | Returns, Spreads, Gaps, Price Position | 12 | Price-derived statistical features |
| **Statistical** | Z-scores, Ranks, Skewness, Kurtosis | 8 | Higher-order statistical moments |
| **Cyclical** | CCI, DPO, Fisher Transform | 3 | Cycle and mean-reversion indicators |
| **Stochastic** | Brownian Motion, Drift, Volatility | 4 | Random walk and noise components |
| **Temporal** | Year, Month, Day, Day of Week | 7 | Calendar and seasonality effects |
| **Total** | | **87 features** | |

## Collection and Sources

Data is sourced from Yahoo Finance API, providing comprehensive coverage of global financial markets. The collection process employs:

- **Rate-Limited Retrieval**: Respectful API usage with configurable delays
- **Quality Validation**: Automated checks for data completeness and consistency  
- **Error Handling**: Robust retry logic and missing data interpolation
- **Incremental Updates**: Efficient data refresh and historical backfill capabilities

The preprocessing pipeline includes:
- Data cleaning and outlier detection (>50% daily moves filtered)
- Technical indicator calculation using pandas-ta library
- Feature normalization via StandardScaler/MinMaxScaler
- Sequence generation with overlapping windows
- Target variable engineering for forecasting tasks

## Asset Universe Coverage

| Asset Class | Count | Examples | Coverage |
|------------|-------|----------|----------|
| **Equities** | 503 | S&P 500, NASDAQ 100, Dow Jones | Large-cap US stocks |
| **Cryptocurrency** | 50 | BTC, ETH, major altcoins | Top cryptocurrencies |
| **Forex** | 28 | EUR/USD, GBP/JPY, major pairs | Major currency pairs |
| **Commodities** | 15 | Gold, Oil, Agricultural futures | Key commodity markets |
| **Indices** | 25 | SPY, QQQ, VIX, global indices | Market benchmarks |
| **ETFs** | 76 | Sector, thematic, bond ETFs | Diversified instruments |
| **Total** | **697** | | Global coverage |

## Comparison with Other Financial Datasets

FinTime differs significantly from traditional financial benchmarks in several key dimensions:

- **Scale**: 2-5M sequences vs. typical datasets with <100K samples
- **Feature Richness**: 87 engineered features vs. basic OHLCV (5 features)
- **Asset Diversity**: 697 instruments across 6 asset classes vs. single-asset focus
- **Temporal Coverage**: 15+ years including multiple market regimes vs. limited periods
- **Format Compatibility**: BOOM-style format optimized for foundation models

Statistical analysis reveals FinTime's unique characteristics:
- Higher spectral entropy indicating complex temporal dynamics
- Non-Gaussian return distributions with heavy tails and skewness
- Regime-dependent correlations and time-varying volatility
- Multi-scale dependencies from intraday to multi-year cycles

## Model Training Considerations

### Decoder-Only Architecture Benefits
- **Autoregressive Generation**: Natural fit for sequential financial data
- **Attention Mechanisms**: Capture long-range dependencies and regime changes
- **Scalability**: Efficient training on large sequence datasets
- **Transfer Learning**: Pre-trained models can adapt to new assets/markets

### Evaluation Metrics
- **Next-Step Prediction**: Accuracy for price/return forecasting
- **Directional Accuracy**: Binary classification performance
- **Risk-Adjusted Returns**: Sharpe ratio, maximum drawdown
- **Regime Robustness**: Performance across different market conditions

### Baseline Models
We provide implementations and benchmarks for:
- **Statistical Models**: ARIMA, GARCH, Vector Autoregression
- **Machine Learning**: Random Forest, XGBoost, LightGBM
- **Deep Learning**: LSTM, Transformer, specialized time series architectures
- **Foundation Models**: GPT-style decoders, time series transformers

## Usage Examples

### Loading the Dataset

```python
from datasets import load_dataset

# Load complete dataset
dataset = load_dataset("your-username/fintime-dataset")

# Access splits
train_data = dataset["train"] 
val_data = dataset["validation"]
test_data = dataset["test"]

# Filter by asset class
equity_data = dataset.filter(lambda x: x["metric_type"] == "equity")
crypto_data = dataset.filter(lambda x: x["metric_type"] == "crypto")
```

### PyTorch Integration

```python
import torch
from torch.utils.data import DataLoader

class FinTimeDataset(torch.utils.data.Dataset):
    def __init__(self, hf_dataset, sequence_length=64):
        self.hf_dataset = hf_dataset
        self.sequence_length = sequence_length
    
    def __getitem__(self, idx):
        sample = self.hf_dataset[idx]
        
        # Extract features and targets
        features = torch.tensor(sample['series'], dtype=torch.float32)  # [87, 64]
        target_return = torch.tensor(sample['target_next_return'], dtype=torch.float32)
        target_direction = torch.tensor(sample['target_direction'], dtype=torch.long)
        
        return {
            'features': features.transpose(0, 1),  # [64, 87] for transformer input
            'target_return': target_return,
            'target_direction': target_direction,
            'timestamps': torch.tensor(sample['timestamps']),
            'ticker': sample['ticker']
        }

# Create DataLoader
dataset = FinTimeDataset(train_data)
dataloader = DataLoader(dataset, batch_size=32, shuffle=True)
```

### Streaming for Large-Scale Training

```python
# Memory-efficient streaming
dataset = load_dataset("your-username/fintime-dataset", streaming=True)

# Process in chunks
for batch in dataset["train"].iter(batch_size=1000):
    # Mini-batch training
    features = torch.stack([torch.tensor(item['series']) for item in batch])
    targets = torch.tensor([item['target_next_return'] for item in batch])
    
    # Training step
    optimizer.zero_grad()
    predictions = model(features)
    loss = criterion(predictions, targets)
    loss.backward()
    optimizer.step()
```

## Links

- [Code Repository](https://github.com/your-username/fintime-dataset)
- [Model Benchmarks](https://huggingface.co/spaces/your-username/fintime-leaderboard)
- [Technical Documentation](https://github.com/your-username/fintime-dataset/wiki)
- [Dataset Generator Pipeline](https://github.com/your-username/fintime-dataset/tree/main/src)

## Citation

```bibtex
@dataset{fintime2025,
  title={FinTime Dataset: Large-Scale Financial Time Series for Foundation Model Training},
  author={Claude Code},
  year={2025},
  publisher={Hugging Face},
  url={https://huggingface.co/datasets/your-username/fintime-dataset},
  note={Generated with Claude Code}
}
```

## License

This dataset is released under the Apache License 2.0. The underlying financial data is sourced from Yahoo Finance, which provides this data for educational and research purposes.

## Acknowledgments

- Yahoo Finance for providing comprehensive market data access
- pandas-ta library for robust technical indicator implementations  
- Hugging Face for dataset infrastructure and hosting
- BOOM dataset authors for establishing evaluation frameworks for time series foundation models
- The quantitative finance community for domain expertise and validation

---

**Generated with [Claude Code](https://claude.ai/code)**

**Co-Authored-By**: Claude <noreply@anthropic.com>