Initialize an instance of the ExchangeRateExplorer class:
# as with other classes, you can set optional params base_url and / or api_code
require 'Blockchain'
explorer = Blockchain::ExchangeRateExplorer.newCall the 'ticker' method and return a dictionary of Currency objects. Keys are currency codes (str) and values are Currency objects.
ticker = explorer.get_ticker
#print the 15 min price for every currency
ticker.keys.each do |key|
puts ticker[key].p15min
endConvert x value in the provided currency to BTC. Returns a float.
str ccy- code of the currency to convert fromfloat value- amount in selected currency
btc_amount = explorer.to_btc('USD', 4342.11)Convert x value in satoshi to the provided currency. Returns a float
str ccy(optional) - code of the currency to convert to (default USD)float satoshi_value- amount of satoshi to convert
one_btc_usd_value = explorer.from_btc(100000000)lastbuysellsymbolp15min