coingecko_ruby 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +27 -0
  4. data/README.md +5 -5
  5. data/fixtures/vcr_cassettes/test_that_it_gets_a_specific_exchange_ticker_from_an_exchange.yml +70 -0
  6. data/fixtures/vcr_cassettes/test_that_it_gets_btc_to_eth_exchange_rate.yml +49 -0
  7. data/fixtures/vcr_cassettes/test_that_it_gets_btc_to_usd_exchange_rate.yml +49 -0
  8. data/fixtures/vcr_cassettes/test_that_it_gets_daily_historical_prices_for_one_coin.yml +49 -0
  9. data/fixtures/vcr_cassettes/test_that_it_gets_historical_price_for_one_coin_at_a_previous_date.yml +49 -0
  10. data/fixtures/vcr_cassettes/test_that_it_gets_hourly_historical_prices_for_one_coin.yml +49 -0
  11. data/fixtures/vcr_cassettes/test_that_it_gets_indexes_by_market_id_and_coin_id.yml +66 -0
  12. data/fixtures/vcr_cassettes/test_that_it_gets_last_7_days_exchange_volume_from_an_exchange.yml +49 -0
  13. data/fixtures/vcr_cassettes/test_that_it_gets_market_data_for_a_coin.yml +98 -0
  14. data/fixtures/vcr_cassettes/test_that_it_gets_market_data_for_a_coin_in_myr.yml +49 -0
  15. data/fixtures/vcr_cassettes/test_that_it_gets_market_data_for_multiple_coins_in_eth.yml +49 -0
  16. data/fixtures/vcr_cassettes/test_that_it_gets_minutely_historical_prices_for_one_coin.yml +49 -0
  17. data/fixtures/vcr_cassettes/test_that_it_gets_ohlc_data_for_one_coin_in_the_last_30_days_in_myr.yml +47 -0
  18. data/fixtures/vcr_cassettes/test_that_it_gets_ohlc_data_for_one_coin_in_the_last_7_days.yml +47 -0
  19. data/fixtures/vcr_cassettes/test_that_it_gets_price_for_one_coin.yml +49 -0
  20. data/fixtures/vcr_cassettes/test_that_it_gets_price_for_one_coin_in_a_different_currency.yml +49 -0
  21. data/lib/coingecko_ruby/client.rb +6 -0
  22. data/lib/coingecko_ruby/client/categories.rb +21 -6
  23. data/lib/coingecko_ruby/client/coins.rb +28 -15
  24. data/lib/coingecko_ruby/client/derivatives.rb +30 -9
  25. data/lib/coingecko_ruby/client/events.rb +21 -6
  26. data/lib/coingecko_ruby/client/exchanges.rb +45 -13
  27. data/lib/coingecko_ruby/client/finance.rb +14 -4
  28. data/lib/coingecko_ruby/client/indexes.rb +22 -7
  29. data/lib/coingecko_ruby/client/infos.rb +27 -8
  30. data/lib/coingecko_ruby/client/prices.rb +74 -30
  31. data/lib/coingecko_ruby/connection.rb +5 -9
  32. data/lib/coingecko_ruby/version.rb +1 -1
  33. metadata +3 -2
@@ -68,4 +68,53 @@ http_interactions:
68
68
  encoding: ASCII-8BIT
69
69
  string: '{"bitcoin":{"myr":203620}}'
70
70
  recorded_at: Sat, 15 May 2021 14:10:15 GMT
