coin_market_pro 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +3 -0
- data/.rubocop.yml +17 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +92 -0
- data/LICENSE.txt +21 -0
- data/README.md +493 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/coin_market_pro.gemspec +35 -0
- data/lib/coin_market_pro/client/base.rb +125 -0
- data/lib/coin_market_pro/client/result.rb +63 -0
- data/lib/coin_market_pro/endpoint/base.rb +48 -0
- data/lib/coin_market_pro/endpoint/cryptocurrency.rb +235 -0
- data/lib/coin_market_pro/endpoint/exchange.rb +161 -0
- data/lib/coin_market_pro/endpoint/global_metrics.rb +48 -0
- data/lib/coin_market_pro/endpoint/tools.rb +43 -0
- data/lib/coin_market_pro/version.rb +5 -0
- data/lib/coin_market_pro.rb +12 -0
- metadata +191 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a4c96f4eac050e2cca43487f3587c459a6f7abf6842102b2bb46dd3ca63441ba
|
4
|
+
data.tar.gz: 6afc15d173a654b54956de14d580bef88f577699813468020a13ed8621e3df5d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 249644538690c41eca62ca0082de2824f925f2e4acc3f831bc3f3469da1b8541d2698972ee44c2d65dafae81baaefde2795ecda9a0873aaa0e498e523f30ff30
|
7
|
+
data.tar.gz: d4ca79f7adbb38a2bf18623aade6ae6bcb92ddbee9042ee1820717a39859fdc6a56cad98b39a916163238607d03db050f574b115954667aeeebc9f21d847f89b
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.5
|
3
|
+
Documentation:
|
4
|
+
Enabled: false
|
5
|
+
LineLength:
|
6
|
+
Max: 120
|
7
|
+
Style/RaiseArgs:
|
8
|
+
EnforcedStyle: compact
|
9
|
+
Metrics/AbcSize:
|
10
|
+
Enabled: false
|
11
|
+
Metrics/MethodLength:
|
12
|
+
Max: 25
|
13
|
+
Lint/Debugger:
|
14
|
+
Enabled: false
|
15
|
+
Metrics/BlockLength:
|
16
|
+
Exclude:
|
17
|
+
- 'spec/**/*.rb'
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.1
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
coin_market_pro (0.1.0)
|
5
|
+
activesupport (>= 4.2)
|
6
|
+
multi_json (~> 1.13)
|
7
|
+
rest-client (~> 2.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
activesupport (5.2.1)
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
i18n (>= 0.7, < 2)
|
15
|
+
minitest (~> 5.1)
|
16
|
+
tzinfo (~> 1.1)
|
17
|
+
addressable (2.5.2)
|
18
|
+
public_suffix (>= 2.0.2, < 4.0)
|
19
|
+
coderay (1.1.2)
|
20
|
+
concurrent-ruby (1.0.5)
|
21
|
+
crack (0.4.3)
|
22
|
+
safe_yaml (~> 1.0.0)
|
23
|
+
diff-lcs (1.3)
|
24
|
+
docile (1.3.1)
|
25
|
+
domain_name (0.5.20180417)
|
26
|
+
unf (>= 0.0.5, < 1.0.0)
|
27
|
+
hashdiff (0.3.7)
|
28
|
+
http-cookie (1.0.3)
|
29
|
+
domain_name (~> 0.5)
|
30
|
+
i18n (1.1.0)
|
31
|
+
concurrent-ruby (~> 1.0)
|
32
|
+
json (2.1.0)
|
33
|
+
method_source (0.9.0)
|
34
|
+
mime-types (3.2.2)
|
35
|
+
mime-types-data (~> 3.2015)
|
36
|
+
mime-types-data (3.2018.0812)
|
37
|
+
minitest (5.11.3)
|
38
|
+
multi_json (1.13.1)
|
39
|
+
netrc (0.11.0)
|
40
|
+
pry (0.11.3)
|
41
|
+
coderay (~> 1.1.0)
|
42
|
+
method_source (~> 0.9.0)
|
43
|
+
public_suffix (3.0.3)
|
44
|
+
rake (12.3.1)
|
45
|
+
rest-client (2.0.2)
|
46
|
+
http-cookie (>= 1.0.2, < 2.0)
|
47
|
+
mime-types (>= 1.16, < 4.0)
|
48
|
+
netrc (~> 0.8)
|
49
|
+
rspec (3.8.0)
|
50
|
+
rspec-core (~> 3.8.0)
|
51
|
+
rspec-expectations (~> 3.8.0)
|
52
|
+
rspec-mocks (~> 3.8.0)
|
53
|
+
rspec-core (3.8.0)
|
54
|
+
rspec-support (~> 3.8.0)
|
55
|
+
rspec-expectations (3.8.1)
|
56
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
+
rspec-support (~> 3.8.0)
|
58
|
+
rspec-mocks (3.8.0)
|
59
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
60
|
+
rspec-support (~> 3.8.0)
|
61
|
+
rspec-support (3.8.0)
|
62
|
+
safe_yaml (1.0.4)
|
63
|
+
simplecov (0.16.1)
|
64
|
+
docile (~> 1.1)
|
65
|
+
json (>= 1.8, < 3)
|
66
|
+
simplecov-html (~> 0.10.0)
|
67
|
+
simplecov-html (0.10.2)
|
68
|
+
thread_safe (0.3.6)
|
69
|
+
tzinfo (1.2.5)
|
70
|
+
thread_safe (~> 0.1)
|
71
|
+
unf (0.1.4)
|
72
|
+
unf_ext
|
73
|
+
unf_ext (0.0.7.5)
|
74
|
+
webmock (3.4.2)
|
75
|
+
addressable (>= 2.3.6)
|
76
|
+
crack (>= 0.3.2)
|
77
|
+
hashdiff
|
78
|
+
|
79
|
+
PLATFORMS
|
80
|
+
ruby
|
81
|
+
|
82
|
+
DEPENDENCIES
|
83
|
+
bundler (~> 1.16)
|
84
|
+
coin_market_pro!
|
85
|
+
pry
|
86
|
+
rake (~> 12.3)
|
87
|
+
rspec (~> 3.8)
|
88
|
+
simplecov (~> 0.16)
|
89
|
+
webmock (~> 3.4)
|
90
|
+
|
91
|
+
BUNDLED WITH
|
92
|
+
1.16.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 ZippyDev
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,493 @@
|
|
1
|
+
# CoinMarketPro
|
2
|
+
|
3
|
+
Ruby wrapper for [CoinMarketCap Pro v1 API](https://pro.coinmarketcap.com/api/v1#).
|
4
|
+
|
5
|
+
The CoinMarketCap Professional API is a suite of high-performance RESTful JSON endpoints that are specifically designed to meet the mission-critical demands of application developers, data scientists, and enterprise business platforms.
|
6
|
+
|
7
|
+
## Available Endpoints:
|
8
|
+
|
9
|
+
* [Cryptocurrency](####Cryptocurrency)
|
10
|
+
* [Exchange](####Exchange)
|
11
|
+
* [Global Metrics](####Global Metrics)
|
12
|
+
* [Tools](####Global Metrics)
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
`gem 'coin_market_pro'`
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
`$ bundle`
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
`$ gem install coin_market_pro`
|
26
|
+
|
27
|
+
## Environment Variables
|
28
|
+
|
29
|
+
| Variable | Description | Default |
|
30
|
+
| --------------------------|:----------------------|:---------:|
|
31
|
+
| `COIN_MARKET_PRO_API_KEY` | CoinMarketCap API Key | - |
|
32
|
+
|
33
|
+
## Usage
|
34
|
+
|
35
|
+
### Initialize CoinMarketPro
|
36
|
+
|
37
|
+
Client Api Key defaults to `COIN_MARKET_PRO_API_KEY` ENV. Override the client with `api_key` param.
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
# Rails Example
|
41
|
+
#
|
42
|
+
# config/initializers/coin_market_pro.rb
|
43
|
+
module CoinMarketPro
|
44
|
+
Api ||= CoinMarketPro.new(api_key: 'Coinbase-Pro-Api-Key', logger: Rails.logger)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Ruby
|
48
|
+
client = CoinMarketPro.new(api_key: 'Coinbase-Pro-Api-Key')
|
49
|
+
```
|
50
|
+
|
51
|
+
### [Common Errors](https://pro.coinmarketcap.com/api/v1#section/Errors-and-Rate-Limits)
|
52
|
+
|
53
|
+
```
|
54
|
+
400 Bad Request
|
55
|
+
401 Unauthorized
|
56
|
+
403 Forbidden
|
57
|
+
429 Too Many Requests
|
58
|
+
500 Internal Server Error
|
59
|
+
```
|
60
|
+
|
61
|
+
### Response Format
|
62
|
+
|
63
|
+
Response object returned as hash with keys: `status`, `code`, `headers`, `body`, `raw`. For consistency, `body` will always be returned as an array.
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
# Using `client` defined from above
|
67
|
+
|
68
|
+
client.cryptocurrency.info(id: [1])
|
69
|
+
# => #<CoinMarketPro::Client::Result:0x00007f9045657d18
|
70
|
+
# @body=
|
71
|
+
# [{:urls=>
|
72
|
+
# {:website=>["https://bitcoin.org/"],
|
73
|
+
# :twitter=>[],
|
74
|
+
# :reddit=>["https://reddit.com/r/bitcoin"],
|
75
|
+
# :message_board=>["https://bitcointalk.org"],
|
76
|
+
# :announcement=>[],
|
77
|
+
# :chat=>[],
|
78
|
+
# :explorer=>["https://blockchain.info/", "https://live.blockcypher.com/btc/", "https://blockchair.com/bitcoin/blocks"],
|
79
|
+
# :source_code=>["https://github.com/bitcoin/"]},
|
80
|
+
# :logo=>"https://s2.coinmarketcap.com/static/img/coins/64x64/1.png",
|
81
|
+
# :id=>1,
|
82
|
+
# :name=>"Bitcoin",
|
83
|
+
# :symbol=>"BTC",
|
84
|
+
# :slug=>"bitcoin",
|
85
|
+
# :date_added=>"2013-04-28T00:00:00.000Z",
|
86
|
+
# :tags=>["mineable"],
|
87
|
+
# :category=>"coin"}],
|
88
|
+
# @code=200,
|
89
|
+
# @headers=
|
90
|
+
# {:content_type=>"application/json; charset=utf-8",
|
91
|
+
# :transfer_encoding=>"chunked",
|
92
|
+
# :connection=>"keep-alive",
|
93
|
+
# :date=>"Mon, 08 Oct 2018 02:04:13 GMT",
|
94
|
+
# :server=>"nginx",
|
95
|
+
# :vary=>"origin,accept-encoding",
|
96
|
+
# :access_control_expose_headers=>"WWW-Authenticate,Server-Authorization",
|
97
|
+
# :cache_control=>"no-cache",
|
98
|
+
# :content_encoding=>"gzip",
|
99
|
+
# :x_cache=>"Miss from cloudfront",
|
100
|
+
# :via=>"1.1 39f9e0f028321e95b5ebd1cd55661fd6.cloudfront.net (CloudFront)",
|
101
|
+
# :x_amz_cf_id=>"uQcyrXXRjyNb_oFO5hlXDAAX9TgYvmUXUaXujxxzYgRfoq_XleXjhQ=="},
|
102
|
+
# @raw=
|
103
|
+
# {:status=>{:timestamp=>"2018-10-08T02:04:13.628Z", :error_code=>0, :error_message=>nil, :elapsed=>11, :credit_count=>1},
|
104
|
+
# :data=>
|
105
|
+
# {:"1"=>
|
106
|
+
# {:urls=>
|
107
|
+
# {:website=>["https://bitcoin.org/"],
|
108
|
+
# :twitter=>[],
|
109
|
+
# :reddit=>["https://reddit.com/r/bitcoin"],
|
110
|
+
# :message_board=>["https://bitcointalk.org"],
|
111
|
+
# :announcement=>[],
|
112
|
+
# :chat=>[],
|
113
|
+
# :explorer=>
|
114
|
+
# ["https://blockchain.info/", "https://live.blockcypher.com/btc/", "https://blockchair.com/bitcoin/blocks"],
|
115
|
+
# :source_code=>["https://github.com/bitcoin/"]},
|
116
|
+
# :logo=>"https://s2.coinmarketcap.com/static/img/coins/64x64/1.png",
|
117
|
+
# :id=>1,
|
118
|
+
# :name=>"Bitcoin",
|
119
|
+
# :symbol=>"BTC",
|
120
|
+
# :slug=>"bitcoin",
|
121
|
+
# :date_added=>"2013-04-28T00:00:00.000Z",
|
122
|
+
# :tags=>["mineable"],
|
123
|
+
# :category=>"coin"}}},
|
124
|
+
# @status=
|
125
|
+
# {:timestamp=>"2018-10-08T02:04:13.628Z",
|
126
|
+
# :error_code=>0,
|
127
|
+
# :error_message=>nil,
|
128
|
+
# :elapsed=>11,
|
129
|
+
# :credit_count=>1,
|
130
|
+
# :result=>:success}>
|
131
|
+
```
|
132
|
+
|
133
|
+
### Endpoints
|
134
|
+
|
135
|
+
#### [Cryptocurrency](https://pro.coinmarketcap.com/api/v1#tag/cryptocurrency)
|
136
|
+
|
137
|
+
##### [Info/Metadata](https://pro.coinmarketcap.com/api/v1#operation/getV1CryptocurrencyInfo)
|
138
|
+
|
139
|
+
Returns all static metadata for one or more cryptocurrencies including name, symbol, logo, and its various registered URLs.
|
140
|
+
|
141
|
+
- At least one "id" or "symbol" is required as Array.
|
142
|
+
- Alias method: `#metadata`
|
143
|
+
- Available API Plans:
|
144
|
+
- Basic
|
145
|
+
- Startup
|
146
|
+
- Hobbyist
|
147
|
+
- Standard
|
148
|
+
- Professional
|
149
|
+
- Enterprise
|
150
|
+
|
151
|
+
```ruby
|
152
|
+
# Using `client` defined from above
|
153
|
+
|
154
|
+
result = client.cryptocurrency.info(id: [1]) # cmc.info(symbol: ['BTC'])
|
155
|
+
result.body
|
156
|
+
|
157
|
+
# => [{:urls=>
|
158
|
+
# {:website=>["https://bitcoin.org/"],
|
159
|
+
# :twitter=>[],
|
160
|
+
# :reddit=>["https://reddit.com/r/bitcoin"],
|
161
|
+
# :message_board=>["https://bitcointalk.org"],
|
162
|
+
# :announcement=>[],
|
163
|
+
# :chat=>[],
|
164
|
+
# :explorer=>["https://blockchain.info/", "https://live.blockcypher.com/btc/", "https://blockchair.com/bitcoin/blocks"],
|
165
|
+
# :source_code=>["https://github.com/bitcoin/"]},
|
166
|
+
# :logo=>"https://s2.coinmarketcap.com/static/img/coins/64x64/1.png",
|
167
|
+
# :id=>1,
|
168
|
+
# :name=>"Bitcoin",
|
169
|
+
# :symbol=>"BTC",
|
170
|
+
# :slug=>"bitcoin",
|
171
|
+
# :date_added=>"2013-04-28T00:00:00.000Z",
|
172
|
+
# :tags=>["mineable"],
|
173
|
+
# :category=>"coin"}]
|
174
|
+
```
|
175
|
+
|
176
|
+
##### [Map](https://pro.coinmarketcap.com/api/v1#operation/getV1CryptocurrencyMap)
|
177
|
+
|
178
|
+
Returns a paginated list of all cryptocurrencies by CoinMarketCap ID.
|
179
|
+
|
180
|
+
- Available API Plans:
|
181
|
+
- Basic
|
182
|
+
- Startup
|
183
|
+
- Hobbyist
|
184
|
+
- Standard
|
185
|
+
- Professional
|
186
|
+
- Enterprise
|
187
|
+
|
188
|
+
```ruby
|
189
|
+
client.cryptocurrency.map(symbol: ['BTC']).body
|
190
|
+
|
191
|
+
# => [{:id=>1,
|
192
|
+
# :name=>"Bitcoin",
|
193
|
+
# :symbol=>"BTC",
|
194
|
+
# :slug=>"bitcoin",
|
195
|
+
# :is_active=>1,
|
196
|
+
# :first_historical_data=>"2013-04-28T18:47:21.000Z",
|
197
|
+
# :last_historical_data=>"2018-10-16T01:29:00.000Z"}]
|
198
|
+
```
|
199
|
+
|
200
|
+
##### [Listings (Historical)](https://pro.coinmarketcap.com/api/v1#operation/getV1CryptocurrencyListingsHistorical)
|
201
|
+
|
202
|
+
Returns paginated list of all cryptocurrencies with market data for a given historical time.
|
203
|
+
|
204
|
+
* This endpoint is not yet available. It is slated for release in early Q4 2018.
|
205
|
+
|
206
|
+
##### [Listings (Latest)](https://pro.coinmarketcap.com/api/v1#operation/getV1CryptocurrencyListingsLatest)
|
207
|
+
|
208
|
+
Get a paginated list of all cryptocurrencies with latest market data.
|
209
|
+
|
210
|
+
- Alias: `#listings_latest`
|
211
|
+
- Available API Plans:
|
212
|
+
- Basic
|
213
|
+
- Startup
|
214
|
+
- Hobbyist
|
215
|
+
- Standard
|
216
|
+
- Professional
|
217
|
+
- Enterprise
|
218
|
+
|
219
|
+
```ruby
|
220
|
+
client.cryptocurrency.listings(symbol: ['BTC']).body
|
221
|
+
|
222
|
+
# => [{:id=>1,
|
223
|
+
# :name=>"Bitcoin",
|
224
|
+
# :symbol=>"BTC",
|
225
|
+
# :slug=>"bitcoin",
|
226
|
+
# :circulating_supply=>17324362,
|
227
|
+
# :total_supply=>17324362,
|
228
|
+
# :max_supply=>21000000,
|
229
|
+
# :date_added=>"2013-04-28T00:00:00.000Z",
|
230
|
+
# :num_market_pairs=>6324,
|
231
|
+
# :cmc_rank=>1,
|
232
|
+
# :last_updated=>"2018-10-16T01:45:23.000Z",
|
233
|
+
# :quote=>
|
234
|
+
# {:USD=>
|
235
|
+
# {:price=>6584.26049147,
|
236
|
+
# :volume_24h=>7374050978.32602,
|
237
|
+
# :percent_change_1h=>0.0551947,
|
238
|
+
# :percent_change_24h=>4.70272,
|
239
|
+
# :percent_change_7d=>-1.04176,
|
240
|
+
# :market_cap=>114068112256.52419,
|
241
|
+
# :last_updated=>"2018-10-16T01:45:23.000Z"}}},
|
242
|
+
# {:id=>1027,
|
243
|
+
# :name=>"Ethereum",
|
244
|
+
# :symbol=>"ETH",
|
245
|
+
# :slug=>"ethereum",
|
246
|
+
# :circulating_supply=>102596461.624,
|
247
|
+
# :total_supply=>102596461.624,
|
248
|
+
# :max_supply=>nil,
|
249
|
+
# :date_added=>"2015-08-07T00:00:00.000Z",
|
250
|
+
# :num_market_pairs=>4473,
|
251
|
+
# :cmc_rank=>2,
|
252
|
+
# :last_updated=>"2018-10-16T01:45:43.000Z",
|
253
|
+
# :quote=>
|
254
|
+
# {:USD=>
|
255
|
+
# {:price=>208.414319714,
|
256
|
+
# :volume_24h=>2838392300.32738,
|
257
|
+
# :percent_change_1h=>0.0524806,
|
258
|
+
# :percent_change_24h=>6.59914,
|
259
|
+
# :percent_change_7d=>-9.22212,
|
260
|
+
# :market_cap=>21382571754.429466,
|
261
|
+
# :last_updated=>"2018-10-16T01:45:43.000Z"}}}]
|
262
|
+
```
|
263
|
+
|
264
|
+
##### [Market Pairs](https://pro.coinmarketcap.com/api/v1#operation/getV1CryptocurrencyMarketpairsLatest)
|
265
|
+
|
266
|
+
Lists all market pairs for the specified cryptocurrency with associated stats.
|
267
|
+
|
268
|
+
- Available API Plans:
|
269
|
+
- Standard
|
270
|
+
- Professional
|
271
|
+
- Enterprise
|
272
|
+
|
273
|
+
```ruby
|
274
|
+
client.cryptocurrency.market_pairs(symbol: ['BTC']).body
|
275
|
+
```
|
276
|
+
|
277
|
+
##### [OHLCV (Historical)](https://pro.coinmarketcap.com/api/v1#operation/getV1CryptocurrencyOhlcvHistorical)
|
278
|
+
|
279
|
+
Return an interval of historic OHLCV (Open, High, Low, Close, Volume) market quotes for a cryptocurrency.
|
280
|
+
|
281
|
+
- Available API Plans:
|
282
|
+
- Standard (1 month)
|
283
|
+
- Professional (12 months)
|
284
|
+
- Enterprise (Up to 5 years)
|
285
|
+
|
286
|
+
```ruby
|
287
|
+
client.cryptocurrency.ohlcv_historical(id: [1]).body
|
288
|
+
```
|
289
|
+
|
290
|
+
##### [OHLCV (Latest)](https://pro.coinmarketcap.com/api/v1#operation/getV1CryptocurrencyOhlcvLatest)
|
291
|
+
|
292
|
+
Return an interval of historic OHLCV (Open, High, Low, Close, Volume) market quotes for a cryptocurrency.
|
293
|
+
|
294
|
+
- Alias `#ohlcv_latest`
|
295
|
+
- Available API Plans:
|
296
|
+
- Startup
|
297
|
+
- Hobbyist
|
298
|
+
- Standard
|
299
|
+
- Professional
|
300
|
+
- Enterprise
|
301
|
+
|
302
|
+
```ruby
|
303
|
+
client.cryptocurrency.ohlcv_historical(id: [1]).body
|
304
|
+
```
|
305
|
+
|
306
|
+
##### [Market Quotes (Historical)](https://pro.coinmarketcap.com/api/v1#operation/getV1CryptocurrencyQuotesHistorical)
|
307
|
+
|
308
|
+
Returns an interval of historic market quotes for any cryptocurrency based on time and interval parameters.
|
309
|
+
|
310
|
+
- One "id" or "symbol" is required.
|
311
|
+
- Alias: `#market_quotes_historical`
|
312
|
+
- Available API Plans:
|
313
|
+
- Standard (1 month)
|
314
|
+
- Professional (12 months)
|
315
|
+
- Enterprise (Up to 5 years)
|
316
|
+
|
317
|
+
```ruby
|
318
|
+
client.cryptocurrency.quotes_historical(id: 1).body
|
319
|
+
```
|
320
|
+
|
321
|
+
##### [Market Quotes (Latest)](https://pro.coinmarketcap.com/api/v1#operation/getV1CryptocurrencyQuotesLatest)
|
322
|
+
|
323
|
+
Get the latest market quote for 1 or more cryptocurrencies. Use the "convert" option to return market values in multiple fiat and cryptocurrency conversions in the same call.
|
324
|
+
|
325
|
+
- At least one "id" or "symbol" is required.
|
326
|
+
- Alias: `#market_quotes, #quotes_latest`
|
327
|
+
- Available API Plans:
|
328
|
+
- Basic
|
329
|
+
- Hobbyist
|
330
|
+
- Startup
|
331
|
+
- Standard
|
332
|
+
- Professional
|
333
|
+
- Enterprise
|
334
|
+
|
335
|
+
```ruby
|
336
|
+
client.cryptocurrency.quotes(id: [1]).body
|
337
|
+
```
|
338
|
+
|
339
|
+
#### [Exchange](https://pro.coinmarketcap.com/api/v1#tag/exchange)
|
340
|
+
|
341
|
+
##### [Info/Metadata](https://pro.coinmarketcap.com/api/v1#operation/getV1ExchangeInfo)
|
342
|
+
|
343
|
+
Returns all static metadata for one or more exchanges including logo and homepage URL.
|
344
|
+
|
345
|
+
- Alias: `#market_quotes, #quotes_latest`
|
346
|
+
- Available API Plans:
|
347
|
+
- Startup
|
348
|
+
- Standard
|
349
|
+
- Professional
|
350
|
+
- Enterprise
|
351
|
+
|
352
|
+
```ruby
|
353
|
+
client.exchange.info(id: [1]).body
|
354
|
+
```
|
355
|
+
|
356
|
+
##### [Map](https://pro.coinmarketcap.com/api/v1#operation/getV1ExchangeMap)
|
357
|
+
|
358
|
+
Returns a paginated list of all cryptocurrency exchanges by CoinMarketCap ID. We recommend using this convenience endpoint to lookup and utilize our unique exchange id across all endpoints as typical exchange identifiers may change over time.
|
359
|
+
|
360
|
+
- Available API Plans:
|
361
|
+
- Startup
|
362
|
+
- Standard
|
363
|
+
- Professional
|
364
|
+
- Enterprise
|
365
|
+
|
366
|
+
```ruby
|
367
|
+
client.exchange.map.body
|
368
|
+
```
|
369
|
+
|
370
|
+
##### [Listings (Historical)](https://pro.coinmarketcap.com/api/v1#operation/getV1ExchangeListingsHistorical)
|
371
|
+
|
372
|
+
Get a paginated list of all cryptocurrency exchanges with historical market data for a given point in time.
|
373
|
+
|
374
|
+
```ruby
|
375
|
+
client.exchange.listings_historical
|
376
|
+
```
|
377
|
+
|
378
|
+
##### [Listings (Latest)](https://pro.coinmarketcap.com/api/v1#operation/getV1ExchangeListingsLatest)
|
379
|
+
|
380
|
+
Get a paginated list of all cryptocurrency exchanges with 24 hour volume. Additional market data fields will be available in the future.
|
381
|
+
|
382
|
+
- Alias: `#listings_latest`
|
383
|
+
- Available API Plans:
|
384
|
+
- Standard
|
385
|
+
- Professional
|
386
|
+
- Enterprise
|
387
|
+
|
388
|
+
```ruby
|
389
|
+
client.exchange.listings
|
390
|
+
```
|
391
|
+
|
392
|
+
##### [Market Pairs](https://pro.coinmarketcap.com/api/v1#operation/getV1ExchangeMarketpairsLatest)
|
393
|
+
|
394
|
+
Get a list of active market pairs for an exchange. Active means the market pair is open for trading.
|
395
|
+
|
396
|
+
- Available API Plans:
|
397
|
+
- Standard
|
398
|
+
- Professional
|
399
|
+
- Enterprise
|
400
|
+
|
401
|
+
```ruby
|
402
|
+
client.exchange.market_pairs(id: [1])
|
403
|
+
```
|
404
|
+
|
405
|
+
##### [Market Quotes (Historical)](https://pro.coinmarketcap.com/api/v1#operation/getV1ExchangeQuotesHistorical)
|
406
|
+
|
407
|
+
Returns an interval of historic quotes for any exchange based on time and interval parameters.
|
408
|
+
|
409
|
+
- Available API Plans:
|
410
|
+
- Standard (1 Month)
|
411
|
+
- Professional (12 Months)
|
412
|
+
- Enterprise (Up to 5 Years)
|
413
|
+
|
414
|
+
```ruby
|
415
|
+
client.exchange.quotes_historical(id: [1])
|
416
|
+
```
|
417
|
+
|
418
|
+
##### [Market Quotes (Latest)](https://pro.coinmarketcap.com/api/v1#operation/getV1ExchangeQuotesLatest)
|
419
|
+
|
420
|
+
Get the latest 24 hour volume quote for 1 or more exchanges. Additional market data fields will be available in the future.
|
421
|
+
|
422
|
+
- Available API Plans:
|
423
|
+
- Standard
|
424
|
+
- Professional
|
425
|
+
- Enterprise
|
426
|
+
|
427
|
+
```ruby
|
428
|
+
client.exchange.quotes(id: [1, 2])
|
429
|
+
```
|
430
|
+
|
431
|
+
#### [Global Metrics](https://pro.coinmarketcap.com/api/v1#tag/global-metrics)
|
432
|
+
|
433
|
+
##### [Quotes (Historical)](https://pro.coinmarketcap.com/api/v1#operation/getV1GlobalmetricsQuotesHistorical)
|
434
|
+
|
435
|
+
Get an interval of aggregate 24 hour volume and market cap data globally based on time and interval parameters.
|
436
|
+
|
437
|
+
- Available API Plans:
|
438
|
+
- Standard (1 month)
|
439
|
+
- Professional (12 months)
|
440
|
+
- Enterprise (Up to 5 years)
|
441
|
+
|
442
|
+
```ruby
|
443
|
+
client.global_metrics.quotes_historical
|
444
|
+
```
|
445
|
+
|
446
|
+
##### [Quotes (Latest)](https://pro.coinmarketcap.com/api/v1#operation/getV1GlobalmetricsQuotesLatest)
|
447
|
+
|
448
|
+
Get the latest quote of aggregate market metrics. Use the "convert" option to return market values in multiple fiat and cryptocurrency conversions in the same call.
|
449
|
+
|
450
|
+
- Available API Plans:
|
451
|
+
- Basic
|
452
|
+
- Hobbyist
|
453
|
+
- Startup
|
454
|
+
- Standard
|
455
|
+
- Professional
|
456
|
+
- Enterprise
|
457
|
+
|
458
|
+
|
459
|
+
```ruby
|
460
|
+
client.global_metrics.quotes
|
461
|
+
```
|
462
|
+
|
463
|
+
#### [Tools](https://pro.coinmarketcap.com/api/v1#tag/tools)
|
464
|
+
|
465
|
+
##### [Price conversion](https://pro.coinmarketcap.com/api/v1#operation/getV1ToolsPriceconversion)
|
466
|
+
|
467
|
+
Convert an amount of one currency into up to 32 other cryptocurrency or fiat currencies at the same time using latest exchange rates. Optionally pass a historical timestamp to convert values based on historic averages.
|
468
|
+
|
469
|
+
- Available API Plans:
|
470
|
+
- Basic
|
471
|
+
- Hobbyist
|
472
|
+
- Startup
|
473
|
+
- Standard
|
474
|
+
- Professional
|
475
|
+
- Enterprise
|
476
|
+
|
477
|
+
```ruby
|
478
|
+
client.tools.price_conversion(amount: 10.43, id: [1])
|
479
|
+
```
|
480
|
+
|
481
|
+
## Development
|
482
|
+
|
483
|
+
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.
|
484
|
+
|
485
|
+
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](https://rubygems.org).
|
486
|
+
|
487
|
+
## Contributing
|
488
|
+
|
489
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/coin_market_pro.
|
490
|
+
|
491
|
+
## License
|
492
|
+
|
493
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'coin_market_pro'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|