coingecko_client 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +48 -10
- data/coingecko_client.gemspec +2 -2
- data/lib/coingecko_client.rb +31 -0
- data/lib/coingecko_client/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc5b73bb70a8666b4f8d402513d43a0c2cc7c2d6dc82bf06fdf937d6fccdb4ef
|
4
|
+
data.tar.gz: 5bf34b95d2f46c46539bda2f5476b394ba17bb2ca3c925011dcf92864c846efa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fe1ff0b904b605494becf943870fb3ed09a5533c69692f223024c57cc98aa1663461d8cacd160be49be46fea99408c48c37f13f835ddd4bcd7c46373c64e3bd
|
7
|
+
data.tar.gz: 8bed48f7acf2a14fdee91cdbb52d41b1f72d2177b8337a4ac9cec7b92b711eb942df4664314ac9a415511ae6b47a79258924aecfff5da450c6dd4b5a51b97bd2
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# CoingeckoClient
|
2
2
|
|
3
|
-
This is my first gem and the idea was to develop a super simple and lightweight client to connect with Coingecko API.
|
3
|
+
This is my first gem and the idea was to develop a super simple and lightweight client to connect with Coingecko API.
|
4
4
|
Keep in mind that this is by no means the oficial gem from Coingecko, it is a pet project that I have interest in keeping it working!
|
5
5
|
I published it with the methods that I need for another project, but I'll keep on adding more methods to interact with the rest of the API. Any comments, sugestions, Pull Requests, feel free to contact me.
|
6
6
|
|
@@ -28,7 +28,7 @@ The available methods are:
|
|
28
28
|
* Check if API is up:
|
29
29
|
```
|
30
30
|
2.7.0 :026 > CoingeckoClient::Client.ping
|
31
|
-
=> {"gecko_says"=>"(V3) To the Moon!"}
|
31
|
+
=> {"gecko_says"=>"(V3) To the Moon!"}
|
32
32
|
```
|
33
33
|
|
34
34
|
* List coins
|
@@ -38,9 +38,9 @@ List all supported coins id, name and symbol (no pagination required)
|
|
38
38
|
```
|
39
39
|
2.7.0 :027 > list=CoingeckoClient::Client.coins_list
|
40
40
|
2.7.0 :028 > list.count
|
41
|
-
=> 7631
|
41
|
+
=> 7631
|
42
42
|
2.7.0 :029 > list.first
|
43
|
-
=> {"id"=>"01coin", "symbol"=>"zoc", "name"=>"01coin"}
|
43
|
+
=> {"id"=>"01coin", "symbol"=>"zoc", "name"=>"01coin"}
|
44
44
|
```
|
45
45
|
* Supported_vs_currencies<br>
|
46
46
|
|
@@ -48,9 +48,9 @@ Get list of supported_vs_currencies.
|
|
48
48
|
```
|
49
49
|
2.7.0 :002 > list = CoingeckoClient::Client.supported_vs_currencies
|
50
50
|
2.7.0 :003 > list.count
|
51
|
-
=> 55
|
51
|
+
=> 55
|
52
52
|
2.7.0 :004 > list.first
|
53
|
-
=> "btc"
|
53
|
+
=> "btc"
|
54
54
|
```
|
55
55
|
|
56
56
|
* Current price <br>
|
@@ -61,7 +61,7 @@ CoingeckoClient::Client.price(<coin>,<currency>)
|
|
61
61
|
For example:
|
62
62
|
```
|
63
63
|
2.7.0 :016 > CoingeckoClient::Client.price('bitcoin','usd')
|
64
|
-
=> 9246.4
|
64
|
+
=> 9246.4
|
65
65
|
```
|
66
66
|
|
67
67
|
* Historical market data
|
@@ -84,7 +84,7 @@ Use this to obtain all the coins market data (price, market cap, volume)
|
|
84
84
|
|
85
85
|
```
|
86
86
|
2.7.0 :019 > CoingeckoClient::Client.coins_market(currency: 'usd',ids_list:['maker'], price_change_percentage:'7d' )
|
87
|
-
=> [{"id"=>"maker", "symbol"=>"mkr", "name"=>"Maker", "image"=>"https://assets.coingecko.com/coins/images/1364/large/Mark_Maker.png?1585191826", "current_price"=>465.65, "market_cap"=>419598650, "market_cap_rank"=>30, "total_volume"=>11790566, "high_24h"=>487.76, "low_24h"=>464.65, "price_change_24h"=>-3.61639711, "price_change_percentage_24h"=>-0.77064, "market_cap_change_24h"=>-3408068.16243178, "market_cap_change_percentage_24h"=>-0.80568, "circulating_supply"=>902019.8121058022, "total_supply"=>1005576.0, "ath"=>1798.7, "ath_change_percentage"=>-74.14012, "ath_date"=>"2018-01-20T00:00:00.000Z", "atl"=>168.36, "atl_change_percentage"=>176.28269, "atl_date"=>"2020-03-16T20:52:36.527Z", "roi"=>nil, "last_updated"=>"2020-07-07T09:33:19.687Z", "price_change_percentage_7d_in_currency"=>2.802621306390991}]
|
87
|
+
=> [{"id"=>"maker", "symbol"=>"mkr", "name"=>"Maker", "image"=>"https://assets.coingecko.com/coins/images/1364/large/Mark_Maker.png?1585191826", "current_price"=>465.65, "market_cap"=>419598650, "market_cap_rank"=>30, "total_volume"=>11790566, "high_24h"=>487.76, "low_24h"=>464.65, "price_change_24h"=>-3.61639711, "price_change_percentage_24h"=>-0.77064, "market_cap_change_24h"=>-3408068.16243178, "market_cap_change_percentage_24h"=>-0.80568, "circulating_supply"=>902019.8121058022, "total_supply"=>1005576.0, "ath"=>1798.7, "ath_change_percentage"=>-74.14012, "ath_date"=>"2018-01-20T00:00:00.000Z", "atl"=>168.36, "atl_change_percentage"=>176.28269, "atl_date"=>"2020-03-16T20:52:36.527Z", "roi"=>nil, "last_updated"=>"2020-07-07T09:33:19.687Z", "price_change_percentage_7d_in_currency"=>2.802621306390991}]
|
88
88
|
```
|
89
89
|
|
90
90
|
* List exchanges <br>
|
@@ -93,13 +93,51 @@ List all exchanges <br>
|
|
93
93
|
```
|
94
94
|
2.7.0 :030 > list=CoingeckoClient::Client.list_exchanges
|
95
95
|
2.7.0 :031 > list.count
|
96
|
-
=> 100
|
96
|
+
=> 100
|
97
97
|
2.7.0 :032 > list.first
|
98
98
|
=> {"id"=>"binance", "name"=>"Binance", "year_established"=>2017, "country"=>"Cayman Islands", "description"=>"", "url"=>"https://www.binance.com/", "image"
|
99
99
|
=>"https://assets.coingecko.com/markets/images/52/small/binance.jpg?1519353250", "has_trading_incentive"=>false, "trust_score"=>10, "trust_score_rank"=>1, "t
|
100
|
-
rade_volume_24h_btc"=>202207.8584274921, "trade_volume_24h_btc_normalized"=>202207.8584274921}
|
100
|
+
rade_volume_24h_btc"=>202207.8584274921, "trade_volume_24h_btc_normalized"=>202207.8584274921}
|
101
101
|
```
|
102
102
|
|
103
|
+
* Trending coins <br>
|
104
|
+
List the Top 7 trending coins
|
105
|
+
```
|
106
|
+
2.7.0 :005> CoingeckoClient::Client.coins_trending
|
107
|
+
=> {"coins"=>[{"item"=>{"id"=>"matic-network", "coin_id"=>4713, "name"=>"Polygon", "symbol"=>"MATIC", "market_cap_rank"=>22, "thumb"=>"https://assets.coingecko.com/coins/images/4713/thumb/matic___polygon.jpg?1612939050", "small"=>"https://assets.coingecko.com/coins/images/4713/small/matic___polygon.jpg?1612939050", "large"=>"https://assets.coingecko.com/coins/images/4713/large/matic___polygon.jpg?1612939050", "slug"=>"polygon", "price_btc"=>2.8814566254115035e-05, "score"=>0}}
|
108
|
+
```
|
109
|
+
|
110
|
+
* Global data <br>
|
111
|
+
Get global data on cryptocurrencies such as total market cap, trading volume and available markets
|
112
|
+
```
|
113
|
+
2.7.0 :006> CoingeckoClient::Client.global
|
114
|
+
=> {"data"=>{"active_cryptocurrencies"=>7228, "upcoming_icos"=>0, "ongoing_icos"=>50, "ended_icos"=>3375, "markets"=>614, "total_market_cap"=>{"btc"=>47150877.60201247, "eth"=>590487432.9774164, "ltc"=>7267533831.311713, "bch"=>1813437832.9322438, "bnb"=>3952875587.545117, "eos"=>212410692785.36523, "xrp"=>1711624698868.2542, "xlm"=>3552898157262.8335}}
|
115
|
+
```
|
116
|
+
|
117
|
+
* Global Decentralized Finance(DeFi) data <br>
|
118
|
+
Get global data on DeFi such as market cap and trading volume
|
119
|
+
```
|
120
|
+
2.7.0 :007> CoingeckoClient::Client.global_defi
|
121
|
+
=> {"data"=>{"defi_market_cap"=>"137457435788.2066091800193351248", "eth_market_cap"=>"471137550162.7690872337739426092", "defi_to_eth_ratio"=>"29.1756485427064075772610878798993912180217281909005711205424453", "trading_volume_24h"=>"17340967982.36497960812229859576", "defi_dominance"=>"5.7334520883902335884692023116692586282802032110498494559675484", "top_coin_name"=>"Uniswap", "top_coin_defi_dominance"=>14.895455912137919}}
|
122
|
+
```
|
123
|
+
|
124
|
+
* BTC exchange rates <br>
|
125
|
+
Get BTC exchange rate value against various currencies including FIAT, gold/silver and other coins
|
126
|
+
```
|
127
|
+
irb(main):009:0> CoingeckoClient::Client.btc_to_currency
|
128
|
+
=> {"rates"=>{"btc"=>{"name"=>"Bitcoin", "unit"=>"BTC", "value"=>1.0, "type"=>"crypto"}, "eth"=>{"name"=>"Ether", "unit"=>"ETH", "value"=>12.405, "type"=>"crypto"}, "ltc"=>{"name"=>"Litecoin", "unit"=>"LTC", "value"=>152.56, "type"=>"crypto"}, "bch"=>{"name"=>"Bitcoin Cash", "unit"=>"BCH", "value"=>37.964, "type"=>"crypto"}, "bnb"=>{"name"=>"Binance Coin", "unit"=>"BNB", "value"=>83.884, "type"=>"crypto"}, "eos"=>{"name"=>"EOS", "unit"=>"EOS", "value"=>4481.84, "type"=>"crypto"}, "xrp"=>{"name"=>"XRP", "unit"=>"XRP", "value"=>36155.406, "type"=>"crypto"}
|
129
|
+
```
|
130
|
+
|
131
|
+
* Status Updates <br>
|
132
|
+
List status updates from exchanges and coins, such as software releases and policy changes <br>
|
133
|
+
Pass project_type 'coin' or 'market' to filter, if project_type is left empty, updates from both coins and markets will be returned
|
134
|
+
```
|
135
|
+
2.7.0 :012> CoingeckoClient::Client.status_updates(category: 'software_release', project_type: 'coin')
|
136
|
+
=> {"status_updates"=>[{"description"=>"The DigiByte team is pleased to release DigiByte v7.17.3! This release resolves the underlying Unit Tests and provides a solid foundation for the upcoming version 8 release. No fork / consensus cha
|
137
|
+
nges here. Upgrading 100% optional.\r\n\r\nhttps://github.com/DigiByte-Core/digibyte/releases/tag/v7.17.3", "category"=>"software_release", "created_at"=>"2021-05-13T05:48:18.366Z", "user"=>"Murat Akyurt", "user_title"=>"DGBAT Outreach O
|
138
|
+
fficer", "pin"=>false, "project"=>{"type"=>"Coin", "id"=>"digibyte", "name"=>"DigiByte", "symbol"=>"dgb", "image"=>{"thumb"=>"https://assets.coingecko.com/coins/images/63/thumb/digibyte.png?1547033717", "small"=>"https://assets.coingecko
|
139
|
+
.com/coins/images/63/small/digibyte.png?1547033717", "large"=>"https://assets.coingecko.com/coins/images/63/large/digibyte.png?1547033717"}}}
|
140
|
+
```
|
103
141
|
|
104
142
|
## Development
|
105
143
|
|
data/coingecko_client.gemspec
CHANGED
@@ -3,8 +3,8 @@ require_relative 'lib/coingecko_client/version'
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "coingecko_client"
|
5
5
|
spec.version = CoingeckoClient::VERSION
|
6
|
-
spec.authors = ["Bruck1701"]
|
7
|
-
spec.email = ["kummel@gmail.com"]
|
6
|
+
spec.authors = ["Bruck1701", "mark-ruddy"]
|
7
|
+
spec.email = ["kummel@gmail.com","1markruddy@gmail.com"]
|
8
8
|
|
9
9
|
|
10
10
|
spec.summary = 'A simple coingecko API client '
|
data/lib/coingecko_client.rb
CHANGED
@@ -70,6 +70,37 @@ module CoingeckoClient
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
+
# Returns Top 7 trending coins
|
74
|
+
def self.coins_trending
|
75
|
+
api_call("search/trending")
|
76
|
+
end
|
77
|
+
|
78
|
+
# Get BTC-to-currency (BTC rate against FIAT, Gold, other coins etc)
|
79
|
+
def self.btc_to_currency
|
80
|
+
api_call("exchange_rates")
|
81
|
+
end
|
82
|
+
|
83
|
+
# Get global data of coins (Total market cap, active coins, market cap percentage)
|
84
|
+
def self.global
|
85
|
+
api_call("global")
|
86
|
+
end
|
87
|
+
|
88
|
+
# Get global data for decentralized finance aka defi
|
89
|
+
def self.global_defi
|
90
|
+
api_call("global/decentralized_finance_defi")
|
91
|
+
end
|
92
|
+
|
93
|
+
# Get status updates from coin maintainers and exchanges
|
94
|
+
def self.status_updates(category: 'general',
|
95
|
+
project_type: '',
|
96
|
+
per_page: 100,
|
97
|
+
page: 1)
|
98
|
+
# If project_type empty returns statuses from both coins/markets
|
99
|
+
request = "status_updates/?category=#{category}"
|
100
|
+
request += "&project_type=#{project_type}&per_page=#{per_page}&page=#{page}"
|
101
|
+
api_call(request)
|
102
|
+
end
|
103
|
+
|
73
104
|
private_class_method def self.api_call(api_request)
|
74
105
|
endpoint_head = 'https://api.coingecko.com/api/v3/'
|
75
106
|
url = endpoint_head + api_request
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coingecko_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruck1701
|
8
|
+
- mark-ruddy
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2021-05-26 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: excon
|
@@ -46,6 +47,7 @@ description: "This is my first gem and the idea was to develop a super simple an
|
|
46
47
|
of the API. Any comments, sugestions, Pull Requests, feel free to contact me."
|
47
48
|
email:
|
48
49
|
- kummel@gmail.com
|
50
|
+
- 1markruddy@gmail.com
|
49
51
|
executables: []
|
50
52
|
extensions: []
|
51
53
|
extra_rdoc_files: []
|