coinmarketcap_free 0.1.0 → 0.1.1
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/.idea/coinmarketcap_free.iml +1 -29
- data/Gemfile.lock +1 -1
- data/README.md +42 -24
- data/lib/coinmarketcap_free/base.rb +6 -2
- data/lib/coinmarketcap_free/coin.rb +8 -7
- data/lib/coinmarketcap_free/cryptocurrencies.rb +30 -27
- data/lib/coinmarketcap_free/version.rb +1 -1
- data/lib/coinmarketcap_free.rb +167 -0
- metadata +2 -3
- data/sig/coinmarketcap_free.rbs +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42031b26596411c5f8adefeb582aeafeeddbb31c0d1260d66923a666677a5b7d
|
4
|
+
data.tar.gz: 2463999e77f6e0ea0717b9c5bfba002eab0e99ba8a959210688d6645d257d848
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9be21f8a5a170e26697c3bb56a5ea6fadc597754c8b565acb4a14717a03a9570fc5d4688cadf58ce38f67ee1c693cb8bf36857f95bbcde96d700f9fd29f4b377
|
7
|
+
data.tar.gz: 847a0ce2f8faf598f5703fd3378e67cc6d3b74f901e0fbb1cebb243a57b21fadce7a4d44e7f7a42df5e0dbd4c653f6b89677921f0c9215d9ef8e7846c3b0846d
|
@@ -21,35 +21,7 @@
|
|
21
21
|
</component>
|
22
22
|
<component name="RakeTasksCache">
|
23
23
|
<option name="myRootTask">
|
24
|
-
<RakeTaskImpl id="rake"
|
25
|
-
<subtasks>
|
26
|
-
<RakeTaskImpl description="Build coinmarketcap_free-0.1.0.gem into the pkg directory" fullCommand="build" id="build" />
|
27
|
-
<RakeTaskImpl id="build">
|
28
|
-
<subtasks>
|
29
|
-
<RakeTaskImpl description="Generate SHA512 checksum if coinmarketcap_free-0.1.0.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
|
30
|
-
</subtasks>
|
31
|
-
</RakeTaskImpl>
|
32
|
-
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
33
|
-
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
34
|
-
<RakeTaskImpl description="Build and install coinmarketcap_free-0.1.0.gem into system gems" fullCommand="install" id="install" />
|
35
|
-
<RakeTaskImpl id="install">
|
36
|
-
<subtasks>
|
37
|
-
<RakeTaskImpl description="Build and install coinmarketcap_free-0.1.0.gem into system gems without network access" fullCommand="install:local" id="local" />
|
38
|
-
</subtasks>
|
39
|
-
</RakeTaskImpl>
|
40
|
-
<RakeTaskImpl description="Create tag v0.1.0 and build and push coinmarketcap_free-0.1.0.gem to https://rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
41
|
-
<RakeTaskImpl description="Run tests" fullCommand="test" id="test" />
|
42
|
-
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
43
|
-
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
44
|
-
<RakeTaskImpl id="release">
|
45
|
-
<subtasks>
|
46
|
-
<RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
|
47
|
-
<RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
|
48
|
-
<RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
|
49
|
-
</subtasks>
|
50
|
-
</RakeTaskImpl>
|
51
|
-
</subtasks>
|
52
|
-
</RakeTaskImpl>
|
24
|
+
<RakeTaskImpl id="rake" />
|
53
25
|
</option>
|
54
26
|
</component>
|
55
27
|
</module>
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -13,10 +13,18 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
13
13
|
$ gem install coinmarketcap_free
|
14
14
|
|
15
15
|
## Usage
|
16
|
+
You can use the objects classes also single methods like this.
|
17
|
+
|
16
18
|
``` Ruby
|
17
|
-
list = CoinmarketcapFree::Cryptocurrencies.new(100, 1)
|
19
|
+
list = CoinmarketcapFree::Cryptocurrencies.new(limit: 100, start: 1)
|
18
20
|
list.update
|
19
|
-
list.
|
21
|
+
list.get_data
|
22
|
+
```
|
23
|
+
|
24
|
+
or
|
25
|
+
|
26
|
+
``` Ruby
|
27
|
+
list = CoinmarketcapFree.coins(limit: 100, start: 1)
|
20
28
|
```
|
21
29
|
|
22
30
|
Result:
|
@@ -107,38 +115,48 @@ Result:
|
|
107
115
|
### If you want to sort in ascending, just write parameter:
|
108
116
|
|
109
117
|
``` Ruby
|
110
|
-
list = CoinmarketcapFree::Cryptocurrencies.new(100, 1, sort_type:'asc')
|
118
|
+
list = CoinmarketcapFree::Cryptocurrencies.new(limit: 100, start: 1, sort_type:'asc')
|
111
119
|
```
|
112
120
|
or
|
113
121
|
``` Ruby
|
114
|
-
list = CoinmarketcapFree::Cryptocurrencies.new(100, 1)
|
122
|
+
list = CoinmarketcapFree::Cryptocurrencies.new(limit: 100, start: 1)
|
115
123
|
list.sort_type = 'asc'
|
116
124
|
```
|
117
125
|
|
118
126
|
Also other parameters for Cryptocurrencies:
|
119
127
|
|
120
|
-
| Name | Type | Description
|
121
|
-
|
122
|
-
| ```
|
123
|
-
| ```
|
124
|
-
| ```
|
125
|
-
| ```
|
126
|
-
| ```
|
127
|
-
| ```
|
128
|
-
| ```
|
129
|
-
| ```
|
130
|
-
| ```
|
131
|
-
| ```
|
132
|
-
| ```
|
133
|
-
| ```
|
134
|
-
| ```
|
128
|
+
| Name | Type | Description | For example |
|
129
|
+
|:--------------------------------|:---------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------|
|
130
|
+
| ```limit:``` | Integer. | Optionally specify the number of results to return. Use this parameter and the "start" parameter to determine your own pagination size. ||
|
131
|
+
| ```start:``` | Integer. | Optionally offset the start (1-based index) of the paginated list of items to return. ||
|
132
|
+
| ```sort_by:``` | String. | Default: ```market_cap```. (```rank```, ```name```, ```symbol```, ```date_added```, ```market_cap```, ```market_cap_strict```, ```price```, ```circulating_supply```, ```total_supply```, ```max_supply```, ```num_market_pairs```, ```volume_24h```, ```percent_change_1h```, ```percent_change_24h```, ```percent_change_7d```, ```market_cap_by_total_supply_strict```, ```volume_7d```, ```volume_30d```). What field to sort the list of cryptocurrencies by. ||
|
133
|
+
| ```sort_type:``` | String. | Default: ```desc```. (```asc``` or ```desc```). The direction in which to order cryptocurrencies against the specified sort. ||
|
134
|
+
| ```convert:``` | String. | Default: ```USD```. Select cryptocurrencies to exchange (```AUD```, ```BRL```, ```CAD```, ```CHF```, ```CLP```, ```CNY```, ```CZK```, ```DKK```, ```EUR```, ```GBP```, ```HKD```, ```HUF```, ```IDR```, ```ILS```, ```INR```, ```JPY```, ```KRW```, ```MXN```, ```MYR```, ```NOK```, ```NZD```, ```PHP```, ```PKR```, ```PLN```, ```RUB```, ```SEK```, ```SGD```, ```THB```, ```TRY```, ```TWD```, ```ZAR```). | You can type many ```USD,BTC,ETH``` to convert or only one ```USD``` |
|
135
|
+
| ```crypto_type:``` | String. | Default: ```all```. (```all```, ```coins```, ```tokens```). The type of cryptocurrency to include. ||
|
136
|
+
| ```tag_type:``` | String. | Default: ```all```. (```all```, ```defi```, ```filesharing```). The tag of cryptocurrency to include. ||
|
137
|
+
| ```audited:``` | Boolean. | Show audited (true) or not (false) ||
|
138
|
+
| ```aux:``` | String. | Optionally specify a comma-separated list of supplemental data fields to return. Pass ```ath, atl, high24h, low24h, num_market_pairs, cmc_rank, date_added, max_supply, circulating_supply, total_supply, volume_7d, volume_30d, self_reported_circulating_supply, self_reported_market_cap``` to include all auxiliary fields. | You can type one ```ath``` or many fields ```ath, atl, high24h, low24h``` |
|
139
|
+
| ```tags:``` | String. | Default: ```mineable```. | Usually used ```mineable```. But you can use any tags: ```mineable```, ```sha-256``` or together ```mineable, sha-256, pow``` etc. |
|
140
|
+
| ```volume_24h_range:``` | String. | Optionally specify a threshold 24 hour USD volume to filter results by. | ```0~100000000000000000``` |
|
141
|
+
| ```percent_change_24h_range:``` | String. | Optionally specify a threshold 24 hour percent change to filter results by. | ```0~100``` or ```-10~100``` |
|
142
|
+
| ```circulating_supply_range:``` | String. | Optionally specify a threshold circulating supply to filter results by. | ```0~100000000000000000``` |
|
143
|
+
| ```price_range:``` | String. | Optionally specify a threshold USD price to filter results by. | ```0~100000000000000000``` |
|
144
|
+
| ```market_cap_range:``` | String. | Optionally specify a threshold market cap to filter results by. | ```0~100000000000000000``` |
|
135
145
|
|
136
146
|
### Returns an interval of historic market quotes:
|
137
147
|
|
148
|
+
You can use the objects classes also single methods like this.
|
149
|
+
|
138
150
|
``` Ruby
|
139
151
|
coin = CoinmarketcapFree::Coin.new(1, '1D')
|
140
152
|
coin.update
|
141
|
-
coin.
|
153
|
+
coin.get_data
|
154
|
+
```
|
155
|
+
|
156
|
+
or
|
157
|
+
|
158
|
+
``` Ruby
|
159
|
+
coin = CoinmarketcapFree.coin(1, '1D')
|
142
160
|
```
|
143
161
|
|
144
162
|
Result:
|
@@ -176,10 +194,10 @@ Result:
|
|
176
194
|
|
177
195
|
Parameters for Coin:
|
178
196
|
|
179
|
-
| Name | Type | Description
|
180
|
-
|
181
|
-
| ```id``` | Integer. | Cryptocurrency identifier from coinmarketcap.
|
182
|
-
| ```range_time``` | String. | Range time.
|
197
|
+
| Name | Type | Description | For example |
|
198
|
+
|:-----------------|:---------|:----------------------------------------------|:-------------------------------------------------------------------------------------------------------------------|
|
199
|
+
| ```id``` | Integer. | Cryptocurrency identifier from coinmarketcap. | Bitcoin has the number 1 |
|
200
|
+
| ```range_time``` | String. | Range time. | ```1D```, ```7D```, ```1M```, ```3M```, ```1Y```, ```YTD```, ```ALL``` or custom range ```1668981600~1671659999``` |
|
183
201
|
|
184
202
|
## Development
|
185
203
|
|
@@ -20,15 +20,19 @@ module CoinmarketcapFree
|
|
20
20
|
|
21
21
|
public
|
22
22
|
|
23
|
-
attr_reader :
|
23
|
+
attr_reader :get_data
|
24
24
|
|
25
|
+
# Refresh to get data
|
26
|
+
# @return [false, true] true data update is good If false is bad request, wrong parameter values, or the API has been updated
|
25
27
|
def update
|
26
28
|
begin
|
27
29
|
url = generate_uri_for_data
|
28
|
-
|
30
|
+
data = request_to_read_data(url)
|
29
31
|
rescue
|
32
|
+
@get_data = nil
|
30
33
|
false
|
31
34
|
else
|
35
|
+
@get_data = data
|
32
36
|
true
|
33
37
|
end
|
34
38
|
end
|
@@ -6,9 +6,9 @@ require 'coinmarketcap_free/base'
|
|
6
6
|
module CoinmarketcapFree
|
7
7
|
# Returns an interval of historic market quotes for any cryptocurrency based on time and interval parameters.
|
8
8
|
#
|
9
|
-
# For example, json
|
9
|
+
# For example, result json:
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# {
|
12
12
|
# "data": {
|
13
13
|
# "points": {
|
14
14
|
# "1673192010": {
|
@@ -35,10 +35,10 @@ module CoinmarketcapFree
|
|
35
35
|
# "elapsed": "2",
|
36
36
|
# "credit_count": 0
|
37
37
|
# }
|
38
|
-
#
|
38
|
+
# }
|
39
39
|
#
|
40
40
|
# 'data' - Results of your query returned as an object map.
|
41
|
-
#
|
41
|
+
# 'points' - Price range history
|
42
42
|
# 'status' - Standardized status object for API calls.
|
43
43
|
class Coin < BASE
|
44
44
|
URL_API = 'https://api.coinmarketcap.com/data-api/v3/cryptocurrency/detail/chart'.freeze
|
@@ -47,13 +47,14 @@ module CoinmarketcapFree
|
|
47
47
|
attr_accessor :id,
|
48
48
|
:range_time
|
49
49
|
|
50
|
-
# id Integer
|
51
|
-
# range_time String
|
52
|
-
def initialize(id, range_time)
|
50
|
+
# @param id [Integer] Cryptocurrency identifier from coinmarketcap. For example, Bitcoin has the number 1
|
51
|
+
# @param range_time [String] Range time. For example, '1D', '7D', '1M', '3M', '1Y', 'YTD', 'ALL' or custom range '1668981600~1671659999'
|
52
|
+
def initialize(id = 1, range_time = '1D')
|
53
53
|
@id = id
|
54
54
|
@range_time = range_time
|
55
55
|
end
|
56
56
|
|
57
|
+
private
|
57
58
|
def generate_uri_for_data
|
58
59
|
query = "#{URL_API}?id=#{id}&range=#{range_time}"
|
59
60
|
URI(query)
|
@@ -4,11 +4,11 @@ require 'coinmarketcap_free/helper'
|
|
4
4
|
require 'coinmarketcap_free/base'
|
5
5
|
|
6
6
|
module CoinmarketcapFree
|
7
|
-
# Get a list of cryptocurrencies
|
7
|
+
# Get a list of cryptocurrencies.
|
8
8
|
#
|
9
|
-
# For example, result json
|
9
|
+
# For example, result json:
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# {
|
12
12
|
# "data": {
|
13
13
|
# "cryptoCurrencyList": [
|
14
14
|
# {
|
@@ -81,42 +81,44 @@ module CoinmarketcapFree
|
|
81
81
|
# ],
|
82
82
|
# "totalCount": "8857"
|
83
83
|
# },
|
84
|
-
#
|
84
|
+
# "status": {
|
85
85
|
# "timestamp": "2023-01-08T15:33:30.271Z",
|
86
86
|
# "error_code": "0",
|
87
87
|
# "error_message": "SUCCESS",
|
88
88
|
# "elapsed": "2",
|
89
89
|
# "credit_count": 0
|
90
|
-
#
|
91
|
-
#
|
90
|
+
# }
|
91
|
+
# }
|
92
92
|
#
|
93
93
|
# 'data' - Results of your query returned as an object map.
|
94
|
-
#
|
95
|
-
#
|
94
|
+
# 'cryptoCurrencyList' - Array of cryptocurrency objects matching the list options.
|
95
|
+
# 'totalCount' - Total number of cryptocurrencies
|
96
96
|
# 'status' - Standardized status object for API calls.
|
97
97
|
class Cryptocurrencies < BASE
|
98
98
|
|
99
99
|
URL_API = 'https://api.coinmarketcap.com/data-api/v3/cryptocurrency/listing'.freeze
|
100
100
|
private_constant :URL_API
|
101
101
|
|
102
|
-
#
|
103
|
-
#
|
104
|
-
#
|
105
|
-
#
|
106
|
-
#
|
107
|
-
#
|
108
|
-
#
|
109
|
-
#
|
110
|
-
#
|
111
|
-
#
|
112
|
-
#
|
113
|
-
#
|
114
|
-
#
|
115
|
-
#
|
116
|
-
#
|
117
|
-
|
118
|
-
|
119
|
-
|
102
|
+
# Parameters: limit, start, sort_by, sort_type, convert, crypto_type, tag_type, audited, aux, tags, volume_24h_range, percent_change_24h_range, circulating_supply_range, price_range, market_cap_range
|
103
|
+
#
|
104
|
+
# @param start [Integer] Default: 1. Optionally offset the start (1-based index) of the paginated list of items to return.
|
105
|
+
# @param limit [Integer] Default: 100. Optionally specify the number of results to return. Use this parameter and the "start" parameter to determine your own pagination size.
|
106
|
+
# @param sort_by [String] Default: "market_cap". ("rank", "name", "symbol", "date_added", "market_cap", "market_cap_strict", "price", "circulating_supply", "total_supply", "max_supply", "num_market_pairs", "volume_24h", "percent_change_1h", "percent_change_24h", "percent_change_7d", "market_cap_by_total_supply_strict", "volume_7d", "volume_30d"). What field to sort the list of cryptocurrencies by.
|
107
|
+
# @param sort_type [String] Default: "desc". ("asc" or "desc"). The direction in which to order cryptocurrencies against the specified sort.
|
108
|
+
# @param convert [String] Default: 'USD'. Default: 'USD'. Select cryptocurrencies to exchange ("AUD", "BRL", "CAD", "CHF", "CLP", "CNY", "CZK", "DKK", "EUR", "GBP", "HKD", "HUF", "IDR", "ILS", "INR", "JPY", "KRW", "MXN", "MYR", "NOK", "NZD", "PHP", "PKR", "PLN", "RUB", "SEK", "SGD", "THB", "TRY", "TWD", "ZAR"). For example, many 'USD,BTC,ETH' to convert or only one 'USD'
|
109
|
+
# @param crypto_type [String] Default: "all". ("all", "coins", "tokens"). The type of cryptocurrency to include.
|
110
|
+
# @param tag_type [String] Default: "all". ("all", "defi", "filesharing"). The tag of cryptocurrency to include.
|
111
|
+
# @param audited [FalseClass, TrueClass] false or true
|
112
|
+
# @param aux [String] Optionally specify a comma-separated list of supplemental data fields to return. Pass 'ath, atl, high24h, low24h, num_market_pairs, cmc_rank, date_added, max_supply, circulating_supply, total_supply, volume_7d, volume_30d, self_reported_circulating_supply, self_reported_market_cap' to include all auxiliary fields.
|
113
|
+
# @param tags [String] Usually used 'mineable'.
|
114
|
+
# @param volume_24h_range [String] Optionally specify a threshold 24 hour USD volume to filter results by. For example, For example, '0~100000000000000000'
|
115
|
+
# @param percent_change_24h_range [String] Optionally specify a threshold 24 hour percent change to filter results by. For example, '0~100' or '-10~100'
|
116
|
+
# @param circulating_supply_range [String] Optionally specify a threshold circulating supply to filter results by. For example, '0~100000000000000000'
|
117
|
+
# @param price_range [String] Optionally specify a threshold USD price to filter results by. For example, '0~100000000000000000'
|
118
|
+
# @param market_cap_range [String] Optionally specify a threshold market cap to filter results by. For example, '0~100000000000000000'
|
119
|
+
def initialize(**options)
|
120
|
+
@limit = options[:limit].nil? ? 100 : options[:limit] # Integer
|
121
|
+
@start = options[:start].nil? ? 1 : options[:start] # Integer
|
120
122
|
@sort_by = options[:sort_by] # String
|
121
123
|
@sort_type = options[:sort_type] # String
|
122
124
|
@convert = options[:convert] # String
|
@@ -148,6 +150,7 @@ module CoinmarketcapFree
|
|
148
150
|
:price_range,
|
149
151
|
:market_cap_range
|
150
152
|
|
153
|
+
private
|
151
154
|
def generate_uri_for_data
|
152
155
|
options = self.instance_variables
|
153
156
|
.select { |name_var| not self.instance_variable_get(name_var).nil? }
|
@@ -157,4 +160,4 @@ module CoinmarketcapFree
|
|
157
160
|
URI(query)
|
158
161
|
end
|
159
162
|
end
|
160
|
-
end
|
163
|
+
end
|
data/lib/coinmarketcap_free.rb
CHANGED
@@ -6,4 +6,171 @@ require_relative "coinmarketcap_free/base"
|
|
6
6
|
require_relative "coinmarketcap_free/version"
|
7
7
|
|
8
8
|
module CoinmarketcapFree
|
9
|
+
class << self
|
10
|
+
@@cryptocurrencies = Cryptocurrencies.new
|
11
|
+
@@coin = Coin.new
|
12
|
+
|
13
|
+
# Returns an interval of historic market quotes for any cryptocurrency based on time and interval parameters.
|
14
|
+
#
|
15
|
+
# For example, result json:
|
16
|
+
#
|
17
|
+
# {
|
18
|
+
# "data": {
|
19
|
+
# "points": {
|
20
|
+
# "1673192010": {
|
21
|
+
# "v": [
|
22
|
+
# 16953.771282696678,
|
23
|
+
# 7609543976.45,
|
24
|
+
# 326457581376.786557398500,
|
25
|
+
# 1,
|
26
|
+
# 19255750.00000000000000000000
|
27
|
+
# ],
|
28
|
+
# "c": [
|
29
|
+
# 16953.771282696678,
|
30
|
+
# 7609543976.45,
|
31
|
+
# 326457581376.786557398500
|
32
|
+
# ]
|
33
|
+
# },
|
34
|
+
# ...
|
35
|
+
# }
|
36
|
+
# },
|
37
|
+
# "status": {
|
38
|
+
# "timestamp": "2023-01-08T15:33:30.271Z",
|
39
|
+
# "error_code": "0",
|
40
|
+
# "error_message": "SUCCESS",
|
41
|
+
# "elapsed": "2",
|
42
|
+
# "credit_count": 0
|
43
|
+
# }
|
44
|
+
# }
|
45
|
+
#
|
46
|
+
# 'data' - Results of your query returned as an object map.
|
47
|
+
# 'points' - Price range history
|
48
|
+
# 'status' - Standardized status object for API calls.
|
49
|
+
#
|
50
|
+
# @param id [Integer] Cryptocurrency identifier from coinmarketcap. For example, Bitcoin has the number 1
|
51
|
+
# @param range_time [String] Range time. For example, '1D', '7D', '1M', '3M', '1Y', 'YTD', 'ALL' or custom range '1668981600~1671659999'
|
52
|
+
# @return [String, nil]
|
53
|
+
def coin_history(id, range_time)
|
54
|
+
@@coin.id = id
|
55
|
+
@@coin.range_time = range_time
|
56
|
+
@@coin.update ? @@coin.get_data : nil
|
57
|
+
end
|
58
|
+
|
59
|
+
# Get a list of cryptocurrencies
|
60
|
+
#
|
61
|
+
# For example, result json:
|
62
|
+
#
|
63
|
+
# {
|
64
|
+
# "data": {
|
65
|
+
# "cryptoCurrencyList": [
|
66
|
+
# {
|
67
|
+
# "id": 1,
|
68
|
+
# "name": "Bitcoin",
|
69
|
+
# "symbol": "BTC",
|
70
|
+
# "slug": "bitcoin",
|
71
|
+
# "tags": [
|
72
|
+
# "mineable",
|
73
|
+
# "pow",
|
74
|
+
# "sha-256",
|
75
|
+
# "store-of-value",
|
76
|
+
# "state-channel",
|
77
|
+
# "coinbase-ventures-portfolio",
|
78
|
+
# "three-arrows-capital-portfolio",
|
79
|
+
# "polychain-capital-portfolio",
|
80
|
+
# "binance-labs-portfolio",
|
81
|
+
# "blockchain-capital-portfolio",
|
82
|
+
# "boostvc-portfolio",
|
83
|
+
# "cms-holdings-portfolio",
|
84
|
+
# "dcg-portfolio",
|
85
|
+
# "dragonfly-capital-portfolio",
|
86
|
+
# "electric-capital-portfolio",
|
87
|
+
# "fabric-ventures-portfolio",
|
88
|
+
# "framework-ventures-portfolio",
|
89
|
+
# "galaxy-digital-portfolio",
|
90
|
+
# "huobi-capital-portfolio",
|
91
|
+
# "alameda-research-portfolio",
|
92
|
+
# "a16z-portfolio",
|
93
|
+
# "1confirmation-portfolio",
|
94
|
+
# "winklevoss-capital-portfolio",
|
95
|
+
# "usv-portfolio",
|
96
|
+
# "placeholder-ventures-portfolio",
|
97
|
+
# "pantera-capital-portfolio",
|
98
|
+
# "multicoin-capital-portfolio",
|
99
|
+
# "paradigm-portfolio"
|
100
|
+
# ],
|
101
|
+
# "cmcRank": 1,
|
102
|
+
# "marketPairCount": 9922,
|
103
|
+
# "circulatingSupply": 19256812.0,
|
104
|
+
# "selfReportedCirculatingSupply": 0,
|
105
|
+
# "totalSupply": 19256812.0,
|
106
|
+
# "maxSupply": 21000000.0,
|
107
|
+
# "isActive": 1,
|
108
|
+
# "lastUpdated": "2023-01-09T08:25:00.000Z",
|
109
|
+
# "dateAdded": "2013-04-28T00:00:00.000Z",
|
110
|
+
# "quotes": [
|
111
|
+
# {
|
112
|
+
# "name": "USD",
|
113
|
+
# "price": 17209.447088639048,
|
114
|
+
# "volume24h": 13652714044.770432,
|
115
|
+
# "marketCap": 331399087209.8695,
|
116
|
+
# "percentChange1h": -0.00692023,
|
117
|
+
# "percentChange24h": 1.50954046,
|
118
|
+
# "percentChange7d": 2.78181713,
|
119
|
+
# "lastUpdated": "2023-01-09T08:25:00.000Z",
|
120
|
+
# "percentChange30d": 0.30441134,
|
121
|
+
# "percentChange60d": 3.89490715,
|
122
|
+
# "percentChange90d": -9.99714982,
|
123
|
+
# "fullyDilluttedMarketCap": 361398388861.42,
|
124
|
+
# "marketCapByTotalSupply": 331399087209.8695,
|
125
|
+
# "dominance": 39.0828,
|
126
|
+
# "turnover": 0.0411972,
|
127
|
+
# "ytdPriceChangePercentage": 3.515
|
128
|
+
# }
|
129
|
+
# ],
|
130
|
+
# "isAudited": false
|
131
|
+
# }
|
132
|
+
# ...
|
133
|
+
# ],
|
134
|
+
# "totalCount": "8857"
|
135
|
+
# },
|
136
|
+
# "status": {
|
137
|
+
# "timestamp": "2023-01-08T15:33:30.271Z",
|
138
|
+
# "error_code": "0",
|
139
|
+
# "error_message": "SUCCESS",
|
140
|
+
# "elapsed": "2",
|
141
|
+
# "credit_count": 0
|
142
|
+
# }
|
143
|
+
# }
|
144
|
+
#
|
145
|
+
# 'data' - Results of your query returned as an object map.
|
146
|
+
# 'cryptoCurrencyList' - Array of cryptocurrency objects matching the list options.
|
147
|
+
# 'totalCount' - Total number of cryptocurrencies
|
148
|
+
# 'status' - Standardized status object for API calls.
|
149
|
+
#
|
150
|
+
# @param start [Integer] Default: 1. Optionally offset the start (1-based index) of the paginated list of items to return.
|
151
|
+
# @param limit [Integer] Default: 100. Optionally specify the number of results to return. Use this parameter and the "start" parameter to determine your own pagination size.
|
152
|
+
# @param sort_by [String] Default: "market_cap". ("rank", "name", "symbol", "date_added", "market_cap", "market_cap_strict", "price", "circulating_supply", "total_supply", "max_supply", "num_market_pairs", "volume_24h", "percent_change_1h", "percent_change_24h", "percent_change_7d", "market_cap_by_total_supply_strict", "volume_7d", "volume_30d"). What field to sort the list of cryptocurrencies by.
|
153
|
+
# @param sort_type [String] Default: "desc". ("asc" or "desc"). The direction in which to order cryptocurrencies against the specified sort.
|
154
|
+
# @param convert [String] Default: 'USD'. Default: 'USD'. Select cryptocurrencies to exchange ("AUD", "BRL", "CAD", "CHF", "CLP", "CNY", "CZK", "DKK", "EUR", "GBP", "HKD", "HUF", "IDR", "ILS", "INR", "JPY", "KRW", "MXN", "MYR", "NOK", "NZD", "PHP", "PKR", "PLN", "RUB", "SEK", "SGD", "THB", "TRY", "TWD", "ZAR"). For example, many 'USD,BTC,ETH' to convert or only one 'USD'
|
155
|
+
# @param crypto_type [String] Default: "all". ("all", "coins", "tokens"). The type of cryptocurrency to include.
|
156
|
+
# @param tag_type [String] Default: "all". ("all", "defi", "filesharing"). The tag of cryptocurrency to include.
|
157
|
+
# @param audited [FalseClass, TrueClass] false or true
|
158
|
+
# @param aux [String] Optionally specify a comma-separated list of supplemental data fields to return. Pass 'ath, atl, high24h, low24h, num_market_pairs, cmc_rank, date_added, max_supply, circulating_supply, total_supply, volume_7d, volume_30d, self_reported_circulating_supply, self_reported_market_cap' to include all auxiliary fields.
|
159
|
+
# @param tags [String] Usually used 'mineable'.
|
160
|
+
# @param volume_24h_range [String] Optionally specify a threshold 24 hour USD volume to filter results by. For example, For example, '0~100000000000000000'
|
161
|
+
# @param percent_change_24h_range [String] Optionally specify a threshold 24 hour percent change to filter results by. For example, '0~100' or '-10~100'
|
162
|
+
# @param circulating_supply_range [String] Optionally specify a threshold circulating supply to filter results by. For example, '0~100000000000000000'
|
163
|
+
# @param price_range [String] Optionally specify a threshold USD price to filter results by. For example, '0~100000000000000000'
|
164
|
+
# @param market_cap_range [String] Optionally specify a threshold market cap to filter results by. For example, '0~100000000000000000'
|
165
|
+
#
|
166
|
+
# @return [String, nil]
|
167
|
+
def coins(**options)
|
168
|
+
@@cryptocurrencies.instance_variables.each do |var_name|
|
169
|
+
value = options[var_name.to_s.delete('@').to_sym]
|
170
|
+
@@cryptocurrencies.instance_variable_set(var_name, value) unless value.nil?
|
171
|
+
end
|
172
|
+
|
173
|
+
@@cryptocurrencies.update ? @@cryptocurrencies.get_data : nil
|
174
|
+
end
|
175
|
+
end
|
9
176
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coinmarketcap_free
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cosmic-1
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Cryptocurrency information from the Coinmarketcap site without a key.
|
14
14
|
email:
|
@@ -32,7 +32,6 @@ files:
|
|
32
32
|
- lib/coinmarketcap_free/cryptocurrencies.rb
|
33
33
|
- lib/coinmarketcap_free/helper.rb
|
34
34
|
- lib/coinmarketcap_free/version.rb
|
35
|
-
- sig/coinmarketcap_free.rbs
|
36
35
|
homepage: https://github.com/Cosmic-1/coinmarketcap_free
|
37
36
|
licenses:
|
38
37
|
- MIT
|
data/sig/coinmarketcap_free.rbs
DELETED