Class: Straight::ExchangeRate::KrakenAdapter
- Defined in:
- lib/straight/exchange_rate_adapters/kraken_adapter.rb
Constant Summary collapse
- FETCH_URL =
'https://api.kraken.com/0/public/Ticker?pair=xbtusd'
Instance Method Summary collapse
Methods inherited from Adapter
#convert_from_currency, #convert_to_currency, #fetch_rates!, #get_rate_value_from_hash, #initialize, #rate_to_f
Constructor Details
This class inherits a constructor from Straight::ExchangeRate::Adapter
Instance Method Details
#rate_for(currency_code) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/straight/exchange_rate_adapters/kraken_adapter.rb', line 8 def rate_for(currency_code) super rate = get_rate_value_from_hash(@rates, 'result', 'XXBTZ' + currency_code.upcase, 'c') rate = rate.kind_of?(Array) ? rate.first : raise(CurrencyNotSupported) rate_to_f(rate) end |