Class: CoinmarketcapClient::DefaultApi

Inherits:
Object
  • Object
show all
Defined in:
lib/coinmarketcap_client/api/default_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DefaultApi

Returns a new instance of DefaultApi.



19
20
21
# File 'lib/coinmarketcap_client/api/default_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/coinmarketcap_client/api/default_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#cryptocurrency_info_get(opts = {}) ⇒ InlineResponse2006

Get metadata Returns all static metadata for one or more cryptocurrencies including name, symbol, logo, and its various registered URLs.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :id (String)

    One or more comma-separated CoinMarketCap cryptocurrency IDs. Example "1,2"

  • :symbol (String)

    Alternatively pass one or more comma-separated cryptocurrency symbols. Example: "BTC,ETH". At least one "id" or "symbol" is required.

Returns:



28
29
30
31
# File 'lib/coinmarketcap_client/api/default_api.rb', line 28

def cryptocurrency_info_get(opts = {})
  data, _status_code, _headers = cryptocurrency_info_get_with_http_info(opts)
  data
end

#cryptocurrency_info_get_with_http_info(opts = {}) ⇒ Array<(InlineResponse2006, Fixnum, Hash)>

Get metadata Returns all static metadata for one or more cryptocurrencies including name, symbol, logo, and its various registered URLs.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :id (String)

    One or more comma-separated CoinMarketCap cryptocurrency IDs. Example &quot;1,2&quot;

  • :symbol (String)

    Alternatively pass one or more comma-separated cryptocurrency symbols. Example: &quot;BTC,ETH&quot;. At least one &quot;id&quot; or &quot;symbol&quot; is required.

Returns:

  • (Array<(InlineResponse2006, Fixnum, Hash)>)

    InlineResponse2006 data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/coinmarketcap_client/api/default_api.rb', line 39

