Files
foxhunt/find_6e_contracts.py
jgrusewski e8a68ee39f Download 360 DBN files (36.3 MB) using Rust databento client
- Created data/examples/download_ml_training_data.rs using reqwest + Databento HTTP API
- Downloaded 90 days × 4 symbols (ES.FUT, NQ.FUT, ZN.FUT, 6E.FUT)
- Files saved to test_data/real/databento/ml_training/
- Total: 360 files, 15 MB compressed DBN format
- Used existing Rust pattern from download_nq_fut.rs
- API key loaded from .env file
- 100% success rate (360/360 files)
- Ready for ML training benchmarks

Next: Create simplified training benchmark for RTX 3050 Ti GPU measurements
2025-10-13 13:30:02 +02:00

89 lines
2.7 KiB
Python

#!/usr/bin/env python3
"""
Find available 6E (Euro FX) contract symbols in Databento.
"""
import os
import databento as db
import sys
def main():
# Check for API key
api_key = os.environ.get("DATABENTO_API_KEY")
if not api_key:
print("ERROR: DATABENTO_API_KEY environment variable not set")
sys.exit(1)
# Create client
client = db.Historical(api_key)
print("=" * 70)
print("Searching for 6E (Euro FX) contract symbols")
print("=" * 70)
# CME Euro FX Futures contracts for Jan 2024
# Contract months: H=Mar, M=Jun, U=Sep, Z=Dec
# For Jan 2024, we want:
# - 6EH24 (Mar 2024 expiry) - active in Jan
# - 6EM24 (Jun 2024 expiry) - may have volume
# - 6EU24 (Sep 2024 expiry) - may have volume
test_symbols = [
"6EH24", # March 2024 expiry (most active for Jan 2024)
"6EM24", # June 2024 expiry
"6EU24", # September 2024 expiry
"6EZ23", # December 2023 expiry (may still be active early Jan)
"6E", # Continuous contract
"6E.c.0", # Front month continuous
]
print("\nTesting symbols:")
for symbol in test_symbols:
print(f" - {symbol}")
print()
# Try to resolve each symbol
dataset = "GLBX.MDP3"
schema = "ohlcv-1m"
start_date = "2024-01-02"
end_date = "2024-01-05" # Just 3 days for testing
working_symbols = []
for symbol in test_symbols:
try:
cost = client.metadata.get_cost(
dataset=dataset,
symbols=[symbol],
schema=schema,
start=start_date,
end=end_date
)
print(f"{symbol:12s} - Cost: ${cost:.4f} (for 3 days)")
working_symbols.append((symbol, cost))
except Exception as e:
print(f"{symbol:12s} - Error: {str(e)[:60]}")
if working_symbols:
print()
print("=" * 70)
print("RECOMMENDED SYMBOLS FOR FULL DOWNLOAD (30 days)")
print("=" * 70)
for symbol, cost_3days in working_symbols:
# Extrapolate cost for 30 days
estimated_cost_30days = cost_3days * (30 / 3)
print(f"{symbol:12s} - Estimated cost for 30 days: ${estimated_cost_30days:.4f}")
# Recommend best option
print()
best_symbol = min(working_symbols, key=lambda x: x[1])
print(f"💡 RECOMMENDED: Use {best_symbol[0]} (lowest cost)")
print(f" Estimated 30-day cost: ${best_symbol[1] * 10:.4f}")
else:
print()
print("❌ No working symbols found!")
print("Try checking Databento documentation for correct symbology.")
if __name__ == "__main__":
main()