From b9a1d496747b73e0f0cdff8ce54bda07d6f266ac Mon Sep 17 00:00:00 2001 From: Manolis Christoforou Date: Mon, 8 Jun 2020 18:58:29 +0300 Subject: [PATCH 1/7] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 120a431..90cf6b5 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ https://www.coingecko.com/api/docs/v3 ```python cg.get_coins_list() ``` - - **/coins/markets** (List all supported coins price, market cap, volume, and market related data (no pagination required)) + - **/coins/markets** (List all supported coins price, market cap, volume, and market related data) ```python cg.get_coins_markets() ``` @@ -130,7 +130,7 @@ https://www.coingecko.com/api/docs/v3 ```python cg.get_exchanges_by_id() ``` - - **/exchanges/{id}/tickers** (Get exchange tickers (paginated)) + - **/exchanges/{id}/tickers** (Get exchange tickers (paginated, 100 tickers per page)) ```python cg.get_exchanges_tickers_by_id() ``` From 71507e3f6cc6771f923c29d1411d0286310c6bc6 Mon Sep 17 00:00:00 2001 From: Manolis Christoforou Date: Mon, 8 Jun 2020 19:08:53 +0300 Subject: [PATCH 2/7] Update some endpoints documention --- pycoingecko/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pycoingecko/api.py b/pycoingecko/api.py index e338586..e22d9c3 100644 --- a/pycoingecko/api.py +++ b/pycoingecko/api.py @@ -106,7 +106,7 @@ def get_coins_list(self): @list_args_to_comma_separated def get_coins_markets(self, vs_currency, **kwargs): - """List all supported coins price, market cap, volume, and market related data (no pagination required)""" + """List all supported coins price, market cap, volume, and market related data""" kwargs['vs_currency'] = vs_currency @@ -225,7 +225,7 @@ def get_exchanges_by_id(self, id): @list_args_to_comma_separated def get_exchanges_tickers_by_id(self, id, **kwargs): - """Get exchange tickers (paginated)""" + """Get exchange tickers (paginated, 100 tickers per page)""" api_url = '{0}exchanges/{1}/tickers'.format(self.api_base_url, id) api_url = self.__api_url_params(api_url, kwargs) From 578c71ad5d12c73fd60890a35282deb550663416 Mon Sep 17 00:00:00 2001 From: Manolis Christoforou Date: Thu, 2 Jul 2020 12:04:54 +0300 Subject: [PATCH 3/7] optional arguments for get_exchanges_list --- pycoingecko/api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pycoingecko/api.py b/pycoingecko/api.py index e22d9c3..252797b 100644 --- a/pycoingecko/api.py +++ b/pycoingecko/api.py @@ -201,10 +201,11 @@ def get_coin_market_chart_range_from_contract_address_by_id(self, id, contract_a return self.__request(api_url) # ---------- EXCHANGES ----------# - def get_exchanges_list(self): + def get_exchanges_list(self, **kwargs): """List all exchanges""" api_url = '{0}exchanges'.format(self.api_base_url) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) From 446d854efbb9feb252987b4bb789ff9c72a464e0 Mon Sep 17 00:00:00 2001 From: Manolis Christoforou Date: Sat, 4 Jul 2020 17:23:00 +0300 Subject: [PATCH 4/7] optional arguments for more endopoints (finance_platforms, finance_products, derivatives, derivatives/exchanges/) --- pycoingecko/api.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pycoingecko/api.py b/pycoingecko/api.py index 252797b..782d58d 100644 --- a/pycoingecko/api.py +++ b/pycoingecko/api.py @@ -254,17 +254,19 @@ def get_exchanges_volume_chart_by_id(self, id, days, **kwargs): return self.__request(api_url) # ---------- FINANCE ----------# - def get_finance_platforms(self): + def get_finance_platforms(self, **kwargs): """Get cryptocurrency finance platforms data""" api_url = '{0}finance_platforms'.format(self.api_base_url) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) - def get_finance_products(self): + def get_finance_products(self, **kwargs): """Get cryptocurrency finance products data""" api_url = '{0}finance_products'.format(self.api_base_url) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) @@ -292,10 +294,11 @@ def get_indexes_list(self): return self.__request(api_url) # ---------- DERIVATIVES ----------# - def get_derivatives(self): + def get_derivatives(self, **kwargs): """List all derivative tickers""" api_url = '{0}derivatives'.format(self.api_base_url) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) @@ -307,10 +310,11 @@ def get_derivatives_exchanges(self, **kwargs): return self.__request(api_url) - def get_derivatives_exchanges_by_id(self, id): + def get_derivatives_exchanges_by_id(self, id, **kwargs): """List all derivative tickers""" api_url = '{0}derivatives/exchanges/{1}'.format(self.api_base_url, id) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) From 7aa273f17364817cdd6c8fa3d72cfff661498c17 Mon Sep 17 00:00:00 2001 From: Manolis Christoforou Date: Sat, 11 Jul 2020 18:47:06 +0300 Subject: [PATCH 5/7] optional arguments for all endopoints --- pycoingecko/api.py | 49 +++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/pycoingecko/api.py b/pycoingecko/api.py index 782d58d..cbf3230 100644 --- a/pycoingecko/api.py +++ b/pycoingecko/api.py @@ -80,10 +80,12 @@ def get_token_price(self, id, contract_addresses, vs_currencies, **kwargs): api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) - def get_supported_vs_currencies(self): + def get_supported_vs_currencies(self, **kwargs): """Get list of supported_vs_currencies""" api_url = '{0}simple/supported_vs_currencies'.format(self.api_base_url) + api_url = self.__api_url_params(api_url, kwargs) + return self.__request(api_url) # ---------- COINS ----------# @@ -97,10 +99,11 @@ def get_coins(self, **kwargs): return self.__request(api_url) - def get_coins_list(self): + def get_coins_list(self, **kwargs): """List all supported coins id, name and symbol (no pagination required)""" api_url = '{0}coins/list'.format(self.api_base_url) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) @@ -145,20 +148,22 @@ def get_coin_history_by_id(self, id, date, **kwargs): return self.__request(api_url) @list_args_to_comma_separated - def get_coin_market_chart_by_id(self, id, vs_currency, days): + def get_coin_market_chart_by_id(self, id, vs_currency, days, **kwargs): """Get historical market data include price, market cap, and 24h volume (granularity auto)""" api_url = '{0}coins/{1}/market_chart?vs_currency={2}&days={3}'.format(self.api_base_url, id, vs_currency, days) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) @list_args_to_comma_separated - def get_coin_market_chart_range_by_id(self, id, vs_currency, from_timestamp, to_timestamp): + def get_coin_market_chart_range_by_id(self, id, vs_currency, from_timestamp, to_timestamp, **kwargs): """Get historical market data include price, market cap, and 24h volume within a range of timestamp (granularity auto)""" api_url = '{0}coins/{1}/market_chart/range?vs_currency={2}&from={3}&to={4}'.format(self.api_base_url, id, vs_currency, from_timestamp, to_timestamp) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) @@ -173,30 +178,33 @@ def get_coin_status_updates_by_id(self, id, **kwargs): # ---------- Contract ----------# @list_args_to_comma_separated - def get_coin_info_from_contract_address_by_id(self, id, contract_address): + def get_coin_info_from_contract_address_by_id(self, id, contract_address, **kwargs): """Get coin info from contract address""" api_url = '{0}coins/{1}/contract/{2}'.format(self.api_base_url, id, contract_address) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) @list_args_to_comma_separated - def get_coin_market_chart_from_contract_address_by_id(self, id, contract_address, vs_currency, days): + def get_coin_market_chart_from_contract_address_by_id(self, id, contract_address, vs_currency, days, **kwargs): """Get historical market data include price, market cap, and 24h volume (granularity auto) from a contract address""" api_url = '{0}coins/{1}/contract/{2}/market_chart/?vs_currency={3}&days={4}'.format(self.api_base_url, id, contract_address, vs_currency, days) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) @list_args_to_comma_separated def get_coin_market_chart_range_from_contract_address_by_id(self, id, contract_address, vs_currency, from_timestamp, - to_timestamp): + to_timestamp, **kwargs): """Get historical market data include price, market cap, and 24h volume within a range of timestamp (granularity auto) from a contract address""" api_url = '{0}coins/{1}/contract/{2}/market_chart/range?vs_currency={3}&from={4}&to={5}'.format( self.api_base_url, id, contract_address, vs_currency, from_timestamp, to_timestamp) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) @@ -209,18 +217,20 @@ def get_exchanges_list(self, **kwargs): return self.__request(api_url) - def get_exchanges_id_name_list(self): + def get_exchanges_id_name_list(self, **kwargs): """List all supported markets id and name (no pagination required)""" api_url = '{0}exchanges/list'.format(self.api_base_url) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) @list_args_to_comma_separated - def get_exchanges_by_id(self, id): + def get_exchanges_by_id(self, id, **kwargs): """Get exchange volume in BTC and tickers""" api_url = '{0}exchanges/{1}'.format(self.api_base_url, id) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) @@ -279,17 +289,19 @@ def get_indexes(self, **kwargs): return self.__request(api_url) - def get_indexes_by_id(self, id): + def get_indexes_by_id(self, id, **kwargs): """Get market index by id""" api_url = '{0}indexes/{1}'.format(self.api_base_url, id) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) - def get_indexes_list(self): + def get_indexes_list(self, **kwargs): """List market indexes id and name""" api_url = '{0}indexes/list'.format(self.api_base_url) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) @@ -318,10 +330,11 @@ def get_derivatives_exchanges_by_id(self, id, **kwargs): return self.__request(api_url) - def get_derivatives_exchanges_list(self): + def get_derivatives_exchanges_list(self, **kwargs): """List all derivative tickers""" api_url = '{0}derivatives/exchanges/list'.format(self.api_base_url) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) @@ -345,32 +358,36 @@ def get_events(self, **kwargs): return self.__request(api_url) - def get_events_countries(self): + def get_events_countries(self, **kwargs): """Get list of event countries""" api_url = '{0}events/countries'.format(self.api_base_url) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) - def get_events_types(self): + def get_events_types(self, **kwargs): """Get list of event types""" api_url = '{0}events/types'.format(self.api_base_url) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) # ---------- EXCHANGE-RATES ----------# - def get_exchange_rates(self): + def get_exchange_rates(self, **kwargs): """Get BTC-to-Currency exchange rates""" api_url = '{0}exchange_rates'.format(self.api_base_url) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url) # ---------- GLOBAL ----------# - def get_global(self): + def get_global(self, **kwargs): """Get cryptocurrency global data""" api_url = '{0}global'.format(self.api_base_url) + api_url = self.__api_url_params(api_url, kwargs) return self.__request(api_url)['data'] From 6cd431629bfa774b0e812e2c37202560d647ca32 Mon Sep 17 00:00:00 2001 From: Manolis Christoforou Date: Sun, 12 Jul 2020 17:19:36 +0300 Subject: [PATCH 6/7] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 90cf6b5..0ab3354 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ Usage examples: https://www.coingecko.com/api/docs/v3 ### Endpoints included +> :warning: **Endpoints documentation**: To make sure that your are using properly each endpoint you should check the [API documentation](https://www.coingecko.com/api/docs/v3). Return behaviour and parameters of the endpoints, such as *pagination*, might have changed.
Any **optional parameters** defined in CoinGecko API doc can be passed as function parameters using same parameters names with the API *(see Examples above)*. - *ping* - **/ping** (Check API server status) ```python From b54056ad06b20e8c80d0640787f866370baa0bd7 Mon Sep 17 00:00:00 2001 From: Manolis Christoforou Date: Sun, 12 Jul 2020 17:29:48 +0300 Subject: [PATCH 7/7] updated version --- CHANGELOG.md | 5 +++++ setup.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4da19a6..18cc4bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ +1.3.0 / 2020-07-12 +================== + + * allow optional arguments for **ALL** endopoints + 1.2.0 / 2019-12-13 ================== diff --git a/setup.py b/setup.py index fb41c5c..d8d9dde 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setuptools.setup( name='pycoingecko', - version='1.2.0', + version='1.3.0', packages=['pycoingecko',], license='MIT', description = 'Python wrapper around the CoinGecko API',