Skip to content

Commit

Permalink
Added /indexes/{market_id}/{id} endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
man-c committed Jun 15, 2021
1 parent dff4e0e commit 7655dce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ https://www.coingecko.com/api/docs/v3
```python
cg.get_indexes()
```
- **/indexes/{market_id}/{id}** (Get market index by market id and index id)
```python
cg.get_indexes_by_market_id_and_index_id()
```
- **/indexes/list** (List market indexes id and name)
```python
cg.get_indexes_list()
Expand Down
22 changes: 15 additions & 7 deletions pycoingecko/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def get_coin_status_updates_by_id(self, id, **kwargs):
api_url = self.__api_url_params(api_url, kwargs)

return self.__request(api_url)

@func_args_preprocessing
def get_coin_ohlc_by_id(self, id, vs_currency, days, **kwargs):
"""Get coin's OHLC"""
Expand Down Expand Up @@ -344,15 +344,24 @@ def get_indexes(self, **kwargs):

return self.__request(api_url)

#@func_args_preprocessing
#def get_indexes_by_id(self, id, **kwargs):
# @func_args_preprocessing
# 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)

@func_args_preprocessing
def get_indexes_by_market_id_and_index_id(self, market_id, id, **kwargs):
"""Get market index by market id and index id"""

api_url = '{0}indexes/{1}/{2}'.format(self.api_base_url, market_id, id)
api_url = self.__api_url_params(api_url, kwargs)

return self.__request(api_url)

@func_args_preprocessing
def get_indexes_list(self, **kwargs):
"""List market indexes id and name"""
Expand Down Expand Up @@ -446,7 +455,7 @@ def get_exchange_rates(self, **kwargs):
api_url = self.__api_url_params(api_url, kwargs)

return self.__request(api_url)

# ---------- TRENDING ----------#
@func_args_preprocessing
def get_search_trending(self, **kwargs):
Expand Down Expand Up @@ -485,4 +494,3 @@ def get_companies_public_treasury_by_coin_id(self, coin_id, **kwargs):
api_url = self.__api_url_params(api_url, kwargs)

return self.__request(api_url)

0 comments on commit 7655dce

Please sign in to comment.