Method: Utils.ltcbch_price

Defined in:
lib/utils.rb

.ltcbch_pricefloat

fetch ltc/bch price from coin market cap

Returns:

  • (float)

    rate



52
53
54
55
56
# File 'lib/utils.rb', line 52

def self.ltcbch_price
  response = RestClient.get('https://api.coinmarketcap.com/v2/ticker/2/?convert=BCH')
  hash = JSON.parse(response.body)
  hash['data']['quotes']['BCH']['price'].to_f.round(4)
end