Skip to content

Commit e0a6da4

Browse files
author
Stefan Jansen
committed
fix: harden storage writes and update workflows
1 parent a7d9df3 commit e0a6da4

22 files changed

Lines changed: 416 additions & 103 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ fred = FREDProvider().fetch_series("GDP", "2020-01-01", "2024-12-31")
106106
| EODHD | 60+ global exchanges |
107107
| Tiingo | US equities with quality focus |
108108
| Twelve Data | Multi-asset coverage |
109-
| Databento | CME, CBOE, ICE futures/options |
109+
| Databento | CME/ICE futures; OPRA available via native SDK |
110110
| Massive | US equities, options, futures, forex, crypto |
111111
| Finnhub | 70+ global exchanges |
112112
| Binance | Crypto exchange data |

docs/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Complete documentation for the ML4T Data market data library.
2222
- **[Cryptocurrency Guide](asset-classes/crypto.md)** - CoinGecko, CryptoCompare (free tier available)
2323
- **[Equities Guide](asset-classes/equities.md)** - US & Global stocks, ETFs (7 providers)
2424
- **[Forex Guide](asset-classes/forex.md)** - OANDA, currency pairs, forex trading
25-
- **[Futures Guide](asset-classes/futures.md)** - Databento, derivatives, institutional data
25+
- **[Futures Guide](asset-classes/futures.md)** - Databento futures and institutional data
2626

2727
---
2828

@@ -61,7 +61,7 @@ Complete documentation for the ML4T Data market data library.
6161

6262
### Provider-Specific
6363

64-
- **[Databento Reference](providers/databento_reference.md)** - Futures and derivatives
64+
- **[Databento Reference](providers/databento_reference.md)** - Futures and native Databento datasets
6565
- **[Yahoo Finance](yahoo_provider.md)** - Free stock data (legacy)
6666
- **[Crypto Providers](crypto_providers.md)** - Cryptocurrency data sources
6767

@@ -133,7 +133,7 @@ Quick comparison of all 14 providers:
133133
| **OANDA** ||||| Demo | Professional forex |
134134
| **Twelve Data** ||||| 800/day | Multi-asset |
135135
| **Polygon** ||||| 5/min | Multi-asset (paid) |
136-
| **Databento** || ⚠️ || | None | Institutional futures |
136+
| **Databento** || ⚠️ || ⚠️ native SDK | None | Institutional futures |
137137
| **Yahoo** ||||| Unlimited | Free stocks (unreliable) |
138138
| **Binance** ||||| 1200/min | Crypto exchange data |
139139

