Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@list_args_to_comma_separated
def get_exchanges_volume_chart_by_id(self, id, days, **kwargs):
"""Get volume chart data for a given exchange"""
kwargs['days'] = days
api_url = '{0}exchanges/{1}/volume_chart'.format(self.api_base_url, id)
api_url = self.__api_url_params(api_url, kwargs)
return self.__request(api_url)
@list_args_to_comma_separated
def get_price(self, ids, vs_currencies, **kwargs):
"""Get the current price of any cryptocurrencies in any other supported currencies that you need"""
ids = ids.replace(' ', '')
kwargs['ids'] = ids
vs_currencies = vs_currencies.replace(' ', '')
kwargs['vs_currencies'] = vs_currencies
api_url = '{0}simple/price'.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_coin_market_chart_range_by_id(self, id, vs_currency, from_timestamp, to_timestamp):
"""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)
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):
"""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)
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):
"""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)
return self.__request(api_url)
@list_args_to_comma_separated
def get_token_price(self, id, contract_addresses, vs_currencies, **kwargs):
"""Get the current price of any tokens on this coin (ETH only at this stage as per api docs) in any other supported currencies that you need"""
contract_addresses = contract_addresses.replace(' ', '')
kwargs['contract_addresses'] = contract_addresses
vs_currencies = vs_currencies.replace(' ', '')
kwargs['vs_currencies'] = vs_currencies
api_url = '{0}simple/token_price/{1}'.format(self.api_base_url, id)
api_url = self.__api_url_params(api_url, kwargs)
return self.__request(api_url)
@list_args_to_comma_separated
def get_events(self, **kwargs):
"""Get events, paginated by 100"""
api_url = '{0}events'.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_coin_market_chart_by_id(self, id, vs_currency, days):
"""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)
return self.__request(api_url)
@list_args_to_comma_separated
def get_coin_by_id(self, id, **kwargs):
"""Get current data (name, price, market, ... including exchange tickers) for a coin"""
api_url = '{0}coins/{1}/'.format(self.api_base_url, id)
api_url = self.__api_url_params(api_url, kwargs)
return self.__request(api_url)
@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)"""
kwargs['vs_currency'] = vs_currency
api_url = '{0}coins/markets'.format(self.api_base_url)
api_url = self.__api_url_params(api_url, kwargs)
return self.__request(api_url)