No commit activity in last 3 years
No release in over 3 years
Queries the CoinMarketCap API using your API key. Returns the latest prices for the top 100 coins etc.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.2.0, ~> 0.2
>= 0.81.0, ~> 0.81
~> 0.4, >= 0.4.1
 Project Readme

Introducing the coinmarketcap_lite gem

Usage:

require 'json'
require 'ostruct'
require 'coinmarketcap_lite'


cl = CoinmarketcapLite.new(apikey: 'YOUR-API-KEY')

coins = JSON.parse(cl.coins.body)['data'].map {|x| OpenStruct.new x }

lines = coins.take(5).map do |coin|
  "%+15s %9.3f" % [coin.name, coin.quote['USD']['price']]
end

puts ([(' ' * 19) + 'USD', '-' * 27 ] + lines).join("\n")

Output:

                   USD
---------------------------
        Bitcoin  8044.713
       Ethereum   251.380
            XRP     0.386
   Bitcoin Cash   406.351
       Litecoin   101.598

Resources

coinmarketcap gem crypto cryptocurrency bitcoin