Intelligence, Advanced Charting & Trading Platform
feature/chartnova-multimarket-chart-ws-foundation
diagnostics/chartnova-blank-screen-2026-10-15
diagnostics/chartnova-stage2-v27-preview-2026-10-15
docs/chartnova-stage1-reconcile-manifest-2026-10-15
feature/chartnova-ios-widget
feature/chartnova-light-catalog-lazy-series-2026-10-15
feature/chartnova-market-terminal
feature/chartnova-multimarket-chart-ws-foundation
feature/chartnova-neon-direct-history
feature/chartnova-neon-history
feature/paper-trading-risk-controls-2026-10-14
fix/alpha-vantage-live-payload
fix/chartnova-progressive-loading-2026-10-15
fix/live-proof-runner-cwd-2026-10-14
foundation/phase-0
foundation/postgres-core
main
ops/chartnova-emergency-rollback-2026-10-15
phase-1/candle-builder
phase-1/data-proof-artifact
phase-1/data-proof-metrics
phase-1/data-proof-report
phase-1/external-gates-state
phase-1/gold-api-fallback
phase-1/ingestion-pipeline
phase-1/live-proof-runner
phase-1/market-calendar
phase-1/market-domain
phase-1/neon-live-proof
phase-1/persistence-contract
phase-1/postgres-ci
phase-1/provider-adapters
phase-1/provider-recovery
phase-1/quality-propagation
phase-1/spike-detection
phase-1/xau-provider-adapter
risk/chartnova-alert-runtime-atomic-2026-10-22
risk/chartnova-atomic-outbox-2026-10-22
risk/chartnova-seven-track-safety-2026-10-21
safety/p0-triage-2026-10-13
| 1 | #!/usr/bin/env python3 |
| 2 | """Explicitly research-only Yahoo Finance export. Not part of production ingestion. |
| 3 | |
| 4 | The yfinance project states that downloaded Yahoo data is intended for personal use. |
| 5 | Do NOT use this command to seed the commercial ChartNova database or public APIs. |
| 6 | """ |
| 7 | import argparse |
| 8 | import csv |
| 9 | from datetime import date |
| 10 | import re |
| 11 | import sys |
| 12 | |
| 13 | def main(): |
| 14 | parser = argparse.ArgumentParser(description="Research-only yfinance OHLC export to stdout.") |
| 15 | parser.add_argument("--symbol", required=True, help="Yahoo Finance symbol, e.g. ^GSPC") |
| 16 | parser.add_argument("--start", required=True, help="YYYY-MM-DD") |
| 17 | parser.add_argument("--end", required=True, help="YYYY-MM-DD (exclusive)") |
| 18 | parser.add_argument("--interval", choices=["1d", "1h"], default="1d") |
| 19 | parser.add_argument("--acknowledge-research-only", action="store_true", required=True) |
| 20 | args = parser.parse_args() |
| 21 | if not args.acknowledge_research_only: |
| 22 | parser.error("Must acknowledge research-only, personal-use limitations") |
| 23 | if not re.fullmatch(r"[A-Za-z0-9^._=\-]{1,40}", args.symbol): |
| 24 | parser.error("Invalid Yahoo ticker") |
| 25 | try: |
| 26 | start = date.fromisoformat(args.start) |
| 27 | end = date.fromisoformat(args.end) |
| 28 | except ValueError: |
| 29 | parser.error("Dates must be valid YYYY-MM-DD") |
| 30 | if end <= start: |
| 31 | parser.error("End must be after start") |
| 32 | try: |
| 33 | import yfinance as yf |
| 34 | except ImportError: |
| 35 | parser.error("Research dependency missing: install yfinance in an isolated Python environment") |
| 36 | |
| 37 | frame = yf.Ticker(args.symbol).history( |
| 38 | start=args.start, end=args.end, interval=args.interval, |
| 39 | auto_adjust=False, actions=False, |
| 40 | ) |
| 41 | if frame.empty: |
| 42 | print("No vendor rows returned; nothing exported.", file=sys.stderr) |
| 43 | return 2 |
| 44 | print( |
| 45 | "RESEARCH ONLY — Yahoo Finance rights are not verified for " |
| 46 | "ChartNova commercial storage or redistribution.", file=sys.stderr |
| 47 | ) |
| 48 | csvout = csv.writer(sys.stdout) |
| 49 | csvout.writerow(["source","rights","symbol","interval","source_timestamp","open","high","low","close","volume"]) |
| 50 | for stamp, row in frame.iterrows(): |
| 51 | if stamp.tzinfo is None: |
| 52 | raise ValueError("Provider returned timezone-naive timestamp; cannot safely export") |
| 53 | csvout.writerow([ |
| 54 | "yfinance","research_only",args.symbol,args.interval, |
| 55 | stamp.isoformat(),row["Open"],row["High"],row["Low"],row["Close"],row.get("Volume", ""), |
| 56 | ]) |
| 57 | return 0 |
| 58 | |
| 59 | if __name__ == "__main__": |
| 60 | raise SystemExit(main()) |