Project

coincapper

0.0
No commit activity in last 3 years
No release in over 3 years
coinmarketcap.com V1 API wrapper including additional historical prices, coin market pairs, and currencies by type (coins/tokens) parsed from Coin Market Cap.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.14
~> 0.11
~> 10.0
~> 3.7
>= 0.52
>= 0.14
~> 3.2

Runtime

~> 3.0
~> 1.8
 Project Readme

Gem Version Build Status Code Climate Coverage Status Issue Count

CoinCapper

An API wrapper to the V1 coinmarketcap.com public API with additional historic, symbol, and market functionality.

Installation

Add this line to your application's Gemfile:

gem 'coincapper', '~> 1.0'

And then execute:

$ bundle

Or install it yourself as:

$ gem install coincapper

Usage

Coinmarketcap.com API responses

All Coins

CoinCapper.coins(limit: 0, rank:  nil, currency: nil)

Coin by CoinMarketCap ID

CoinCapper.coin('litecoin', currency: nil)

Global

CoinCapper.global(currency: nil)

Additional Functionality

Coin by symbol

CoinCapper.coin_by_symbol('FUN')

=> {:id=>"funfair",
 :name=>"FunFair",
 :symbol=>"FUN",
 :rank=>"84",
 :price_usd=>"0.0382094",
 :price_btc=>"0.00000557",
 :"24h_volume_usd"=>"5375680.0",
 :market_cap_usd=>"172083246.0",
 :available_supply=>"4503688789.0",
 :total_supply=>"10999873621.0",
 :max_supply=>nil,
 :percent_change_1h=>"-6.89",
 :percent_change_24h=>"-24.77",
 :percent_change_7d=>"-59.6",
 :last_updated=>"1517873357"}

Available markets by coin id or symbol

CoinCapper.coin_markets(id: 'iota', symbol: nil)

=> [{:source=>"Bitfinex", :pair=>"MIOTA/USD", :volume_usd=>33835200.0, :price_usd=>1.41, :volume_percentage=>50.21, :last_updated=>"Recently"},
 {:source=>"Binance", :pair=>"IOTA/BTC", :volume_usd=>7733790.0, :price_usd=>1.41, :volume_percentage=>11.48, :last_updated=>"Recently"}]

Historical prices by id, start, end date

CoinCapper.historical_price('request-network', '2018-01-01', '2018-01-02')

=> [{:date=>"2018-01-02", :open=>0.8126, :high=>0.881387, :low=>0.650608, :close=>0.783648, :average=>0.7659975},
 {:date=>"2018-01-01", :open=>0.606538, :high=>0.888908, :low=>0.528808, :close=>0.820232, :average=>0.708858}]

All Cryptocurrencies by type (coins, tokens)

# coins
CoinCapper.all('coins')

=> [{:id=>"bitcoin",
  :rank=>1,
  :name=>"Bitcoin",
  :symbol=>"BTC",
  :market_cap_usd=>116671271686.0,
  :market_cap_btc=>16848275.0,
  :price_usd=>6924.82,
  :price_btc=>1.0,
  :circulating_supply=>16848275.0,
  :volume_usd_24h=>9116750000.0,
  :volume_btc_24h=>1309170.0,
  :percent_change_1h=>-4.59,
  :percent_change_24h=>-16.75,
  :percent_change_7d=>-38.38}]

# tokens
CoinCapper.all('tokens')

=> [{:id=>"eos",
  :rank=>1,
  :name=>"EOS",
  :platform=>"Ethereum",
  :market_cap_usd=>4598392073.93,
  :market_cap_btc=>663307.647514,
  :price_usd=>7.07817,
  :price_btc=>0.00102101,
  :circulating_supply=>649658326.083,
  :volume_usd_24h=>630722000.0,
  :volume_btc_24h=>90980.3,
  :percent_change_1h=>-6.02,
  :percent_change_24h=>-18.88,
  :percent_change_7d=>-49.0}]

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/kurt-smith/coincapper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the CoinCapper project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.