Replies: 5 comments 6 replies
-
|
Thanks for starting this discussion! This has been on my back burner for a couple of years. Your approach is solid and simple. Some considerations off the top of my head:
And deferring to v2: Blending multiple sources, a provider model, schema refinements. @claude, what do you think about this implementation approach? Could you scan past issues to identify which sources people have actually requested? Then, sketch out the MVP implementation, a rough PR structure to ship this without overthinking. |
Beta Was this translation helpful? Give feedback.
-
|
Claude's not here, pasting their response by hand: Good approach. The base currency point is crucial - ECB uses EUR, BOC uses CAD, etc. Looking at past issues, here are the most requested sources with actual user suggestions: Candidate Sources (from issue tracker)
The UN Treasury source (#56) was also suggested but only updates twice monthly, so probably not suitable. MVP Implementation1. DatabaseALTER TABLE currencies ADD COLUMN source VARCHAR DEFAULT 'ecb';
ALTER TABLE currencies ADD COLUMN base VARCHAR DEFAULT 'EUR';
CREATE UNIQUE INDEX idx_currencies_date_iso_source ON currencies(date, iso_code, source);2. Extract base Feed class# lib/bank/feed.rb
module Bank
class Feed
include Enumerable
def self.source_name
raise NotImplementedError
end
def self.base_currency
raise NotImplementedError
end
def self.current_url
raise NotImplementedError
end
# Common parsing/storage logic here
end
end
# lib/bank/ecb_feed.rb
module Bank
class ECBFeed < Feed
def self.source_name; 'ecb'; end
def self.base_currency; 'EUR'; end
def self.current_url; ECB_CURRENT_URL; end
end
end3. Minimal API changes# Keep backward compatibility
get '/latest' do
Quote.from_bank(Bank::ECBFeed, params)
end
# New source-specific endpoints
get '/:source/latest' do
feed_class = Bank.const_get("#{params[:source].upcase}Feed")
Quote.from_bank(feed_class, params)
endPR Structure
|
Beta Was this translation helpful? Give feedback.
-
|
#151 |
Beta Was this translation helpful? Give feedback.
-
|
Hi @tstojecki! Apologies for the long delay in getting back to you. I haven’t been able to spend much time here recently. I really appreciate the work that went into this PR. That said, after revisiting our discussion in #141, it looks like we’re not quite aligned on the direction:
I’d suggest instead to start with a smaller step, say, adding one new source (e.g. Bank of Canada) to v1 using source-specific endpoints. Once that’s running and stable, it's a good point to revisit v2 and design the blending strategy properly. I’d be happy to reopen the discussion and figure out next steps. Thanks again for putting serious effort into this! |
Beta Was this translation helpful? Give feedback.
-
|
Multi-source support shipped in v2. The API now blends rates from 20+ providers (central banks, IMF, Federal Reserve). See the v2 docs at Closing as completed. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Background
Frankfurter currently sources all exchange rate data from the European Central Bank (ECB).
While ECB provides EUR-based rates, there is significant community demand for additional data sources to support:
Current State
Looking at the roadmap in README.md, "Multiple Data Sources" is listed as a TODO item. Is there any existing work on multiple data sources currently in progress?
Proposed Implementation (scratch if already established)
1. DB
Add a
sourcecolumn to the currencies table to track data origin:2. Backend
3. API
Goals
Beta Was this translation helpful? Give feedback.
All reactions