coingecko_ruby 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +31 -0
- data/.gitignore +10 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.md +17 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +37 -0
- data/README.md +4 -2
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/coingecko_ruby.gemspec +5 -5
- data/fixtures/vcr_cassettes/test_that_it_gets_a_coins_complete_current_data.yml +74 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_a_coins_tickers.yml +99 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_a_derivative_exchange.yml +71 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_a_specific_exchange_ticker_from_an_exchange.yml +75 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_btc_to_eth_exchange_rate.yml +71 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_btc_to_usd_exchange_rate.yml +73 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_complete_data_for_an_exchange.yml +72 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_daily_historical_prices_for_one_coin.yml +71 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_derivative_exchanges.yml +79 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_derivatives.yml +1732 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_derivatives_exchanges_ids_and_names.yml +95 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_event_countries.yml +76 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_event_types.yml +71 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_exchange_ids_supported_by_coingecko.yml +159 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_exchange_tickers_from_an_exchange.yml +78 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_finance_platforms.yml +95 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_finance_products.yml +100 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_global_crypto_data.yml +71 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_global_defi_data.yml +71 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_historical_price_for_one_coin_at_a_previous_date.yml +124 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_hourly_historical_prices_for_one_coin.yml +71 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_indexes.yml +127 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_indexes_by_market_id_and_index_id.yml +71 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_indexes_ids.yml +630 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_last_7_days_exchange_volume_from_an_exchange.yml +71 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_market_data_for_a_coin.yml +71 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_market_data_for_a_coin_in_myr.yml +71 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_market_data_for_multiple_coins_in_eth.yml +71 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_minutely_historical_prices_for_one_coin.yml +139 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_ohlc_data_for_one_coin_in_the_last_30_days_in_myr.yml +73 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_ohlc_data_for_one_coin_in_the_last_7_days.yml +73 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_price_for_multiple_coins.yml +71 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_price_for_multiple_coins_in_different_currencies.yml +71 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_price_for_one_coin.yml +73 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_price_for_one_coin_in_a_different_currency.yml +71 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_simple_price_for_one_coin.yml +73 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_status_updates.yml +79 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_status_updates_for_an_exchange.yml +76 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_the_list_of_asset_platforms.yml +80 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_the_list_of_categories.yml +114 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_the_list_of_categories_with_market_data.yml +100 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_the_list_of_supported_coins.yml +143 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_the_list_of_supported_exchanges.yml +79 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_the_list_supported_coins.yml +74 -0
- data/fixtures/vcr_cassettes/test_that_it_gets_trending_searches.yml +77 -0
- data/lib/coingecko_ruby/client.rb +10 -0
- data/lib/coingecko_ruby/client/categories.rb +25 -361
- data/lib/coingecko_ruby/client/coins.rb +4 -16
- data/lib/coingecko_ruby/client/derivatives.rb +133 -0
- data/lib/coingecko_ruby/client/events.rb +69 -0
- data/lib/coingecko_ruby/client/exchanges.rb +9 -1448
- data/lib/coingecko_ruby/client/finance.rb +90 -0
- data/lib/coingecko_ruby/client/indexes.rb +73 -0
- data/lib/coingecko_ruby/client/infos.rb +155 -0
- data/lib/coingecko_ruby/client/prices.rb +12 -240
- data/lib/coingecko_ruby/client/status.rb +1 -1
- data/lib/coingecko_ruby/version.rb +1 -1
- metadata +59 -2
@@ -0,0 +1,90 @@
|
|
1
|
+
module CoingeckoRuby
|
2
|
+
class Client
|
3
|
+
module Finance
|
4
|
+
# Fetches the list of finance platforms (e.g. Celsius Network, dYdX) listed in CoinGecko.
|
5
|
+
#
|
6
|
+
# @option options [Integer] :per_page (100) sets the number of results to return per page.
|
7
|
+
# @option options [Integer] :page sets the page for results.
|
8
|
+
#
|
9
|
+
# @return [Array<Hash>] each finance platform's name, category, url, facts (description), and centralized status.
|
10
|
+
#
|
11
|
+
# @example Get all finance platforms.
|
12
|
+
# client.get_finance_platforms
|
13
|
+
# @example Sample response object (truncated)
|
14
|
+
# [
|
15
|
+
# {
|
16
|
+
# "name"=>"Binance Staking",
|
17
|
+
# "facts"=>"",
|
18
|
+
# "category"=>"CeFi Platform",
|
19
|
+
# "centralized"=>true,
|
20
|
+
# "website_url"=>"https://www.binance.com/en/staking"
|
21
|
+
# },
|
22
|
+
# {
|
23
|
+
# "name"=>"Celsius Network",
|
24
|
+
# "facts"=>"",
|
25
|
+
# "category"=>"CeFi Platform",
|
26
|
+
# "centralized"=>true,
|
27
|
+
# "website_url"=>"https://celsius.network/"
|
28
|
+
# },
|
29
|
+
# {
|
30
|
+
# "name"=>"Cobo",
|
31
|
+
# "facts"=>"",
|
32
|
+
# "category"=>"CeFi Platform",
|
33
|
+
# "centralized"=>true,
|
34
|
+
# "website_url"=>"https://cobo.com/"
|
35
|
+
# }
|
36
|
+
# ]
|
37
|
+
def get_finance_platforms(options: {})
|
38
|
+
get 'finance_platforms', { options: options }
|
39
|
+
end
|
40
|
+
|
41
|
+
# Fetches the list of finance products (e.g. Binance Savings, Nexo, Fulcrum) listed in CoinGecko.
|
42
|
+
#
|
43
|
+
# @option options [Integer] :per_page (100) sets the number of results to return per page.
|
44
|
+
# @option options [Integer] :page sets the page for results.
|
45
|
+
# @option options [Integer] :start_at filter results based on the launch date of the product in UNIX timestamp format.
|
46
|
+
# @option options [Integer] :end_at filter results based on the end date of the product in UNIX timestamp format.
|
47
|
+
#
|
48
|
+
# @return [Array<Hash>] each finance product's platform, identifier, supply and borrow rate percentage, and the product duration data.
|
49
|
+
#
|
50
|
+
# @example Get all finance products.
|
51
|
+
# client.get_finance_products
|
52
|
+
# @example Sample response object (truncated)
|
53
|
+
# [
|
54
|
+
# {"platform"=>"Binance Savings",
|
55
|
+
# "identifier"=>"XTZ001",
|
56
|
+
# "supply_rate_percentage"=>"1.956035",
|
57
|
+
# "borrow_rate_percentage"=>nil,
|
58
|
+
# "number_duration"=>nil,
|
59
|
+
# "length_duration"=>nil,
|
60
|
+
# "start_at"=>0,
|
61
|
+
# "end_at"=>0,
|
62
|
+
# "value_at"=>0,
|
63
|
+
# "redeem_at"=>0},
|
64
|
+
# {"platform"=>"Binance Savings",
|
65
|
+
# "identifier"=>"ZEC001",
|
66
|
+
# "supply_rate_percentage"=>"0.182865",
|
67
|
+
# "borrow_rate_percentage"=>nil,
|
68
|
+
# "number_duration"=>nil,
|
69
|
+
# "length_duration"=>nil,
|
70
|
+
# "start_at"=>0,
|
71
|
+
# "end_at"=>0,
|
72
|
+
# "value_at"=>0,
|
73
|
+
# "redeem_at"=>0},
|
74
|
+
# {"platform"=>"Crypto.com",
|
75
|
+
# "identifier"=>"BAT",
|
76
|
+
# "supply_rate_percentage"=>"2.0",
|
77
|
+
# "borrow_rate_percentage"=>nil,
|
78
|
+
# "number_duration"=>nil,
|
79
|
+
# "length_duration"=>nil,
|
80
|
+
# "start_at"=>0,
|
81
|
+
# "end_at"=>0,
|
82
|
+
# "value_at"=>0,
|
83
|
+
# "redeem_at"=>0}
|
84
|
+
# ]
|
85
|
+
def get_finance_products(options: {})
|
86
|
+
get 'finance_products', { options: options }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module CoingeckoRuby
|
2
|
+
class Client
|
3
|
+
module Indexes
|
4
|
+
# Fetches the list of market indexes listed in CoinGecko.
|
5
|
+
#
|
6
|
+
# @option options [Integer] :per_page (100) sets the number of results to return per page.
|
7
|
+
# @option options [Integer] :page sets the page for results.
|
8
|
+
#
|
9
|
+
# @return [Array<Hash>] each index's id, name, market name, last done, and whether it's a multiasset composite index.
|
10
|
+
#
|
11
|
+
# @example Get all market indexes.
|
12
|
+
# client.get_indexes
|
13
|
+
# @example Sample response object
|
14
|
+
# [
|
15
|
+
# {"name"=>"CoinFLEX (Futures) DFN",
|
16
|
+
# "id"=>"DFN",
|
17
|
+
# "market"=>"CoinFLEX (Futures)",
|
18
|
+
# "last"=>nil,
|
19
|
+
# "is_multi_asset_composite"=>nil},
|
20
|
+
# {"name"=>"Bibox (Futures) LINK",
|
21
|
+
# "id"=>"LINK",
|
22
|
+
# "market"=>"Bibox (Futures)",
|
23
|
+
# "last"=>nil,
|
24
|
+
# "is_multi_asset_composite"=>nil},
|
25
|
+
# {"name"=>"CME Bitcoin Futures BTC",
|
26
|
+
# "id"=>"BTC",
|
27
|
+
# "market"=>"CME Bitcoin Futures",
|
28
|
+
# "last"=>nil,
|
29
|
+
# "is_multi_asset_composite"=>false}
|
30
|
+
# ]
|
31
|
+
def get_indexes(options: {})
|
32
|
+
get 'indexes', { options: options }
|
33
|
+
end
|
34
|
+
|
35
|
+
# Fetches the ids of market indexes listed in CoinGecko.
|
36
|
+
#
|
37
|
+
# @return [Array<Hash>] each index's id and name.
|
38
|
+
#
|
39
|
+
# @example Get all market index ids and names.
|
40
|
+
# client.get_indexes_ids
|
41
|
+
# @example Sample response object
|
42
|
+
# [
|
43
|
+
# {"id"=>"LINK", "name"=>"Bibox (Futures) LINK"},
|
44
|
+
# {"id"=>"BTC", "name"=>"CME Bitcoin Futures BTC"},
|
45
|
+
# {"id"=>"XRP", "name"=>"Bibox (Futures) XRP"},
|
46
|
+
# {"id"=>"ETH", "name"=>"Crypto.com (Futures) ETH"}
|
47
|
+
# ]
|
48
|
+
def get_indexes_ids
|
49
|
+
get 'indexes/list'
|
50
|
+
end
|
51
|
+
|
52
|
+
# Fetches the list of indexes based on the market and index given.
|
53
|
+
#
|
54
|
+
# @param market_id [String] filter results by the market id.
|
55
|
+
# @param index_id [String] filter indexes from the given market by the index id.
|
56
|
+
#
|
57
|
+
# @return [Array<Hash>] the index's name, market, last done, and whether it's a multiasset composite index.
|
58
|
+
#
|
59
|
+
# @example Get all BTC indexes in the CME Futures market.
|
60
|
+
# client.get_indexes_by_market_and_index(market_id: 'cme_futures', index_id: 'btc')
|
61
|
+
# @example Sample response object
|
62
|
+
# {
|
63
|
+
# "name"=>"CME Bitcoin Futures BTC",
|
64
|
+
# "market"=>"CME Bitcoin Futures",
|
65
|
+
# "last"=>nil,
|
66
|
+
# "is_multi_asset_composite"=>false
|
67
|
+
# }
|
68
|
+
def get_indexes_by_market_and_index(market_id:, index_id:, options: {})
|
69
|
+
get "indexes/#{market_id}/#{index_id}", { options: options }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
module CoingeckoRuby
|
2
|
+
class Client
|
3
|
+
module Infos
|
4
|
+
# Fetches global crypto data from CoinGecko.
|
5
|
+
#
|
6
|
+
# @return [Hash] global crypto data (e.g. market cap, total volume, active ICOs, etc.)
|
7
|
+
#
|
8
|
+
# @example Get global crypto data.
|
9
|
+
# client.get_global_crypto_data
|
10
|
+
# @example Sample response object (truncated)
|
11
|
+
# {
|
12
|
+
# "data" => {
|
13
|
+
# "active_cryptocurrencies" => 7361,
|
14
|
+
# "upcoming_icos" => 0,
|
15
|
+
# "ongoing_icos" => 50,
|
16
|
+
# "ended_icos" => 3375,
|
17
|
+
# "markets" => 616,
|
18
|
+
# "total_market_cap" => {
|
19
|
+
# "btc" => 48541739.601360835,
|
20
|
+
# "eth" => 628896708.615425,
|
21
|
+
# "ltc" => 7052042789.61238,
|
22
|
+
# "bch" => 1934433566.5425043
|
23
|
+
# },
|
24
|
+
# "total_volume" => {
|
25
|
+
# "btc" => 6568919.505737251,
|
26
|
+
# "eth" => 85105558.43783577,
|
27
|
+
# "ltc" => 954318939.049309,
|
28
|
+
# "usd" => 286508058915.08606
|
29
|
+
# }
|
30
|
+
# "market_cap_percentage" => {
|
31
|
+
# "btc" => 38.55040456662042,
|
32
|
+
# "eth" => 18.387297257364622,
|
33
|
+
# },
|
34
|
+
# "market_cap_change_percentage_24h_usd" => -3.133283965790086,
|
35
|
+
# "updated_at" => 1621344957
|
36
|
+
# }
|
37
|
+
# }
|
38
|
+
def get_global_crypto_data
|
39
|
+
get 'global'
|
40
|
+
end
|
41
|
+
|
42
|
+
# Fetches global crypto data from CoinGecko.
|
43
|
+
#
|
44
|
+
# @return [Hash] global defi data.
|
45
|
+
#
|
46
|
+
# @example Get global defi data.
|
47
|
+
# client.get_global_defi_data
|
48
|
+
# @example Sample response object
|
49
|
+
# {
|
50
|
+
# "data" => {
|
51
|
+
# "defi_market_cap" => "125745676087.2760332093360054945",
|
52
|
+
# "eth_market_cap" => "394420680555.8088822113739591981",
|
53
|
+
# "defi_to_eth_ratio" =>
|
54
|
+
# "31.8811062112863892278072770612100063079659263284319798945238447",
|
55
|
+
# "trading_volume_24h" => "15011166214.23270941006219308344",
|
56
|
+
# "defi_dominance" =>
|
57
|
+
# "5.8997291574682455351428477202615510371051549446051010984545824",
|
58
|
+
# "top_coin_name" => "Uniswap",
|
59
|
+
# "top_coin_defi_dominance" => 14.449398175884316
|
60
|
+
# }
|
61
|
+
# }
|
62
|
+
def get_global_defi_data
|
63
|
+
get 'global/decentralized_finance_defi'
|
64
|
+
end
|
65
|
+
|
66
|
+
# Fetches the top 7 coin searches from CoinGecko in the last 24 hours.
|
67
|
+
#
|
68
|
+
# @return [Hash] the ternding searches and its information.
|
69
|
+
#
|
70
|
+
# @example Get trending searches in the last 24 hours.
|
71
|
+
# client.get_trending_searches
|
72
|
+
# @example Sample response object (truncated)
|
73
|
+
# {
|
74
|
+
# "coins" => [{
|
75
|
+
# "item" => {
|
76
|
+
# "id" => "shiba-inu",
|
77
|
+
# "coin_id" => 11939,
|
78
|
+
# "name" => "Shiba Inu",
|
79
|
+
# "symbol" => "SHIB",
|
80
|
+
# "market_cap_rank" => 24,
|
81
|
+
# "thumb" =>
|
82
|
+
# "https://assets.coingecko.com/coins/images/11939/thumb/SHIBLOGO.png?1600752116",
|
83
|
+
# "small" =>
|
84
|
+
# "https://assets.coingecko.com/coins/images/11939/small/SHIBLOGO.png?1600752116",
|
85
|
+
# "large" =>
|
86
|
+
# "https://assets.coingecko.com/coins/images/11939/large/SHIBLOGO.png?1600752116",
|
87
|
+
# "slug" => "shiba-inu",
|
88
|
+
# "price_btc" => 3.637711629799728e-10,
|
89
|
+
# "score" => 0
|
90
|
+
# }
|
91
|
+
# },
|
92
|
+
# ],
|
93
|
+
# "exchanges" => []
|
94
|
+
# }
|
95
|
+
def get_trending_searches
|
96
|
+
get 'search/trending'
|
97
|
+
end
|
98
|
+
|
99
|
+
# Fetches coin and/or market status updates.
|
100
|
+
#
|
101
|
+
# @option options [String] :category filter results by the given category. Valid values: general, milestone, partnership, exchange_listing, software_release, fund_movement, new_listings, event
|
102
|
+
# @option options [String] :project_type filter results by the project type. Fetches both coin and market status updates if left blank. Valid values: coin, market
|
103
|
+
# @option options [Integer] :per_page sets the number of results to return per page.
|
104
|
+
# @option options [Integer] :page sets the page for results.
|
105
|
+
#
|
106
|
+
# @return [Hash] the list of status updates and its information.
|
107
|
+
#
|
108
|
+
# @example Get a single status update.
|
109
|
+
# client.get_status_updates(options: { per_page: 1 })
|
110
|
+
# @example Sample response object
|
111
|
+
# {
|
112
|
+
# "status_updates" => [{
|
113
|
+
# "description" =>
|
114
|
+
# "📢 Community Call & AMA Invitation 📢\r\n" +
|
115
|
+
# "\r\n" +
|
116
|
+
# "Thursday 20th May at 4pm CET (Registration below)\r\n" +
|
117
|
+
# "\r\n" +
|
118
|
+
# "During this event, we will be updating our community on the latest news and developments at Fuse, covering:\r\n" +
|
119
|
+
# "\r\n" +
|
120
|
+
# "- Fuse Dollar (fUSD)\r\n" +
|
121
|
+
# "- Fuse Cash\r\n" +
|
122
|
+
# "- Latest partnerships and integrations.\r\n" +
|
123
|
+
# "- Binance Smart Chain (BSC) bridge.\r\n" +
|
124
|
+
# "- DeFi on Fuse.\r\n" +
|
125
|
+
# "- Featured communities.\r\n" +
|
126
|
+
# "- What to expect for the rest of Q2 and beyond!\r\n" +
|
127
|
+
# "\r\n" +
|
128
|
+
# "Please register 👉 https://bit.ly/3furWZs",
|
129
|
+
# "category" => "general",
|
130
|
+
# "created_at" => "2021-05-18T08:29:06.537Z",
|
131
|
+
# "user" => "Robert Miller",
|
132
|
+
# "user_title" => "Marcom Director ",
|
133
|
+
# "pin" => false,
|
134
|
+
# "project" => {
|
135
|
+
# "type" => "Coin",
|
136
|
+
# "id" => "fuse-network-token",
|
137
|
+
# "name" => "Fuse",
|
138
|
+
# "symbol" => "fuse",
|
139
|
+
# "image" => {
|
140
|
+
# "thumb" =>
|
141
|
+
# "https://assets.coingecko.com/coins/images/10347/thumb/vUXKHEe.png?1601523640",
|
142
|
+
# "small" =>
|
143
|
+
# "https://assets.coingecko.com/coins/images/10347/small/vUXKHEe.png?1601523640",
|
144
|
+
# "large" =>
|
145
|
+
# "https://assets.coingecko.com/coins/images/10347/large/vUXKHEe.png?1601523640"
|
146
|
+
# }
|
147
|
+
# }
|
148
|
+
# }]
|
149
|
+
# }
|
150
|
+
def get_status_updates(options: {})
|
151
|
+
get 'status_updates', { options: options }
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
@@ -13,7 +13,7 @@ module CoingeckoRuby
|
|
13
13
|
#
|
14
14
|
# @example Fetch the current price in USD for Bitcoin.
|
15
15
|
# client.get_price(id: 'bitcoin', currency: 'usd')
|
16
|
-
# @example
|
16
|
+
# @example Sample response object
|
17
17
|
# {
|
18
18
|
# "bitcoin" => {
|
19
19
|
# "usd" => 47931 # current price in given currency
|
@@ -21,7 +21,7 @@ module CoingeckoRuby
|
|
21
21
|
# }
|
22
22
|
# @example Fetch the current price, market cap, 24 hour volume, 24 hour price change and last updated at for Bitcoin.
|
23
23
|
# client.get_price(id: 'bitcoin', currency: 'usd', options: { include_market_cap: true, include_24hr_vol: true, include_24hr_change: true, include_last_updated_at: true })
|
24
|
-
# @example
|
24
|
+
# @example Sample response object
|
25
25
|
# {
|
26
26
|
# "bitcoin" => {
|
27
27
|
# "usd" => 48217, # current price in given currency
|
@@ -43,32 +43,14 @@ module CoingeckoRuby
|
|
43
43
|
#
|
44
44
|
# @example Fetch Bitcoin's price on 30th December, 2017.
|
45
45
|
# client.get_historical_price_on_date(id: 'bitcoin', date: '30-12-2017')
|
46
|
-
# @example
|
46
|
+
# @example Sample response object (truncated)
|
47
47
|
# {
|
48
48
|
# "id": "bitcoin",
|
49
49
|
# "symbol": "btc",
|
50
50
|
# "name": "Bitcoin",
|
51
51
|
# "localization": {
|
52
52
|
# "en": "Bitcoin",
|
53
|
-
# "de": "Bitcoin",
|
54
|
-
# "es": "Bitcoin",
|
55
|
-
# "fr": "Bitcoin",
|
56
|
-
# "it": "Bitcoin",
|
57
|
-
# "pl": "Bitcoin",
|
58
|
-
# "ro": "Bitcoin",
|
59
|
-
# "hu": "Bitcoin",
|
60
|
-
# "nl": "Bitcoin",
|
61
|
-
# "pt": "Bitcoin",
|
62
|
-
# "sv": "Bitcoin",
|
63
|
-
# "vi": "Bitcoin",
|
64
|
-
# "tr": "Bitcoin",
|
65
|
-
# "ru": "биткоин",
|
66
53
|
# "ja": "ビットコイン",
|
67
|
-
# "zh": "比特币",
|
68
|
-
# "zh-tw": "比特幣",
|
69
|
-
# "ko": "비트코인",
|
70
|
-
# "ar": "بيتكوين",
|
71
|
-
# "th": "บิตคอยน์",
|
72
54
|
# "id": "Bitcoin"
|
73
55
|
# },
|
74
56
|
# "image": {
|
@@ -77,175 +59,25 @@ module CoingeckoRuby
|
|
77
59
|
# },
|
78
60
|
# "market_data": {
|
79
61
|
# "current_price": {
|
80
|
-
# "aed": 50024.57906376443,
|
81
|
-
# "ars": 253468.12429692186,
|
82
|
-
# "aud": 17446.3215245937,
|
83
|
-
# "bch": 5.76928286478153,
|
84
|
-
# "bdt": 1126110.803183989,
|
85
|
-
# "bhd": 5132.860612995706,
|
86
|
-
# "bmd": 13620.3618741461,
|
87
|
-
# "brl": 45117.7211153463,
|
88
62
|
# "btc": 1,
|
89
|
-
# "cad": 17128.871750393,
|
90
|
-
# "chf": 13262.4868659029,
|
91
|
-
# "clp": 8362902.190725706,
|
92
|
-
# "cny": 88573.2132675718,
|
93
|
-
# "czk": 289914.5782287119,
|
94
|
-
# "dkk": 84525.1736167662,
|
95
63
|
# "eth": 18.483094024188404,
|
96
64
|
# "eur": 11345.8976447824,
|
97
65
|
# "gbp": 10079.0677868681,
|
98
|
-
# "hkd": 106417.930376984,
|
99
|
-
# "huf": 3526720.3000726495,
|
100
|
-
# "idr": 184652192.175199,
|
101
|
-
# "ils": 47387.96303252911,
|
102
|
-
# "inr": 869671.001953725,
|
103
|
-
# "jpy": 1535062.45448282,
|
104
|
-
# "krw": 14537693.2463698,
|
105
|
-
# "kwd": 4104.645874754543,
|
106
|
-
# "lkr": 2087919.548829924,
|
107
|
-
# "ltc": 60.96840666846534,
|
108
|
-
# "mmk": 18414729.253845528,
|
109
|
-
# "mxn": 267888.750532982,
|
110
|
-
# "myr": 55317.8739192755,
|
111
|
-
# "ngn": 4884546.501733771,
|
112
|
-
# "nok": 111755.75019546246,
|
113
|
-
# "nzd": 19178.1505368914,
|
114
|
-
# "php": 680527.760679833,
|
115
|
-
# "pkr": 1505414.7676248574,
|
116
|
-
# "pln": 47450.61669715,
|
117
|
-
# "rub": 785377.30638701,
|
118
|
-
# "sar": 51079.0811004227,
|
119
|
-
# "sek": 111446.704184538,
|
120
|
-
# "sgd": 18213.1478981081,
|
121
|
-
# "thb": 442954.59869004245,
|
122
|
-
# "try": 51700.07425935065,
|
123
|
-
# "twd": 404053.46952093,
|
124
|
-
# "uah": 382908.08925747185,
|
125
66
|
# "usd": 13620.3618741461,
|
126
|
-
# "vef": 140859.73944813784,
|
127
|
-
# "vnd": 309201434.91677517,
|
128
|
-
# "xag": 804.154745877564,
|
129
|
-
# "xau": 10.4549897745945,
|
130
|
-
# "xdr": 9563.95932114975,
|
131
|
-
# "zar": 168771.061713303,
|
132
|
-
# "bits": 1000000,
|
133
|
-
# "link": 22041.447552365687,
|
134
|
-
# "sats": 100000000
|
135
67
|
# },
|
136
68
|
# "market_cap": {
|
137
|
-
# "aed": 839030999274.6053,
|
138
|
-
# "ars": 4251262431254.5815,
|
139
|
-
# "aud": 292616246981.057,
|
140
|
-
# "bch": 96764575.68919012,
|
141
|
-
# "bdt": 18887552682553.043,
|
142
|
-
# "bhd": 86090263023.8938,
|
143
|
-
# "bmd": 228445816988.881,
|
144
|
-
# "brl": 756731337692.006,
|
145
69
|
# "btc": 16772375,
|
146
|
-
# "cad": 287291860324.498,
|
147
|
-
# "chf": 222443403147.498,
|
148
|
-
# "clp": 140265731631172.94,
|
149
|
-
# "cny": 1485583147878.69,
|
150
|
-
# "czk": 4862556024018.788,
|
151
|
-
# "dkk": 1417687908840.51,
|
152
70
|
# "eth": 310005384.13394696,
|
153
71
|
# "eur": 190297650009.907,
|
154
72
|
# "gbp": 169049904571.772,
|
155
|
-
# "hkd": 1784881435006.67,
|
156
|
-
# "huf": 59151475392930.96,
|
157
|
-
# "idr": 3097055811734500,
|
158
|
-
# "ils": 794808686467.7148,
|
159
|
-
# "inr": 14586448171393.6,
|
160
|
-
# "jpy": 25746643135006.3,
|
161
|
-
# "krw": 243831642763082,
|
162
|
-
# "kwd": 68844659853.58617,
|
163
|
-
# "lkr": 35019369642806.27,
|
164
|
-
# "ltc": 1022584979.7960014,
|
165
|
-
# "mmk": 308858744568967.1,
|
166
|
-
# "mxn": 4493130582220.62,
|
167
|
-
# "myr": 927812125576.808,
|
168
|
-
# "ngn": 81925445632016.88,
|
169
|
-
# "nok": 1874409350684.6182,
|
170
|
-
# "nzd": 321663132611.194,
|
171
|
-
# "php": 11414066800032.4,
|
172
|
-
# "pkr": 25249381013141.95,
|
173
|
-
# "pln": 795859537225.861,
|
174
|
-
# "rub": 13172642699212.8,
|
175
|
-
# "sar": 856717502871.7015,
|
176
|
-
# "sek": 1869225915097.14,
|
177
|
-
# "sgd": 305477746477.531,
|
178
|
-
# "thb": 7429400637203.895,
|
179
|
-
# "try": 867133033005.6757,
|
180
|
-
# "twd": 6776936310856.11,
|
181
|
-
# "uah": 6422278063559.784,
|
182
73
|
# "usd": 228445816988.881,
|
183
|
-
# "vef": 2362552372426.4595,
|
184
|
-
# "vnd": 5186042416962243,
|
185
|
-
# "xag": 13487584955.8882,
|
186
|
-
# "xau": 175355009.120664,
|
187
|
-
# "xdr": 160410312219.069,
|
188
|
-
# "zar": 2830691536203.66,
|
189
|
-
# "bits": 16772375000000,
|
190
|
-
# "link": 369687423891.10944,
|
191
|
-
# "sats": 1677237500000000
|
192
74
|
# },
|
193
75
|
# "total_volume": {
|
194
|
-
# "aed": 13223772038.888288,
|
195
|
-
# "ars": 67003156399.47071,
|
196
|
-
# "aud": 4611856472.88116,
|
197
|
-
# "bch": 1525083.9259334763,
|
198
|
-
# "bdt": 297682315984.16693,
|
199
|
-
# "bhd": 1356848571.721612,
|
200
|
-
# "bmd": 3600481281.03768,
|
201
|
-
# "brl": 11926666253.0629,
|
202
76
|
# "btc": 264345.493482963,
|
203
|
-
# "cad": 4527940055.66402,
|
204
|
-
# "chf": 3505878635.37842,
|
205
|
-
# "clp": 2210695506557.1357,
|
206
|
-
# "cny": 23413929770.588,
|
207
|
-
# "czk": 76637612249.77382,
|
208
|
-
# "dkk": 22343848731.4572,
|
209
77
|
# "eth": 4885922.610916088,
|
210
78
|
# "eur": 2999236911.91719,
|
211
79
|
# "gbp": 2664356147.96788,
|
212
|
-
# "hkd": 28131100320.9394,
|
213
|
-
# "huf": 932272618099.0865,
|
214
|
-
# "idr": 48811974863263.9,
|
215
|
-
# "ils": 12526794472.986298,
|
216
|
-
# "inr": 229893610179.28,
|
217
|
-
# "jpy": 405786842057.429,
|
218
|
-
# "krw": 3842973695315.56,
|
219
|
-
# "kwd": 1085044639.3347962,
|
220
|
-
# "lkr": 551932123488.1709,
|
221
|
-
# "ltc": 16116723.547645444,
|
222
|
-
# "mmk": 4867850691962.943,
|
223
|
-
# "mxn": 70815183958.1755,
|
224
|
-
# "myr": 14623030679.6192,
|
225
|
-
# "ngn": 1291207855441.2922,
|
226
|
-
# "nok": 29542128934.978218,
|
227
|
-
# "nzd": 5069657667.76511,
|
228
|
-
# "php": 179894446725.766,
|
229
|
-
# "pkr": 397949609644.3324,
|
230
|
-
# "pln": 12543356686.879,
|
231
|
-
# "rub": 207610951627.194,
|
232
|
-
# "sar": 13502524900.147509,
|
233
|
-
# "sek": 29460434014.7115,
|
234
|
-
# "sgd": 4814563569.00357,
|
235
|
-
# "thb": 117093051981.26692,
|
236
|
-
# "try": 13666681643.19386,
|
237
|
-
# "twd": 106809713794.014,
|
238
|
-
# "uah": 101220027813.38469,
|
239
80
|
# "usd": 3600481281.03768,
|
240
|
-
# "vef": 37235637336.29954,
|
241
|
-
# "vnd": 81736005898715.08,
|
242
|
-
# "xag": 212574683.135671,
|
243
|
-
# "xau": 2763729.43132451,
|
244
|
-
# "xdr": 2528189546.40031,
|
245
|
-
# "zar": 44613869594.2467,
|
246
|
-
# "bits": 264345493482.963,
|
247
|
-
# "link": 5826557330.308955,
|
248
|
-
# "sats": 26434549348296.3
|
249
81
|
# }
|
250
82
|
# },
|
251
83
|
# "community_data": {
|
@@ -276,7 +108,7 @@ module CoingeckoRuby
|
|
276
108
|
# }
|
277
109
|
# }
|
278
110
|
def get_historical_price_on_date(id:, date:)
|
279
|
-
get
|
111
|
+
get "coins/#{id}/history", { date: date }
|
280
112
|
end
|
281
113
|
|
282
114
|
# Fetches a coin's historical price data in 5 - 10 minutes ranges.
|
@@ -288,7 +120,7 @@ module CoingeckoRuby
|
|
288
120
|
#
|
289
121
|
# @example Fetch Bitcoin's minutely historical price within the last 24 hours.
|
290
122
|
# client.get_minutely_historical_prices(id: 'bitcoin')
|
291
|
-
# @example
|
123
|
+
# @example Sample response object (truncated)
|
292
124
|
# {
|
293
125
|
# "prices" => [
|
294
126
|
# [1621057474114, 49364.605172521166], # [UNIX timestamp for minutely price data, coin price in given currency]
|
@@ -320,7 +152,7 @@ module CoingeckoRuby
|
|
320
152
|
#
|
321
153
|
# @example Fetch Bitcoin's hourly historical price within the last 7 days.
|
322
154
|
# client.get_hourly_historical_prices(id: 'bitcoin', days: 7)
|
323
|
-
# @example
|
155
|
+
# @example Sample response object (truncated)
|
324
156
|
# {
|
325
157
|
# "prices" => [
|
326
158
|
# [1620540153122, 58533.64354969528], # [UNIX timestamp for minutely price data, coin price in given currency]
|
@@ -351,6 +183,7 @@ module CoingeckoRuby
|
|
351
183
|
#
|
352
184
|
# @example Fetch Bitcoin's daily historical price within the last 14 days.
|
353
185
|
# client.get_daily_historical_prices(id: 'bitcoin', days: 14)
|
186
|
+
# @example Sample response object (truncated)
|
354
187
|
# {
|
355
188
|
# "prices" => [
|
356
189
|
# [1620000000000, 56600.74528738432], # [UNIX timestamp for minutely price data, coin price in given currency]
|
@@ -382,18 +215,11 @@ module CoingeckoRuby
|
|
382
215
|
#
|
383
216
|
# @example Fetch Bitcoin's OHLC data in USD within the last 7 days.
|
384
217
|
# client.get_ohlc(id: 'bitcoin', days: 7, currency: 'usd')
|
385
|
-
# @example
|
218
|
+
# @example Sample response object (truncated)
|
386
219
|
# [
|
387
220
|
# [1620547200000, 58384.27, 58384.27, 58384.27, 58384.27], # [UNIX timestamp for OHLC data, open, high, low, close]
|
388
221
|
# [1620561600000, 58022.03, 58214.96, 57943.18, 58048.35],
|
389
222
|
# [1620576000000, 57956.7, 57956.7, 56636.68, 57302.22],
|
390
|
-
# [1620590400000, 57396.24, 57618.74, 57396.24, 57535.26],
|
391
|
-
# [1620604800000, 57347.57, 58071.98, 57347.57, 58050.13],
|
392
|
-
# [1620619200000, 58213.93, 59005.01, 58213.93, 58909.0],
|
393
|
-
# [1620633600000, 59577.8, 59577.8, 58849.82, 58849.82],
|
394
|
-
# [1620648000000, 58495.02, 58495.02, 57878.12, 57878.12],
|
395
|
-
# [1620662400000, 58239.57, 58239.57, 57237.93, 57237.93],
|
396
|
-
# [1620676800000, 58114.79, 58114.79, 56850.29, 56850.29],
|
397
223
|
# ]
|
398
224
|
def get_ohlc(id:, days:, currency: 'usd')
|
399
225
|
get "coins/#{id}/ohlc", { vs_currency: currency, days: days }
|
@@ -405,72 +231,18 @@ module CoingeckoRuby
|
|
405
231
|
#
|
406
232
|
# @example Fetch supported currencies.
|
407
233
|
# client.supported_currencies
|
408
|
-
# @example
|
234
|
+
# @example Sample response object (truncated)
|
409
235
|
# [
|
410
236
|
# "btc",
|
411
237
|
# "eth",
|
412
|
-
# "ltc",
|
413
|
-
# "bch",
|
414
|
-
# "bnb",
|
415
|
-
# "eos",
|
416
|
-
# "xrp",
|
417
|
-
# "xlm",
|
418
|
-
# "link",
|
419
|
-
# "dot",
|
420
238
|
# "yfi",
|
421
239
|
# "usd",
|
422
|
-
# "aed",
|
423
|
-
# "ars",
|
424
240
|
# "aud",
|
425
|
-
# "bdt",
|
426
|
-
# "bhd",
|
427
|
-
# "bmd",
|
428
|
-
# "brl",
|
429
|
-
# "cad",
|
430
|
-
# "chf",
|
431
|
-
# "clp",
|
432
|
-
# "cny",
|
433
|
-
# "czk",
|
434
|
-
# "dkk",
|
435
241
|
# "eur",
|
436
242
|
# "gbp",
|
437
|
-
# "hkd",
|
438
|
-
# "huf",
|
439
|
-
# "idr",
|
440
|
-
# "ils",
|
441
|
-
# "inr",
|
442
|
-
# "jpy",
|
443
|
-
# "krw",
|
444
|
-
# "kwd",
|
445
|
-
# "lkr",
|
446
|
-
# "mmk",
|
447
|
-
# "mxn",
|
448
|
-
# "myr",
|
449
|
-
# "ngn",
|
450
|
-
# "nok",
|
451
|
-
# "nzd",
|
452
|
-
# "php",
|
453
|
-
# "pkr",
|
454
|
-
# "pln",
|
455
|
-
# "rub",
|
456
|
-
# "sar",
|
457
|
-
# "sek",
|
458
|
-
# "sgd",
|
459
|
-
# "thb",
|
460
|
-
# "try",
|
461
|
-
# "twd",
|
462
|
-
# "uah",
|
463
|
-
# "vef",
|
464
|
-
# "vnd",
|
465
|
-
# "zar",
|
466
|
-
# "xdr",
|
467
|
-
# "xag",
|
468
|
-
# "xau",
|
469
|
-
# "bits",
|
470
|
-
# "sats"
|
471
243
|
# ]
|
472
244
|
def supported_currencies
|
473
|
-
get
|
245
|
+
get 'simple/supported_vs_currencies'
|
474
246
|
end
|
475
247
|
|
476
248
|
# Fetches the exchange rate for a coin or currency in the given coin or currency.
|
@@ -481,7 +253,7 @@ module CoingeckoRuby
|
|
481
253
|
#
|
482
254
|
# @example Fetch the exchange rate for BTC-USD.
|
483
255
|
# client.get_exchange_rate(from: 'bitcoin', to: 'usd')
|
484
|
-
# @example
|
256
|
+
# @example Sample response object
|
485
257
|
# {
|
486
258
|
# "bitcoin" => {
|
487
259
|
# "usd" => 47931 # current price in given currency
|
@@ -489,7 +261,7 @@ module CoingeckoRuby
|
|
489
261
|
# }
|
490
262
|
# @example Fetch the exchange rate for BTC-ETH.
|
491
263
|
# client.get_exchange_rate(from: 'bitcoin', to: 'eth')
|
492
|
-
# @example
|
264
|
+
# @example Sample response object
|
493
265
|
# {
|
494
266
|
# "bitcoin" => {
|
495
267
|
# "eth" => 12.71434 # current price in given currency
|