71
+ - request:
72
+ method: get
73
+ uri: https://api.coingecko.com/api/v3/simple/price
74
+ body:
75
+ encoding: US-ASCII
76
+ string: ''
77
+ headers:
78
+ Accept-Encoding:
79
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
80
+ Accept:
81
+ - "*/*"
82
+ User-Agent:
83
+ - Ruby
84
+ response:
85
+ status:
86
+ code: 422
87
+ message: Unprocessable Entity
88
+ headers:
89
+ Date:
90
+ - Mon, 19 Jul 2021 03:15:55 GMT
91
+ Content-Type:
92
+ - application/json; charset=utf-8
93
+ Transfer-Encoding:
94
+ - chunked
95
+ Connection:
96
+ - keep-alive
97
+ Vary:
98
+ - Accept-Encoding, Origin
99
+ Cache-Control:
100
+ - no-cache
101
+ X-Request-Id:
102
+ - 623b2a81-35ef-4085-a08c-73554740918d
103
+ X-Runtime:
104
+ - '0.002243'
105
+ Cf-Cache-Status:
106
+ - MISS
107
+ Expect-Ct:
108
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
109
+ Server:
110
+ - cloudflare
111
+ Cf-Ray:
112
+ - 6710c9bdf91d3d0c-HKG
113
+ Alt-Svc:
114
+ - h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400, h3=":443";
115
+ ma=86400
116
+ body:
117
+ encoding: ASCII-8BIT
118
+ string: '{"error":"Missing parameter ids"}'
119
+ recorded_at: Mon, 19 Jul 2021 03:15:55 GMT
71
120
  recorded_with: VCR 6.0.0
@@ -23,5 +23,11 @@ module CoingeckoRuby
23
23
  include CoingeckoRuby::Client::Derivatives
24
24
  include CoingeckoRuby::Client::Events
25
25
  include CoingeckoRuby::Client::Infos
26
+
27
+ attr_reader :client
28
+
29
+ def initialize
30
+ @client = self
31
+ end
26
32
  end
27
33
  end
@@ -6,7 +6,7 @@ module CoingeckoRuby
6
6
  # @return [Array<Hash>] each category's id and name
7
7
  #
8
8
  # @example Get all coin categories.
9
- # client.get_categories
9
+ # client.categories
10
10
  # @example Sample response object
11
11
  # [{
12
12
  # "category_id" => "recently_added",
@@ -15,16 +15,21 @@ module CoingeckoRuby
15
15
  # "category_id" => "aave-tokens",
16
16
  # "name" => "Aave Tokens"
17
17
  # }]
18
- def get_categories
18
+ def categories
19
19
  get 'coins/categories/list'
20
20
  end
21
21
 
22
+ # @deprecated Use {#categories} instead
23
+ def get_categories
24
+ categories
25
+ end
26
+
22
27
  # Fetches the list of coin categories with its respective market data.
23
28
  #
24
29
  # @return [Array<Hash>] each category's id, name, and market data
25
30
  #
26
31
  # @example Get all coin categories with market data.
27
- # client.get_categories_with_market_data
32
+ # client.categories_with_market_data
28
33
  # @example Sample response object
29
34
  # [
30
35
  # {
@@ -44,16 +49,21 @@ module CoingeckoRuby
44
49
  # "updated_at" => "2021-05-16T08:20:20.877Z"
45
50
  # }
46
51
  # ]
47
- def get_categories_with_market_data
52
+ def categories_with_market_data
48
53
  get 'coins/categories'
49
54
  end
50
55
 
56
+ # @deprecated Use {#categories_with_market_data} instead
57
+ def get_categories_with_market_data
58
+ categories_with_market_data
59
+ end
60
+
51
61
  # Fetches the list of asset platforms (e.g. Ethereum, OpenLedger, Counterpart) listed in CoinGecko.
52
62
  #
53
63
  # @return [Array<Hash>] each asset platform's id, name, short name, and chain identifier
54
64
  #
55
65
  # @example Get all asset platforms.
56
- # client.get_asset_platforms
66
+ # client.asset_platforms
57
67
  # @example Sample response object
58
68
  # [
59
69
  # {"id"=>"factom", "chain_identifier"=>nil, "name"=>"Factom", "shortname"=>""},
@@ -62,9 +72,14 @@ module CoingeckoRuby
62
72
  # "name"=>"OpenLedger",
63
73
  # "shortname"=>""}
64
74
  # ]
65
- def get_asset_platforms
75
+ def asset_platforms
66
76
  get 'asset_platforms'
