Files
foxhunt/scripts/python/data/find_6e_contracts.py
jgrusewski 433af5c25d chore: Major codebase cleanup - remove deprecated files and organize structure
- Docker: Delete 23 deprecated Dockerfiles, fix CI/CD to use Dockerfile.foxhunt-build
- Config: Remove 36 .env files, keep 4 essential, delete config/environments/
- Docs: Archive 614 Wave D files to docs/archive/wave_d/, 95% reduction in root
- Scripts: Delete 56 deprecated scripts, keep 58 production-critical (49% reduction)
- Python: Organize 37 scripts into scripts/python/ subdirectories, delete ml/python/
- Build: Remove 1GB artifacts, delete old venvs, clean Python cache from git
- Migrations: Delete deprecated directory (4,432 lines), remove duplicate database/migrations/
- Infrastructure: Delete deployment/ (61 files), docs/scripts/ (8 files)

Total impact: ~2,500 files cleaned, 750MB+ space freed, zero production impact
All deleted scripts backed up to archives. runpod/ and tests/runpod/ preserved.
data_acquisition_service retained per user request.
2025-10-30 01:02:34 +01: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()