@@ -184,9 +184,9 @@ eurusd = provider.fetch_ohlcv("EUR_USD", "2024-01-01", "2024-12-31", frequency="
184184
### Get Started with Futures
185185

186186
```python
187-
from ml4t.data.providers import DatabentoProvider
187+
from ml4t.data.providers import DataBentoProvider
188188

189-
provider = DatabentoProvider(api_key="your_key", dataset="GLBX.MDP3")
189+
provider = DataBentoProvider(api_key="your_key", dataset="GLBX.MDP3")
190190
es = provider.fetch_ohlcv("ES.v.0", "2024-01-01", "2024-12-31") # S&P 500 futures
191191
```
192192

docs/asset-classes/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ df = provider.fetch_ohlcv("EUR_USD", start="2024-01-01", end="2024-12-31", frequ
104104

105105
---
106106

107-
### [📉 Futures & Options Data Guide](./futures.md)
107+
### [Futures Data Guide](./futures.md)
108108

109-
**Asset Classes**: Futures Contracts, Options on Futures
110-
**Providers**: Databento (primary), Polygon
109+
**Asset Classes**: Futures Contracts
110+
**Providers**: Databento (primary), Massive for listed options
111111
**Difficulty**: 🔴 Advanced
112112
**Free Tier**: ❌ None (Databento requires paid subscription ~$30-50/month)
113113

@@ -119,9 +119,9 @@ df = provider.fetch_ohlcv("EUR_USD", start="2024-01-01", end="2024-12-31", frequ
119119

120120
**Quick start**:
121121
```python
122-
from ml4t.data.providers import DatabentoProvider
122+
from ml4t.data.providers import DataBentoProvider
123123

124-
provider = DatabentoProvider(api_key="your_key", dataset="GLBX.MDP3")
124+
provider = DataBentoProvider(api_key="your_key", dataset="GLBX.MDP3")
125125
df = provider.fetch_ohlcv("ES.v.0", start="2024-01-01", end="2024-12-31") # S&P 500 futures
126126
```
127127

@@ -191,7 +191,7 @@ df = provider.fetch_ohlcv("ES.v.0", start="2024-01-01", end="2024-12-31") # S&P
191191
| **OANDA** ||||| Demo account | Required | Professional forex |
192192
| **Twelve Data** ||||| 800/day | Required | Multi-asset |
193193
| **Polygon** ||||| 5/min | Required | Multi-asset (paid) |
194-
| **Databento** || ⚠️ || | None | Required | Institutional futures |
194+
| **Databento** || ⚠️ || ⚠️ native SDK | None | Required | Institutional futures |
195195

196196
**Legend**:
197197
- ✅ Full support

docs/asset-classes/futures.md

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
# Futures & Options Data Guide
1+
# Futures Data Guide
22

3-
**Asset Classes**: Futures contracts, Options on futures
4-
**Available Providers**: Databento (primary), Polygon
3+
**Asset Classes**: Futures contracts
4+
**Available Providers**: Databento (primary), Massive for listed options
55
**Difficulty**: Advanced (requires understanding of derivatives mechanics)
66
**Recommended For**: Institutional strategies, derivatives research, quantitative trading
77

88
---
99

1010
## Overview
1111

12-
ML4T Data provides access to **institutional-grade futures and options data** through Databento, the gold standard for derivatives market data. Futures markets have unique complexities:
12+
ML4T Data provides access to institutional-grade futures data through Databento.
13+
Futures markets have unique complexities:
1314

1415
- **Expiration & Rolling**: Contracts expire monthly/quarterly, requiring continuous contract construction
15-
- **Multiple Exchanges**: CME, CBOE, ICE, Eurex - each with different conventions
16+
- **Multiple Exchanges**: CME, ICE, Eurex, and others each have different conventions
1617
- **Session Times**: Futures trade nearly 24 hours with complex session breaks
1718
- **Tick Data**: Ultra-high-frequency data (microsecond timestamps)
1819
- **Margin Requirements**: Leveraged instruments with daily mark-to-market
@@ -21,10 +22,12 @@ ML4T Data provides access to **institutional-grade futures and options data** th
2122

2223
| Provider | Coverage | Free Tier | Data Quality | Best For |
2324
|----------|----------|-----------|--------------|----------|
24-
| **Databento** | CME, CBOE, ICE + more |Paid only | ⭐⭐⭐⭐⭐ Institutional | Professional futures trading |
25+
| **Databento** | CME/ICE/Eurex futures; OPRA via native SDK | Paid only | Institutional | Professional futures trading |
2526
| **Polygon** | Limited futures | 5/min | ⭐⭐⭐ Good | Multi-asset portfolios |
2627

27-
**Important**: Futures data is **NOT free**. Databento requires paid subscription (~$30-50/month minimum for historical data).
28+
**Important**: Futures data is not free. Databento requires a paid subscription
29+
for most historical workflows. First-class Databento OPRA option-chain and quote
30+
helpers are planned but not yet implemented in ml4t-data.
2831

2932
---
3033

@@ -36,19 +39,19 @@ ML4T Data provides access to **institutional-grade futures and options data** th
3639
-**Normalized data** - Consistent schemas across all exchanges
3740
-**Continuous contracts** - Automatic front-month rolling (.v.0 notation)
3841
-**Tick-level precision** - Microsecond timestamps
39-
-**CME, CBOE, ICE, Eurex** - Major derivatives exchanges worldwide
40-
-**Multiple schemas** - OHLCV, trades, quotes, market-by-order
42+
-**CME, ICE, Eurex** - Major futures exchanges worldwide
43+
-**Selected schemas** - OHLCV plus direct access to native Databento schemas
4144

4245
**Best for**: Quantitative futures strategies, high-frequency trading, institutional research
4346

4447
### Quick Start
4548

4649
```python
47-
from ml4t.data.providers import DatabentoProvider
50+
from ml4t.data.providers import DataBentoProvider
4851

4952
# Get API key from: https://databento.com/
5053
# NOTE: Requires paid subscription ($30-50/month minimum)
51-
provider = DatabentoProvider(
54+
provider = DataBentoProvider(
5255
api_key="your_databento_api_key", # Or set DATABENTO_API_KEY env var
5356
dataset="GLBX.MDP3" # CME Globex futures (default)
5457
)
@@ -191,31 +194,33 @@ Databento provides data from multiple exchanges:
191194

192195
```python
193196
# CME Globex (most futures)
194-
provider = DatabentoProvider(dataset="GLBX.MDP3")
197+
provider = DataBentoProvider(dataset="GLBX.MDP3")
195198

196199
# CME (all CME markets)
197-
provider = DatabentoProvider(dataset="CME.MDP3")
200+
provider = DataBentoProvider(dataset="CME.MDP3")
198201

199-
# CBOE Options (equity options)
200-
provider = DatabentoProvider(dataset="OPRA.PILLAR")
202+
# OPRA options through the native client for advanced workflows
203+
provider = DataBentoProvider(dataset="OPRA.PILLAR")
204+
client = provider.client
201205

202206
# US Equities
203-
provider = DatabentoProvider(dataset="XNAS.ITCH") # NASDAQ
204-
provider = DatabentoProvider(dataset="XNYS.TRADES") # NYSE
207+
provider = DataBentoProvider(dataset="XNAS.ITCH") # NASDAQ
208+
provider = DataBentoProvider(dataset="XNYS.TRADES") # NYSE
205209
```
206210

207211
**Available datasets**:
208212
- `GLBX.MDP3` - CME Globex (futures, options on futures)
209213
- `CME.MDP3` - CME (all markets)
210214
- `XCME.MDP3` - CME Crypto
211-
- `OPRA.PILLAR` - CBOE Equity Options
215+
- `OPRA.PILLAR` - OPRA listed options (native client; first-class helpers planned)
212216
- `XNAS.ITCH` - NASDAQ Equities
213217
- `XNYS.TRADES` - NYSE Equities
214218
- `BATS.PITCH` - BATS Equities
215219

216220
### Schemas (Data Types)
217221

218-
Databento supports multiple data schemas beyond OHLCV:
222+
Databento supports multiple data schemas beyond OHLCV. The wrapper exposes
223+
selected schema fetches and the native client for advanced workflows:
219224

220225
```python
221226
# OHLCV aggregations
@@ -234,14 +239,14 @@ Databento supports multiple data schemas beyond OHLCV:
234239
**Example: Fetching tick data**:
235240

236241
```python
237-
provider = DatabentoProvider(dataset="GLBX.MDP3", default_schema="trades")
242+
provider = DataBentoProvider(dataset="GLBX.MDP3")
238243

239244
# Fetch trade-by-trade data for ES
240245
trades = provider.fetch_ohlcv(
241246
symbol="ES.v.0",
242247
start="2024-11-04",
243248
end="2024-11-04",
244-
frequency="tick" # Uses default_schema="trades"
249+
frequency="tick" # requests Databento trades schema
245250
)
246251

247252
# Result: Every single trade with microsecond timestamps
@@ -288,7 +293,7 @@ Futures markets trade nearly 24 hours with session breaks:
288293
# But in UTC: Monday 00:00 - Tuesday 22:00
289294

290295
# Databento handles this with adjust_session_dates
291-
provider = DatabentoProvider(
296+
provider = DataBentoProvider(
292297
dataset="GLBX.MDP3",
293298
adjust_session_dates=True, # Align dates with session start
294299
session_start_hour_utc=22 # 22:00 UTC = 5:00 PM CT (CST)
@@ -310,16 +315,16 @@ for symbol in symbols:
310315
# 50 symbols = 50 requests = completes in 0.5 seconds
311316
```
312317

313-
**Live WebSocket**: Unlimited (within subscription limits)
318+
**Live WebSocket**: Use Databento's native SDK directly.
314319

315320
### Complete Example: Multi-Contract Strategy
316321

317322
```python
318-
from ml4t.data.providers import DatabentoProvider
323+
from ml4t.data.providers import DataBentoProvider
319324
import polars as pl
320325

321326
# Initialize provider
322-
provider = DatabentoProvider(
327+
provider = DataBentoProvider(
323328
dataset="GLBX.MDP3",
324329
adjust_session_dates=True
325330
)
@@ -375,7 +380,7 @@ except DataNotAvailableError as e:
375380

376381
try:
377382
# Using expired API key
378-
provider = DatabentoProvider(api_key="expired_key")
383+
provider = DataBentoProvider(api_key="expired_key")
379384
except AuthenticationError as e:
380385
print(f"Authentication failed: {e}")
381386
# Renew subscription or check API key
@@ -579,7 +584,7 @@ annual_roll_cost = roll_cost_dollars * annual_rolls * num_contracts
579584
# Daily break: 4:00 PM - 5:00 PM CT
580585

581586
# Use adjust_session_dates for proper date alignment
582-
provider = DatabentoProvider(
587+
provider = DataBentoProvider(
583588
adjust_session_dates=True,
584589
session_start_hour_utc=22 # 5:00 PM CT = 22:00 UTC (CST)
585590
)

docs/getting-started/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Some providers require additional dependencies:
3030
# Yahoo Finance (included by default)
3131
pip install "ml4t-data[yahoo]"
3232

33-
# DataBento (institutional futures/options)
33+
# DataBento (institutional futures)
3434
pip install "ml4t-data[databento]"
3535

3636
# OANDA (forex)

docs/getting-started/provider-selection.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ flowchart TD
7373
| **Finnhub** |||||| Yes | Paid only | Professional grade |
7474
| **Twelve Data** |||||| Yes | 800/day | Multi-asset + indicators |
7575
| **OANDA** |||||| Yes | No | Professional forex |
76-
| **Databento** |||||| Yes | Paid only | Institutional derivatives |
76+
| **Databento** |||||| Yes | Paid only | Institutional futures |
7777
| **Polygon** |||||| Yes | Paid only | Professional multi-asset |
7878

7979
### By Pricing
@@ -105,7 +105,7 @@ flowchart TD
105105
|----------|----------------|--------------|
106106
| **Finnhub** | $59.99/mo | Historical OHLCV, 70+ exchanges |
107107
| **Polygon** | $99/mo | Multi-asset, professional-grade |
108-
| **Databento** | Custom | Institutional derivatives data |
108+
| **Databento** | Custom | Institutional futures data |
109109

110110
## Decision Guidelines
111111

@@ -125,7 +125,7 @@ flowchart TD
125125
3. **Finnhub** - Real-time + historical, professional grade
126126

127127
### For Institutions
128-
1. **Databento** - Tick-level derivatives data
128+
1. **Databento** - Tick-level futures data
129129
2. **Polygon** - Multi-asset professional data
130130
3. **Finnhub** - Global exchange coverage
131131

docs/provider-selection-guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ flowchart TD
7373
| **Finnhub** |||||| Yes | Paid only | Professional grade |
7474
| **Twelve Data** |||||| Yes | 800/day | Multi-asset + indicators |
7575
| **OANDA** |||||| Yes | No | Professional forex |
76-
| **Databento** |||||| Yes | Paid only | Institutional derivatives |
76+
| **Databento** |||||| Yes | Paid only | Institutional futures |
7777
| **Polygon** |||||| Yes | Paid only | Professional multi-asset |
7878

7979
### By Pricing
@@ -105,7 +105,7 @@ flowchart TD
105105
|----------|----------------|--------------|
106106
| **Finnhub** | $59.99/mo | Historical OHLCV, 70+ exchanges |
107107
| **Polygon** | $99/mo | Multi-asset, professional-grade |
108-
| **Databento** | Custom | Institutional derivatives data |
108+
| **Databento** | Custom | Institutional futures data |
109109

110110
## Decision Guidelines
111111

@@ -125,7 +125,7 @@ flowchart TD
125125
3. **Finnhub** - Real-time + historical, professional grade
126126

127127
### For Institutions
128-
1. **Databento** - Tick-level derivatives data
128+
1. **Databento** - Tick-level futures data
129129
2. **Polygon** - Multi-asset professional data
130130
3. **Finnhub** - Global exchange coverage
131131

docs/providers/PROVIDER_AUDIT.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ This document provides a comprehensive audit of all 21 data providers in ml4t-da
107107
| TBBO (Top of book) | Yes | MEDIUM |
108108
| Trades (tick) | Yes | MEDIUM |
109109
| WebSocket streaming | Yes | NOT SUPPORTING |
110-
| OPRA options | Yes | HIGH |
110+
| OPRA options | Yes | HIGH - planned first-class support |
111111
| Symbology API | Yes | LOW |
112112

113113
#### Coverage
@@ -391,7 +391,8 @@ This document provides a comprehensive audit of all 21 data providers in ml4t-da
391391
| Quick start (free) | YahooFinance |
392392
| US equities (production) | EODHD or Massive |
393393
| Global equities | EODHD |
394-
| Futures/options | Databento |
394+
| Futures | Databento |
395+
| Listed options | Massive; Databento OPRA support planned |
395396
| Crypto | BinancePublic |
396397
| Forex | Oanda |
397398
| Academic factors | Fama-French + AQR |

docs/providers/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ For detailed pricing, terms, and gap analysis, see [PROVIDER_AUDIT.md](PROVIDER_
7575
|----------|--------|--------|-------|---------|--------------|
7676
| YahooFinance | ✅ (7d) |||* |* |
7777
| Alpaca ||||||
78-
| Databento |||| (OPRA) ||
78+
| Databento |||| Planned (OPRA) ||
7979
| Massive ||||||
8080
| EODHD |||| ✅ ($29.99) | ✅ ($59.99) |
8181
| Tiingo ||||||
@@ -177,7 +177,8 @@ print(f"Total history: {len(combined)} trading days")
177177
| Quick start (free) | YahooFinance |
178178
| US equities (production) | EODHD or Massive |
179179
| Global equities | EODHD |
180-
| Futures/options | Databento |
180+
| Futures | Databento |
181+
| Listed options | Massive; Databento OPRA support planned |
181182
| Crypto | BinancePublic |
182183
| Forex | Oanda |
183184
| Academic factors | Fama-French + AQR |

0 commit comments

Comments
 (0)