def cryptocurrency_info_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.cryptocurrency_info_get ...'
  end
  # resource path
  local_var_path = '/cryptocurrency/info'

  # query parameters
  query_params = {}
  query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?
  query_params[:'symbol'] = opts[:'symbol'] if !opts[:'symbol'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse2006')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#cryptocurrency_info_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#cryptocurrency_listings_historical_get(opts = {}) ⇒ InlineResponse2007

List all cryptocurrencies (historical) Get a paginated list of all cryptocurrencies with market data for a given historical time. Use the "convert" option to return market values in multiple fiat and cryptocurrency conversions in the same call.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :timestamp (String)

    Timestamp (Unix or ISO 8601) to return historical cryptocurrency listings for.

  • :start (Integer)

    Optionally offset the start (1-based index) of the paginated list of items to return. (default to 1)

  • :limit (Integer)

    Optionally specify the number of results to return. Use this parameter and the &quot;start&quot; parameter to determine your own pagination size. (default to 100)

  • :convert (String)

    Optionally calculate market quotes in up to 120 currencies at once by passing a comma-separated list of cryptocurrency or fiat currency symbols. Each additional convert option beyond the first requires an additional call credit. A list of supported fiat options can be found here. Each conversion is returned in its own &quot;quote&quot; object. (default to USD)

  • :sort (String)

    Valid values &#x60;name&#x60; &#x60;symbol&#x60; &#x60;date_added&#x60; &#x60;market_cap&#x60; &#x60;price&#x60; &#x60;circulating_supply&#x60; &#x60;total_supply&#x60; &#x60;max_supply&#x60; &#x60;num_market_pairs&#x60; &#x60;volume_24h&#x60; &#x60;percent_change_1h&#x60; &#x60;percent_change_24h&#x60; &#x60;percent_change_7d&#x60; What field to sort the list of cryptocurrencies by. (default to market_cap)

  • :sort_dir (String)

    Valid values &#x60;asc&#x60; &#x60;desc&#x60;. The direction in which to order cryptocurrencies against the specified sort.

  • :cryptocurrency_type (String)

    Valid values &#x60;all&#x60; &#x60;coins&#x60; &#x60;tokens&#x60; The type of cryptocurrency to include.

Returns:



85
86
87
88
# File 'lib/coinmarketcap_client/api/default_api.rb', line 85

def cryptocurrency_listings_historical_get(opts = {})
  data, _status_code, _headers = cryptocurrency_listings_historical_get_with_http_info(opts)
  data
end

#cryptocurrency_listings_historical_get_with_http_info(opts = {}) ⇒ Array<(InlineResponse2007, Fixnum, Hash)>

List all cryptocurrencies (historical) Get a paginated list of all cryptocurrencies with market data for a given historical time. Use the &quot;convert&quot; option to return market values in multiple fiat and cryptocurrency conversions in the same call.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :timestamp (String)

    Timestamp (Unix or ISO 8601) to return historical cryptocurrency listings for.

  • :start (Integer)

    Optionally offset the start (1-based index) of the paginated list of items to return.

  • :limit (Integer)

    Optionally specify the number of results to return. Use this parameter and the &quot;start&quot; parameter to determine your own pagination size.

  • :convert (String)

    Optionally calculate market quotes in up to 120 currencies at once by passing a comma-separated list of cryptocurrency or fiat currency symbols. Each additional convert option beyond the first requires an additional call credit. A list of supported fiat options can be found here. Each conversion is returned in its own &quot;quote&quot; object.

  • :sort (String)

    Valid values &#x60;name&#x60; &#x60;symbol&#x60; &#x60;date_added&#x60; &#x60;market_cap&#x60; &#x60;price&#x60; &#x60;circulating_supply&#x60; &#x60;total_supply&#x60; &#x60;max_supply&#x60; &#x60;num_market_pairs&#x60; &#x60;volume_24h&#x60; &#x60;percent_change_1h&#x60; &#x60;percent_change_24h&#x60; &#x60;percent_change_7d&#x60; What field to sort the list of cryptocurrencies by.

  • :sort_dir (String)

    Valid values &#x60;asc&#x60; &#x60;desc&#x60;. The direction in which to order cryptocurrencies against the specified sort.

  • :cryptocurrency_type (String)

    Valid values &#x60;all&#x60; &#x60;coins&#x60; &#x60;tokens&#x60; The type of cryptocurrency to include.

Returns:

  • (Array<(InlineResponse2007, Fixnum, Hash)>)

    InlineResponse2007 data, response status code and response headers



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/coinmarketcap_client/api/default_api.rb', line 101

def cryptocurrency_listings_historical_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.cryptocurrency_listings_historical_get ...'
  end
  if @api_client.config.client_side_validation && !opts[:'start'].nil? && opts[:'start'] < 1
    fail ArgumentError, 'invalid value for "opts[:"start"]" when calling DefaultApi.cryptocurrency_listings_historical_get, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 5000
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DefaultApi.cryptocurrency_listings_historical_get, must be smaller than or equal to 5000.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DefaultApi.cryptocurrency_listings_historical_get, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/cryptocurrency/listings/historical'

  # query parameters
  query_params = {}
  query_params[:'timestamp'] = opts[:'timestamp'] if !opts[:'timestamp'].nil?
  query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'convert'] = opts[:'convert'] if !opts[:'convert'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'sort_dir'] = opts[:'sort_dir'] if !opts[:'sort_dir'].nil?
  query_params[:'cryptocurrency_type'] = opts[:'cryptocurrency_type'] if !opts[:'cryptocurrency_type'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse2007')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#cryptocurrency_listings_historical_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#cryptocurrency_listings_latest_get(opts = {}) ⇒ InlineResponse2007

List all cryptocurrencies (latest) Get a paginated list of all cryptocurrencies with latest market data. You can configure this call to sort by market cap or another market ranking field. Use the "convert" option to return market values in multiple fiat and cryptocurrency conversions in the same call.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Optionally offset the start (1-based index) of the paginated list of items to return. (default to 1)

  • :limit (Integer)

    Optionally specify the number of results to return. Use this parameter and the &quot;start&quot; parameter to determine your own pagination size. (default to 100)

  • :convert (String)

    Optionally calculate market quotes in up to 120 currencies at once by passing a comma-separated list of cryptocurrency or fiat currency symbols. Each additional convert option beyond the first requires an additional call credit. A list of supported fiat options can be found here. Each conversion is returned in its own &quot;quote&quot; object. (default to USD)

  • :sort (String)

    Valid values &#x60;name&#x60; &#x60;symbol&#x60; &#x60;date_added&#x60; &#x60;market_cap&#x60; &#x60;price&#x60; &#x60;circulating_supply&#x60; &#x60;total_supply&#x60; &#x60;max_supply&#x60; &#x60;num_market_pairs&#x60; &#x60;volume_24h&#x60; &#x60;percent_change_1h&#x60; &#x60;percent_change_24h&#x60; &#x60;percent_change_7d&#x60; What field to sort the list of cryptocurrencies by. (default to market_cap)

  • :sort_dir (String)

    Valid values &#x60;asc&#x60; &#x60;desc&#x60;. The direction in which to order cryptocurrencies against the specified sort.

  • :cryptocurrency_type (String)

    Valid values &#x60;all&#x60; &#x60;coins&#x60; &#x60;tokens&#x60; The type of cryptocurrency to include.

Returns:



163
164
165
166
# File 'lib/coinmarketcap_client/api/default_api.rb', line 163

def cryptocurrency_listings_latest_get(opts = {})
  data, _status_code, _headers = cryptocurrency_listings_latest_get_with_http_info(opts)
  data
end

#cryptocurrency_listings_latest_get_with_http_info(opts = {}) ⇒ Array<(InlineResponse2007, Fixnum, Hash)>

List all cryptocurrencies (latest) Get a paginated list of all cryptocurrencies with latest market data. You can configure this call to sort by market cap or another market ranking field. Use the &quot;convert&quot; option to return market values in multiple fiat and cryptocurrency conversions in the same call.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start (Integer)

    Optionally offset the start (1-based index) of the paginated list of items to return.

  • :limit (Integer)

    Optionally specify the number of results to return. Use this parameter and the &quot;start&quot; parameter to determine your own pagination size.

  • :convert (String)

    Optionally calculate market quotes in up to 120 currencies at once by passing a comma-separated list of cryptocurrency or fiat currency symbols. Each additional convert option beyond the first requires an additional call credit. A list of supported fiat options can be found here. Each conversion is returned in its own &quot;quote&quot; object.

  • :sort (String)

    Valid values &#x60;name&#x60; &#x60;symbol&#x60; &#x60;date_added&#x60; &#x60;market_cap&#x60; &#x60;price&#x60; &#x60;circulating_supply&#x60; &#x60;total_supply&#x60; &#x60;max_supply&#x60; &#x60;num_market_pairs&#x60; &#x60;volume_24h&#x60; &#x60;percent_change_1h&#x60; &#x60;percent_change_24h&#x60; &#x60;percent_change_7d&#x60; What field to sort the list of cryptocurrencies by.

  • :sort_dir (String)

    Valid values &#x60;asc&#x60; &#x60;desc&#x60;. The direction in which to order cryptocurrencies against the specified sort.

  • :cryptocurrency_type (String)

    Valid values &#x60;all&#x60; &#x60;coins&#x60; &#x60;tokens&#x60; The type of cryptocurrency to include.

Returns:

  • (Array<(InlineResponse2007, Fixnum, Hash)>)

    InlineResponse2007 data, response status code and response headers



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/coinmarketcap_client/api/default_api.rb', line 178

def cryptocurrency_listings_latest_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.cryptocurrency_listings_latest_get ...'
  end
  if @api_client.config.client_side_validation && !opts[:'start'].nil? && opts[:'start'] < 1
    fail ArgumentError, 'invalid value for "opts[:"start"]" when calling DefaultApi.cryptocurrency_listings_latest_get, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 5000
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DefaultApi.cryptocurrency_listings_latest_get, must be smaller than or equal to 5000.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DefaultApi.cryptocurrency_listings_latest_get, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/cryptocurrency/listings/latest'

  # query parameters
  query_params = {}
  query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'convert'] = opts[:'convert'] if !opts[:'convert'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'sort_dir'] = opts[:'sort_dir'] if !opts[:'sort_dir'].nil?
  query_params[:'cryptocurrency_type'] = opts[:'cryptocurrency_type'] if !opts[:'cryptocurrency_type'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse2007')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#cryptocurrency_listings_latest_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#cryptocurrency_map_get(opts = {}) ⇒ InlineResponse2005

Get CoinMarketCap ID map Returns a paginated list of all cryptocurrencies by CoinMarketCap ID. We recommend using this convenience endpoint to lookup and utilize our unique cryptocurrency id across all endpoints as typical identifiers like ticker symbols can match multiple cryptocurrencies and change over time. As a convenience you may pass a comma-separated list of cryptocurrency symbols as symbol to filter this list to only those you require.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :listing_status (String)

    Only active coins are returned by default. Pass &#39;inactive&#39; to get a list of coins that are no longer active. (default to active)

  • :start (Integer)

    Optionally offset the start (1-based index) of the paginated list of items to return. (default to 1)

  • :limit (Integer)

    Optionally specify the number of results to return. Use this parameter and the &quot;start&quot; parameter to determine your own pagination size.

  • :symbol (String)

    Optionally pass a comma-separated list of cryptocurrency symbols to return CoinMarketCap IDs for. If this option is passed, other options will be ignored.

Returns:



237
238
239
240
# File 'lib/coinmarketcap_client/api/default_api.rb', line 237

def cryptocurrency_map_get(opts = {})
  data, _status_code, _headers = cryptocurrency_map_get_with_http_info(opts)
  data
end

#cryptocurrency_map_get_with_http_info(opts = {}) ⇒ Array<(InlineResponse2005, Fixnum, Hash)>

Get CoinMarketCap ID map Returns a paginated list of all cryptocurrencies by CoinMarketCap ID. We recommend using this convenience endpoint to lookup and utilize our unique cryptocurrency id across all endpoints as typical identifiers like ticker symbols can match multiple cryptocurrencies and change over time. As a convenience you may pass a comma-separated list of cryptocurrency symbols as symbol to filter this list to only those you require.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :listing_status (String)

    Only active coins are returned by default. Pass &#39;inactive&#39; to get a list of coins that are no longer active.

  • :start (Integer)

    Optionally offset the start (1-based index) of the paginated list of items to return.

  • :limit (Integer)

    Optionally specify the number of results to return. Use this parameter and the &quot;start&quot; parameter to determine your own pagination size.

  • :symbol (String)

    Optionally pass a comma-separated list of cryptocurrency symbols to return CoinMarketCap IDs for. If this option is passed, other options will be ignored.

Returns:

  • (Array<(InlineResponse2005, Fixnum, Hash)>)

    InlineResponse2005 data, response status code and response headers



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/coinmarketcap_client/api/default_api.rb', line 250

def cryptocurrency_map_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.cryptocurrency_map_get ...'
  end
  if @api_client.config.client_side_validation && !opts[:'start'].nil? && opts[:'start'] < 1
    fail ArgumentError, 'invalid value for "opts[:"start"]" when calling DefaultApi.cryptocurrency_map_get, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 5000
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DefaultApi.cryptocurrency_map_get, must be smaller than or equal to 5000.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling DefaultApi.cryptocurrency_map_get, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/cryptocurrency/map'

  # query parameters
  query_params = {}
  query_params[:'listing_status'] = opts[:'listing_status'] if !opts[:'listing_status'].nil?
  query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'symbol'] = opts[:'symbol'] if !opts[:'symbol'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse2005')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#cryptocurrency_map_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#global_metrics_quotes_historical_get(opts = {}) ⇒ InlineResponse2009

List all cryptocurrencies (latest) Get a paginated list of all cryptocurrencies with latest market data. You can configure this call to sort by market cap or another market ranking field. Use the "convert" option to return market values in multiple fiat and cryptocurrency conversions in the same call.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :time_start (String)

    Timestamp (Unix or ISO 8601) to start returning quotes for. Optional, if not passed, we&#39;ll return quotes calculated in reverse from &quot;time_end&quot;.

  • :time_end (String)

    Timestamp (Unix or ISO 8601) to stop returning quotes for (inclusive). Optional, if not passed, we&#39;ll default to the current time. If no &quot;time_start&quot; is passed, we return quotes in reverse order starting from this time.

  • :count (Integer)

    The number of interval periods to return results for. Optional, required if both &quot;time_start&quot; and &quot;time_end&quot; aren&#39;t supplied. The default is 10 items. The current query limit is 10000. (default to 10)

  • :interval (String)

    Valid values &quot;yearly&quot; &quot;monthly&quot; &quot;weekly&quot; &quot;daily&quot; &quot;hourly&quot; &quot;5m&quot; &quot;10m&quot; &quot;15m&quot; &quot;30m&quot; &quot;45m&quot; &quot;1h&quot; &quot;2h&quot; &quot;3h&quot; &quot;6h&quot; &quot;12h&quot; &quot;24h&quot; &quot;1d&quot; &quot;2d&quot; &quot;3d&quot; &quot;7d&quot; &quot;14d&quot; &quot;15d&quot; &quot;30d&quot; &quot;60d&quot; &quot;90d&quot; &quot;365d&quot; Interval of time to return data points for. See details in endpoint description. (default to 1d)

  • :convert_id (String)

    One or more comma-separated cryptocurrency CoinMarketCap IDs. Example 1,2

  • :convert (String)

    By default market quotes are returned in USD. Optionally calculate market quotes in up to 3 other fiat currencies or cryptocurrencies.

Returns:



309
310
311
312
# File 'lib/coinmarketcap_client/api/default_api.rb', line 309

def global_metrics_quotes_historical_get(opts = {})
  data, _status_code, _headers = global_metrics_quotes_historical_get_with_http_info(opts)
  data
end

#global_metrics_quotes_historical_get_with_http_info(opts = {}) ⇒ Array<(InlineResponse2009, Fixnum, Hash)>

List all cryptocurrencies (latest) Get a paginated list of all cryptocurrencies with latest market data. You can configure this call to sort by market cap or another market ranking field. Use the &quot;convert&quot; option to return market values in multiple fiat and cryptocurrency conversions in the same call.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :time_start (String)

    Timestamp (Unix or ISO 8601) to start returning quotes for. Optional, if not passed, we&#39;ll return quotes calculated in reverse from &quot;time_end&quot;.

  • :time_end (String)

    Timestamp (Unix or ISO 8601) to stop returning quotes for (inclusive). Optional, if not passed, we&#39;ll default to the current time. If no &quot;time_start&quot; is passed, we return quotes in reverse order starting from this time.

  • :count (Integer)

    The number of interval periods to return results for. Optional, required if both &quot;time_start&quot; and &quot;time_end&quot; aren&#39;t supplied. The default is 10 items. The current query limit is 10000.

  • :interval (String)

    Valid values &quot;yearly&quot; &quot;monthly&quot; &quot;weekly&quot; &quot;daily&quot; &quot;hourly&quot; &quot;5m&quot; &quot;10m&quot; &quot;15m&quot; &quot;30m&quot; &quot;45m&quot; &quot;1h&quot; &quot;2h&quot; &quot;3h&quot; &quot;6h&quot; &quot;12h&quot; &quot;24h&quot; &quot;1d&quot; &quot;2d&quot; &quot;3d&quot; &quot;7d&quot; &quot;14d&quot; &quot;15d&quot; &quot;30d&quot; &quot;60d&quot; &quot;90d&quot; &quot;365d&quot; Interval of time to return data points for. See details in endpoint description.

  • :convert_id (String)

    One or more comma-separated cryptocurrency CoinMarketCap IDs. Example 1,2

  • :convert (String)

    By default market quotes are returned in USD. Optionally calculate market quotes in up to 3 other fiat currencies or cryptocurrencies.

Returns:

  • (Array<(InlineResponse2009, Fixnum, Hash)>)

    InlineResponse2009 data, response status code and response headers



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/coinmarketcap_client/api/default_api.rb', line 324

def global_metrics_quotes_historical_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.global_metrics_quotes_historical_get ...'
  end
  if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] > 10000
    fail ArgumentError, 'invalid value for "opts[:"count"]" when calling DefaultApi.global_metrics_quotes_historical_get, must be smaller than or equal to 10000.'
  end

  if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1
    fail ArgumentError, 'invalid value for "opts[:"count"]" when calling DefaultApi.global_metrics_quotes_historical_get, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/global-metrics/quotes/historical'

  # query parameters
  query_params = {}
  query_params[:'time_start'] = opts[:'time_start'] if !opts[:'time_start'].nil?
  query_params[:'time_end'] = opts[:'time_end'] if !opts[:'time_end'].nil?
  query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?
  query_params[:'interval'] = opts[:'interval'] if !opts[:'interval'].nil?
  query_params[:'convert_id'] = opts[:'convert_id'] if !opts[:'convert_id'].nil?
  query_params[:'convert'] = opts[:'convert'] if !opts[:'convert'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse2009')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#global_metrics_quotes_historical_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#global_metrics_quotes_latest_get(opts = {}) ⇒ InlineResponse2008

Get aggregate market metrics (latest) 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.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :convert_id (String)

    One or more comma-separated cryptocurrency CoinMarketCap IDs. Example 1,2

  • :convert (String)

    Optionally calculate market quotes in up to 120 currencies at once by passing a comma-separated list of cryptocurrency or fiat currency symbols. Each additional convert option beyond the first requires an additional call credit. A list of supported fiat options can be found here. Each conversion is returned in its own &quot;quote&quot; object.

Returns:



377
378
379
380
# File 'lib/coinmarketcap_client/api/default_api.rb', line 377

def global_metrics_quotes_latest_get(opts = {})
  data, _status_code, _headers = global_metrics_quotes_latest_get_with_http_info(opts)
  data
end

#global_metrics_quotes_latest_get_with_http_info(opts = {}) ⇒ Array<(InlineResponse2008, Fixnum, Hash)>

Get aggregate market metrics (latest) Get the latest quote of aggregate market metrics. Use the &quot;convert&quot; option to return market values in multiple fiat and cryptocurrency conversions in the same call.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :convert_id (String)

    One or more comma-separated cryptocurrency CoinMarketCap IDs. Example 1,2

  • :convert (String)

    Optionally calculate market quotes in up to 120 currencies at once by passing a comma-separated list of cryptocurrency or fiat currency symbols. Each additional convert option beyond the first requires an additional call credit. A list of supported fiat options can be found here. Each conversion is returned in its own &quot;quote&quot; object.

Returns:

  • (Array<(InlineResponse2008, Fixnum, Hash)>)

    InlineResponse2008 data, response status code and response headers



388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
# File 'lib/coinmarketcap_client/api/default_api.rb', line 388

def global_metrics_quotes_latest_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.global_metrics_quotes_latest_get ...'
  end
  # resource path
  local_var_path = '/global-metrics/quotes/latest'

  # query parameters
  query_params = {}
  query_params[:'convert_id'] = opts[:'convert_id'] if !opts[:'convert_id'].nil?
  query_params[:'convert'] = opts[:'convert'] if !opts[:'convert'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['ApiKeyAuth']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse2008')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#global_metrics_quotes_latest_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end