67
77
  end
78
+
79
+ # @deprecated Use {#asset_platforms} instead
80
+ def get_asset_platforms
81
+ asset_platforms
82
+ end
68
83
  end
69
84
  end
70
85
  end
@@ -3,7 +3,7 @@ module CoingeckoRuby
3
3
  module Coins
4
4
  # Fetches the id, name, and symbol of every coin supported by CoinGecko's API.
5
5
  #
6
- # @param include_contract_address [Boolean] displays the coin's platform contract address (e.g. 0x... for ETH-based tokens)
6
+ # @option options include_platform [Boolean] displays the coin's platform contract address (e.g. 0x... for ETH-based tokens)
7
7
  #
8
8
  # @return [Array<Hash>] returns an array of hashes for every supported coin's id, name, symbol, and platform contract address (optional).
9
9
  #
@@ -21,8 +21,8 @@ module CoingeckoRuby
21
21
  # "name" => "0.5X Long Algorand Token"
22
22
  # }, {
23
23
  # ]
24
- def coins_list(include_contract_address: false)
25
- get 'coins/list', { include_contract_address: include_contract_address }
24
+ def coins_list(**options)
25
+ get 'coins/list', options
26
26
  end
27
27
 
28
28
  # Fetches detailed current data for a coin.
@@ -36,16 +36,21 @@ module CoingeckoRuby
36
36
  # @return [Hash] returns comprehensive current data for the given coin.
37
37
  #
38
38
  # @example Fetch Bitcoin's current data.
39
- # client.get_coin_data(id: 'bitcoin')
39
+ # client.coin('bitcoin')
40
+ def coin(id, **options)
41
+ get "coins/#{id}", options
42
+ end
43
+
44
+ # @deprecated Use {#coin} instead
40
45
  def get_coin_data(id:, options: {})
41
- get "coins/#{id}", { options: options }
46
+ coin(id, **options)
42
47
  end
43
48
 
44
49
  # Fetches the list of tickers (e.g: BTC-USD) for a coin
45
50
  #
46
51
  # @param id [String] the coin id to fetch.
47
- # @option options [String] :exchange_id fetch tickers from the given exchange id (e.g. 'binance').
48
- # @option options [String] :include_exchange_logo includes the exchange's logo.
52
+ # @option options [String] :exchange_ids filter ticker results from the given exchange ids (e.g. 'binance, bitfinex').
53
+ # @option options [Boolean] :include_exchange_logo flag to show the exchange's logo.
49
54
  # @option options [Integer] :page sets the page for results.
50
55
  # @option options [String] :order ('trust_score_desc') sets the sort order for results. Valid values: trust_score_desc', 'trust_score_asc', 'volume_desc.
51
56
  # @option options [Boolean] :depth (false) displays orderbook depth (2%).
@@ -53,7 +58,7 @@ module CoingeckoRuby
53
58
  # @return [Hash] returns the list of tickers for the given coin.
54
59
  #
55
60
  # @example Fetch Bitcoin's tickers.
56
- # client.get_tickers(id: 'bitcoin)
61
+ # client.tickers('bitcoin')
57
62
  # @example Sample response object (truncated)
58
63
  # {
59
64
  # "name" => "Bitcoin",
@@ -87,7 +92,7 @@ module CoingeckoRuby
87
92
  # }],
88
93
  # }
89
94
  # @example Fetch Bitcoin's tickers from Binance with 2% orderbook depth data.
90
- # client.get_tickers(id: 'bitcoin', options: { exchange_id: 'binance', depth: true })
95
+ # client.tickers('bitcoin', exchange_id: 'binance', depth: true)
91
96
  # @example Sample response object (truncated)
92
97
  # {
93
98
  # "name" => "Bitcoin",
@@ -122,14 +127,19 @@ module CoingeckoRuby
122
127
  # "target_coin_id" => "tether"
123
128
  # }],
124
129
  # }
130
+ def tickers(id, **options)
131
+ get "coins/#{id}/tickers", options
132
+ end
133
+
134
+ # @deprecated Use {#tickers} instead
125
135
  def get_tickers(id:, options: {})
126
- get "coins/#{id}/tickers", { options: options }
136
+ tickers(id, **options)
127
137
  end
128
138
 
129
139
  # Fetches market data for a coin or a list of coins.
130
140
  #
131
141
  # @param ids [String] the coin id or ids to fetch.
132
- # @param currency [String] the currency to display market price data.
142
+ # @option options [String] :vs_currency the currency to display market price data.
133
143
  # @option options [String] :category filter results by the given coin category.
134
144
  # @option options [String] :order ('market_cap_desc') sets the sort order for results. Valid values: market_cap_desc, gecko_desc, gecko_asc, market_cap_asc, market_cap_desc, volume_asc, volume_desc, id_asc, id_desc.
135
145
  # @option options [Integer] :per_page (100) sets the number of results to return per page.
@@ -140,7 +150,7 @@ module CoingeckoRuby
140
150
  # @return [Array<Hash>] returns market data for the given coin or coins.
141
151
  #
142
152
  # @example Fetch market data for Bitcoin and Ethereum in USD.
143
- # client.get_markets(ids: 'bitcoin, ethereum', currency: 'gbp')
153
+ # client.markets('bitcoin, ethereum', vs_currency: 'gbp')
144
154
  # @example Sample response object
145
155
  # [{
146
156
  # "id" => "bitcoin",
@@ -205,10 +215,13 @@ module CoingeckoRuby
205
215
  # "last_updated" => "2021-05-16T07:06:00.946Z"
206
216
  # }
207
217
  # ]
208
- # @example Fetch market data for every CoinGecko-supported coin in USD.
209
- # client.get_markets(currency: 'usd')
218
+ def markets(ids, **options)
219
+ get 'coins/markets', { ids: ids, **options }
220
+ end
221
+
222
+ # @deprecated Use {#markets} instead
210
223
  def get_markets(ids:, currency: 'usd', options: {})
211
- get 'coins/markets', { ids: ids, vs_currency: currency, options: options }
224
+ markets(ids, vs_currency: currency, **options)
212
225
  end
213
226
  end
214
227
  end
@@ -8,7 +8,7 @@ module CoingeckoRuby
8
8
  # @return [Array<Hash>] each derivative product's information.
9
9
  #
10
10
  # @example Get all unexpired derivatives.
11
- # client.get_derivatives(options: { include_tickers: 'unexpired' })
11
+ # client.derivatives(include_tickers: 'unexpired')
12
12
  # @example Sample response object (truncated)
13
13
  # [
14
14
  # {
@@ -44,8 +44,13 @@ module CoingeckoRuby
44
44
  # "expired_at" => nil
45
45
  # },
46
46
  # ]
47
+ def derivatives(**options)
48
+ get 'derivatives', options
49
+ end
50
+
51
+ # @deprecated Use {#derivatives} instead
47
52
  def get_derivatives(options: {})
48
- get 'derivatives', { options: options }
53
+ derivatives(**options)
49
54
  end
50
55
 
51
56
  # Fetches the list of derivative exchanges listed in CoinGecko.
@@ -57,7 +62,7 @@ module CoingeckoRuby
57
62
  # @return [Array<Hash>] each derivative exchange's information.
58
63
  #
59
64
  # @example Get one derivative exchange.
60
- # client.get_derivative_exchanges(options: { per_page: 1 })
65
+ # client.derivative_exchanges(per_page: 1)
61
66
  # @example Sample response object
62
67
  # [{
63
68
  # "name" => "Binance (Futures)",
@@ -73,19 +78,25 @@ module CoingeckoRuby
73
78
  # "description" => "",
74
79
  # "url" => "https://www.binance.com/"
75
80
  # }]
81
+ def derivative_exchanges(**options)
82
+ get 'derivatives/exchanges', options
83
+ end
84
+
85
+ # @deprecated Use {#derivative_exchanges} instead
76
86
  def get_derivative_exchanges(options: {})
77
- get 'derivatives/exchanges', { options: options }
87
+ derivative_exchanges(**options)
78
88
  end
79
89
 
80
90
  # Fetches data for a specific derivative exchange.
81
91
  #
82
- # @option options [String] :id the id of the derivative exchange.
92
+ # @param id [String] the id of the derivative exchange.
93
+ #
83
94
  # @option options [String] :include_tickers determines whether to display all tickers or only show unexpired tickers. Does not return any ticker data if left blank. Valid values: all, unexpired
84
95
  #
85
96
  # @return [Hash] the derivative exchange's information.
86
97
  #
87
98
  # @example Get data for the Binance Futures derivative exchange.
88
- # client.get_derivative_exchange(id: 'binance_futures')
99
+ # client.derivative_exchange('binance_futures')
89
100
  # @example Sample response object
90
101
  # {
91
102
  # "name" => "Binance (Futures)",
@@ -100,8 +111,13 @@ module CoingeckoRuby
100
111
  # "description" => "",
101
112
  # "url" => "https://www.binance.com/"
102
113
  # }
114
+ def derivative_exchange(id, **options)
115
+ get "derivatives/exchanges/#{id}", options
116
+ end
117
+
118
+ # @deprecated Use {#derivative_exchange} instead
103
119
  def get_derivative_exchange(id:, options: {})
104
- get "derivatives/exchanges/#{id}", { options: options }
120
+ derivative_exchange(id, **options)
105
121
  end
106
122
 
107
123
  # Fetches the list ids and names of derivative exchanges listed in CoinGecko.
@@ -109,7 +125,7 @@ module CoingeckoRuby
109
125
  # @return [Array<Hash>] each derivative exchange's id and name.
110
126
  #
111
127
  # @example Get all unexpired derivatives.
112
- # client.get_derivative_exchanges_ids_and_names
128
+ # client.derivative_exchanges_ids_and_names
113
129
  # @example Sample response object (truncated)
114
130
  # [
115
131
  # {
@@ -125,9 +141,14 @@ module CoingeckoRuby
125
141
  # "name" => "FTX (Derivatives)"
126
142
  # }
127
143
  # ]
128
- def get_derivative_exchanges_ids_and_names
144
+ def derivative_exchanges_ids_and_names
129
145
  get 'derivatives/exchanges/list'
130
146
  end
147
+
148
+ # @deprecated Use {#derivative_exchanges_ids_and_names} instead
149
+ def get_derivative_exchanges_ids_and_names
150
+ derivative_exchanges_ids_and_names
151
+ end
131
152
  end
132
153
  end
133
154
  end
@@ -14,9 +14,14 @@ module CoingeckoRuby
14
14
  # @return [Array<Hash>] each finance platform's name, category, url, facts (description), and centralized status.
15
15
  #
16
16
  # @example Get all upcoming events.
17
- # client.get_events(options: { upcoming_events_only: true })
17
+ # client.events(upcoming_events_only: true)
18
+ def events(**options)
19
+ get 'events', options
20
+ end
21
+
22
+ # @deprecated Use {#events} instead
18
23
  def get_events(options: {})
19
- get 'events', { options: options }
24
+ events(**options)
20
25
  end
21
26
 
22
27
  # Fetches the valid list of countries to fetch events from.
@@ -24,7 +29,7 @@ module CoingeckoRuby
24
29
  # @return [Hash] each country's name and code and the total country count.
25
30
  #
26
31
  # @example Get all event countries.
27
- # client.get_event_countries
32
+ # client.event_countries
28
33
  # @example Sample response object (truncated)
29
34
  # {
30
35
  # "data" => [{
@@ -46,24 +51,34 @@ module CoingeckoRuby
46
51
  # ],
47
52
  # "count" => 4
48
53
  # }
49
- def get_event_countries
54
+ def event_countries
50
55
  get 'events/countries'
51
56
  end
52
57
 
58
+ # @deprecated Use {#event_countries} instead
59
+ def get_event_countries
60
+ event_countries
61
+ end
62
+
53
63
  # Fetches the valid list of events to fetch.
54
64
  #
55
65
  # @return [Array<Hash>] the list of event types and total event types count.
56
66
  #
57
67
  # @example Get all event types.
58
- # client.get_event_types
68
+ # client.event_types
59
69
  # @example Sample response object
60
70
  # {
61
71
  # "data" => ["Event", "Conference", "Meetup"],
62
72
  # "count" => 3
63
73
  # }
64
- def get_event_types
74
+ def event_types
65
75
  get 'events/types'
66
76
  end
77
+
78
+ # @deprecated Use {#event_types} instead
79
+ def get_event_types
80
+ event_types
81
+ end
67
82
  end
68
83
  end
69
84
  end
@@ -9,7 +9,7 @@ module CoingeckoRuby
9
9
  # @return [Array<Hash>] returns an array of hashes of detailed exchange data.
10
10
  #
11
11
  # @example Fetch complete exchange data with 1 result per page.
12
- # client.get_exchanges(options: { per_page: 1 })
12
+ # client.exchanges(per_page: 1)
13
13
  # @example Sample response object
14
14
  # [{
15
15
  # "id" => "binance",
@@ -25,8 +25,13 @@ module CoingeckoRuby
25
25
  # "trade_volume_24h_btc" => 982949.3975723931,
26
26
  # "trade_volume_24h_btc_normalized" => 982949.3975723931
27
27
  # }]
28
+ def exchanges(**options)
29
+ get 'exchanges', options
30
+ end
31
+
32
+ # @deprecated Use {#exchanges} instead
28
33
  def get_exchanges(options: {})
29
- get 'exchanges', { options: options }
34
+ exchanges(**options)
30
35
  end
31
36
 
32
37
  # Fetches complete data for a specific exchange.
@@ -36,17 +41,22 @@ module CoingeckoRuby
36
41
  # @return [Hash] returns detailed data for the given exchange.
37
42
  #
38
43
  # @example Fetch complete exchange data for Binance.
39
- # client.get_exchange_data(id: 'binance')
40
- def get_exchange_data(id:)
44
+ # client.exchange('binance')
45
+ def exchange(id)
41
46
  get "exchanges/#{id}"
42
47
  end
43
48
 
49
+ # @deprecated Use {#exchange} instead
50
+ def get_exchange_data(id:)
51
+ exchange(id)
52
+ end
53
+
44
54
  # Fetches exchange ids for every exchange currently supported by the CoinGecko API.
45
55
  #
46
56
  # @return [Array<Hash>] returns an array of hashes of the exchange id and name.
47
57
  #
48
58
  # @example Fetch all exchange ids.
49
- # client.get_exchanges_ids
59
+ # client.exchange_ids
50
60
  # @example Sample response object
51
61
  # [{
52
62
  # "id" => "aave",
@@ -58,13 +68,19 @@ module CoingeckoRuby
58
68
  # "id" => "aax_futures",
59
69
  # "name" => "AAX Futures"
60
70
  # }]
61
- def get_exchanges_ids
71
+ def exchange_ids
62
72
  get 'exchanges/list'
63
73
  end
64
74
 
75
+ # @deprecated Use {#exchange_ids} instead
76
+ def get_exchanges_ids
77
+ exchange_ids
78
+ end
79
+
65
80
  # Fetches coin tickers from a specific exchange.
66
81
  #
67
82
  # @param id [String] the exchange id to fetch.
83
+ #
68
84
  # @option options [String] :coin_ids comma-separated list of tickers to fetch from the given exchange id (e.g. 'bitcoin, eth, litecoin').
69
85
  # @option options [String] :include_exchange_logo includes the exchange's logo.
70
86
  # @option options [Integer] :page sets the page for results.
@@ -74,7 +90,7 @@ module CoingeckoRuby
74
90
  # @return [Hash] the exchange name and tickers as provided or all tickers if coin_ids is not provided.
75
91
  #
76
92
  # @example Get Bitcoin tickers from Binance.
77
- # client.get_exchange_tickers(id: 'binance', options: { coin_ids: 'bitcoin' })
93
+ # client.exchange_tickers('binance', coin_ids: 'bitcoin')
78
94
  # @example Sample response object
79
95
  # {
80
96
  # "name" => "Binance", "tickers" => [{
@@ -104,20 +120,26 @@ module CoingeckoRuby
104
120
  # "target_coin_id" => "tether"
105
121
  # }]
106
122
  # }
123
+ def exchange_tickers(id, **options)
124
+ get "exchanges/#{id}/tickers", options
125
+ end
126
+
127
+ # @deprecated Use {#exchange_tickers} instead
107
128
  def get_exchange_tickers(id:, options: {})
108
- get "exchanges/#{id}/tickers", { options: options }
129
+ exchange_tickers(id, **options)
109
130
  end
110
131
 
111
132
  # Fetches news,announcments, and updates from a specific exchange.
112
133
  #
113
134
  # @param id [String] the exchange id to fetch.
135
+ #
114
136
  # @option options [Integer] :per_page (100) sets the number of results to return per page.
115
137
  # @option options [Integer] :page sets the page for results.
116
138
  #
117
139
  # @return [Hash] the status update data for the given exchange.
118
140
  #
119
141
  # @example Get the last 3 status updates from Binance.
120
- # client.get_exchange_status_updates(id: 'binance', options: { per_page: 1 })
142
+ # client.exchange_status('binance', per_page: 1)
121
143
  # @example Sample response object
122
144
  # {
123
145
  # "status_updates" => [{
@@ -134,27 +156,37 @@ module CoingeckoRuby
134
156
  # }
135
157
  # }]
136
158
  # }
159
+ def exchange_status(id, **options)
160
+ get "exchanges/#{id}/status_updates", options
161
+ end
162
+
163
+ # @deprecated Use {#exchange_status} instead
137
164
  def get_exchange_status_updates(id:, options: {})
138
- get "exchanges/#{id}/status_updates", { options: options }
165
+ exchange_status(id, **options)
139
166
  end
140
167
 
141
168
  # Fetches trade volume data from a specific exchange.
142
169
  #
143
170
  # @param id [String] the exchange id to fetch.
144
- # @param days [Integer] number of days ago to fetch trade volume data.
171
+ # @param days [Integer] number of days ago to fetch trade volume data. Defaults to 7 days.
145
172
  #
146
173
  # @return [Array<Array<Float, String>>] the exchange's trade volume data in 10-minute intervals, hourly intervals, or daily intervals depending on the number of days given
147
174
  #
148
175
  # @example Get Binance's trade volume from a day ago.
149
- # client.get_exchange_volume(id: 'binance', days: 1)
176
+ # client.exchange_volume('binance', days: 1)
150
177
  # @example Sample response object (truncated)
151
178
  # [
152
179
  # [1620550200000.0, "1005476.2667217359131632087795432176371669876601688256288859094077173967202827700534809705802"], # [UNIX timestamp for exchange trade volume data, trade volume]
153
180
  # [1620553800000.0, "1018442.2775982988468591292487708941265043962519659923872972786095536137127193126138169804088"],
154
181
  # [1620557400000.0, "1042158.4333253484568599192332614201045319574863305612009609211497295171074087677404153278624"]
155
182
  # ]
183
+ def exchange_volume(id, days: 7, **options)
184
+ get "exchanges/#{id}/volume_chart", { days: days, **options }
185
+ end
186
+
187
+ # @deprecated Use {#exchange_volume} instead
156
188
  def get_exchange_volume(id:, days:)
157
- get "exchanges/#{id}/volume_chart", { days: days }
189
+ exchange_volume(id, days: days)
158
190
  end
159
191
  end
160
192
  end