Module: Fafx::ExchangeRate
- Defined in:
- lib/fafx/exchange_rate.rb
Class Method Summary collapse
- .at(date, base, other) ⇒ Object
- .currencies_available ⇒ Object
- .dates_available ⇒ Object
- .most_recent ⇒ Object
- .update_data ⇒ Object
Class Method Details
.at(date, base, other) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/fafx/exchange_rate.rb', line 3 def at(date, base, other) date = DateHandler.get(date) ex_rates = Core.new base = ex_rates.rates_at(date, base) other = ex_rates.rates_at(date, other) other / base end |
.currencies_available ⇒ Object
11 12 13 |
# File 'lib/fafx/exchange_rate.rb', line 11 def currencies_available Core.new.currencies end |
.dates_available ⇒ Object
15 16 17 |
# File 'lib/fafx/exchange_rate.rb', line 15 def dates_available Core.new.dates end |
.most_recent ⇒ Object
19 20 21 22 23 |
# File 'lib/fafx/exchange_rate.rb', line 19 def most_recent ex_rates = Core.new first_date = ex_rates.dates.first ex_rates.rates[first_date] end |
.update_data ⇒ Object
25 26 27 |
# File 'lib/fafx/exchange_rate.rb', line 25 def update_data DataFetcher.save_to_disk end |