Skip to content

[codex] Refactor Yahoo support to use direct yfinance#2

Merged
dachent merged 1 commit into
mainfrom
codex/refactor-yahoo-to-yfinance
Apr 5, 2026
Merged

[codex] Refactor Yahoo support to use direct yfinance#2
dachent merged 1 commit into
mainfrom
codex/refactor-yahoo-to-yfinance

Conversation

@dachent
Copy link
Copy Markdown
Owner

@dachent dachent commented Apr 5, 2026

Summary

  • replace the old yf_marketdata wrapper with direct Yahoo Finance support via yfinance
  • add scripts/fetch_yfinance.py for history and current_snapshot
  • remove the YAML-driven export path and obsolete template/script files

Why

The previous Yahoo path depended on an external helper repo and a YAML config flow that was heavier than the rest of aMDT. This change keeps Yahoo support inside the repo, aligns it with the other provider helpers, and preserves the useful retry, cache, and wide snapshot behavior.

What changed

  • add scripts/fetch_yfinance.py with CLI-based dataset selection and export controls
  • remove scripts/run_yf_marketdata.py
  • remove assets/yf_marketdata.template.yaml
  • update README, skill metadata, normalization notes, and Yahoo reference docs for direct yfinance

Validation

  • python -m py_compile across scripts/*.py
  • verified no stale yf_marketdata references remain in the repo
  • live Yahoo smoke tests:
    • parsed history for SPY
    • raw history for SPY and TLT
    • parsed and raw current_snapshot for ^VIX and SPY

Notes

Yahoo returned some expected 404-style fundamentals warnings during snapshot fetches for SPY and ^VIX, but the exports completed successfully and the script degraded gracefully.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5835be8669

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/fetch_yfinance.py
Comment on lines +196 to +197
"start": args.start,
"end": args.end,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Normalize relative dates before building history cache keys

history_cache_path hashes the raw args.start/args.end strings, but --end defaults to today; with --cache-dir, runs on different days can reuse the exact same cache file when the same relative tokens are passed. For example, a job run on April 5 and rerun on April 6 with --end today will read stale data instead of fetching the new bar, silently freezing incremental history updates.

Useful? React with 👍 / 👎.

Comment thread scripts/fetch_yfinance.py
Comment on lines +493 to +496
if cache_path is not None and cache_path.exists():
rows = json.loads(cache_path.read_text(encoding="utf-8"))
if isinstance(rows, list):
return build_snapshot_frame([row for row in rows if isinstance(row, dict)])
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add freshness to current snapshot cache lookup

When a snapshot cache file exists, the function returns it immediately and skips all Yahoo calls, and the cache key is only ticker-based. In any workflow that enables --cache-dir, current_snapshot stops being current after the first run and stays stale until the file is manually removed, which undermines the dataset’s purpose for live quote/fundamental checks.

Useful? React with 👍 / 👎.

@dachent dachent merged commit f7f7b5b into main Apr 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant