mirror of
https://github.com/we-promise/sure.git
synced 2026-05-07 12:54:04 +00:00
* FIX prefer provider rate always - add debugging also * Move logic from securities over * FIXes * Review fixes * Update provided.rb --------- Signed-off-by: soky srm <sokysrm@gmail.com>
22 lines
743 B
Ruby
22 lines
743 B
Ruby
module Provider::ExchangeRateConcept
|
|
extend ActiveSupport::Concern
|
|
|
|
Rate = Data.define(:date, :from, :to, :rate)
|
|
|
|
def fetch_exchange_rate(from:, to:, date:)
|
|
raise NotImplementedError, "Subclasses must implement #fetch_exchange_rate"
|
|
end
|
|
|
|
def fetch_exchange_rates(from:, to:, start_date:, end_date:)
|
|
raise NotImplementedError, "Subclasses must implement #fetch_exchange_rates"
|
|
end
|
|
|
|
# Maximum number of calendar days of historical FX data the provider can
|
|
# return. Returns nil when the provider has no known limit (unbounded).
|
|
# Callers should clamp start_date when non-nil to avoid requesting data
|
|
# beyond this window. Override in subclasses with provider-specific limits.
|
|
def max_history_days
|
|
nil
|
|
end
|
|
end
|