mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-05 13:35:21 +02:00
Implement Synth as an exchange rate provider (#574)
* Implement Synth as an exchange rate provider * Add assertions to provider interface test * Assert the correct provider error is raised * Remove unnecessary parens
This commit is contained in:
parent
a1b25f1c5b
commit
7ae25dd6df
16 changed files with 310 additions and 34 deletions
|
@ -62,7 +62,7 @@ module Account::Syncable
|
|||
next if existing_rates_set.include?([ rc_from, rc_to, rc_date.to_s ])
|
||||
|
||||
logger.info "Fetching exchange rate from provider for account #{self.name}: #{self.id} (#{rc_from} to #{rc_to} on #{rc_date})"
|
||||
rate = ExchangeRate.fetch_rate_from_provider(rc_from, rc_to, rc_date)
|
||||
rate = ExchangeRate.find_rate_or_fetch from: rc_from, to: rc_to, date: rc_date
|
||||
ExchangeRate.create! base_currency: rc_from, converted_currency: rc_to, date: rc_date, rate: rate if rate
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue