Skip to content

Add Stock.get_fx_rate for currency pair lookups#13

Merged
fleveque merged 2 commits into
mainfrom
feat/fx-rate
May 16, 2026
Merged

Add Stock.get_fx_rate for currency pair lookups#13
fleveque merged 2 commits into
mainfrom
feat/fx-rate

Conversation

@fleveque

Copy link
Copy Markdown
Owner

Summary

  • New Stock.get_fx_rate(from, to) wraps Yahoo's <FROM><TO>=X quote symbol and returns just the regularMarketPrice as a Float (or nil on error).
  • Identity pairs short-circuit to 1.0 without an HTTP call.
  • Bumps to 0.7.0, updates CHANGELOG + README.

Why

Phase 2 of multi-currency in dividend-portfolio needs an FX lookup that lives outside the existing get_quote pipeline — calling get_quote("EURUSD=X") works but pulls a full quote hash for one field, and on the downstream side would have BaseProvider#store_stock_data creating junk Stock rows for EURUSD=X.

Test plan

  • bundle exec rspec — 71 examples, 0 failures (7 new cases on the FX helper).
  • bundle exec rubocop — clean.

🤖 Generated with Claude Code

fleveque and others added 2 commits May 16, 2026 17:03
Wraps Yahoo's <FROM><TO>=X quote symbol and returns just the
regularMarketPrice as a Float. Identity pairs short-circuit to 1.0
without an HTTP call; failed requests return nil. Bumps to 0.7.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The new get_fx_rate helpers push Stock past the previous 280-line cap.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@fleveque fleveque merged commit d154766 into main May 16, 2026
1 check passed
@fleveque fleveque deleted the feat/fx-rate branch May 16, 2026 15:08
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