comentadas listas auxiliares 'lista_tipos_ordenação[]' e 'lista_timeframe_price_change[]' (fora de uso; remover na proxima release)
This commit is contained in:
@ -294,24 +294,24 @@ def coins_list(include_platform: bool = False) -> tuple:
|
||||
|
||||
|
||||
# lista auxiliar para ordenação dos dados retornados por coins_list_with_market_data()
|
||||
lista_tipos_ordenacao = [
|
||||
'market_cap_asc',
|
||||
'market_cap_desc',
|
||||
'volume_asc',
|
||||
'volume_desc',
|
||||
'id_asc',
|
||||
'id_desc'
|
||||
]
|
||||
# lista_tipos_ordenacao = [
|
||||
# 'market_cap_asc',
|
||||
# 'market_cap_desc',
|
||||
# 'volume_asc',
|
||||
# 'volume_desc',
|
||||
# 'id_asc',
|
||||
# 'id_desc'
|
||||
# ]
|
||||
# lista auxiliar para parametro 'price_change_percentage'
|
||||
lista_timeframe_price_change = [
|
||||
'1h',
|
||||
'24h',
|
||||
'7d',
|
||||
'14d',
|
||||
'30d',
|
||||
'200d',
|
||||
'1y'
|
||||
]
|
||||
# lista_timeframe_price_change = [
|
||||
# '1h',
|
||||
# '24h',
|
||||
# '7d',
|
||||
# '14d',
|
||||
# '30d',
|
||||
# '200d',
|
||||
# '1y'
|
||||
# ]
|
||||
def coins_list_with_market_data(
|
||||
vs_currency: str = '',
|
||||
ids: str = '',
|
||||
@ -365,8 +365,8 @@ def coins_list_with_market_data(
|
||||
# order
|
||||
if not isinstance(order, str):
|
||||
raise TypeError('\'order\' tem de ser do tipo \'str\'')
|
||||
if not order in lista_tipos_ordenacao:
|
||||
order = lista_tipos_ordenacao[1]
|
||||
# if not order in lista_tipos_ordenacao:
|
||||
# order = lista_tipos_ordenacao[1]
|
||||
api_parameters['order'] = order
|
||||
# per_page
|
||||
if not isinstance(per_page, int):
|
||||
@ -386,11 +386,11 @@ def coins_list_with_market_data(
|
||||
# price_change_percentage
|
||||
if not isinstance(price_change_percentage, str):
|
||||
raise TypeError('\'price_change_percentage\' tem de ser do tipo \'str\'')
|
||||
for timeframe in price_change_percentage.split(','):
|
||||
if not timeframe in lista_timeframe_price_change:
|
||||
price_change_percentage = lista_timeframe_price_change[0]
|
||||
else:
|
||||
price_change_percentage += f',{timeframe}'
|
||||
# for timeframe in price_change_percentage.split(','):
|
||||
# if not timeframe in lista_timeframe_price_change:
|
||||
# price_change_percentage = lista_timeframe_price_change[0]
|
||||
# else:
|
||||
# price_change_percentage += f',{timeframe}'
|
||||
api_parameters['price_change_percentage'] = price_change_percentage
|
||||
# locale
|
||||
if not isinstance(locale, str):
|
||||
@ -416,14 +416,14 @@ def coins_list_with_market_data(
|
||||
|
||||
|
||||
# debug (decomentar linhas seguintes para testar funcao)
|
||||
# url, codigo, dados = coins_list_with_market_data('eur', 'bitcoin')
|
||||
# print(f'url: {url}')
|
||||
# if codigo == 200:
|
||||
# print(f'codigo: {codigo}')
|
||||
# for item in dados:
|
||||
# print(item)
|
||||
# else:
|
||||
# print(f'erro {codigo}: {dados}')
|
||||
url, codigo, dados = coins_list_with_market_data('eur', 'bitcoin')
|
||||
print(f'url: {url}')
|
||||
if codigo == 200:
|
||||
print(f'codigo: {codigo}')
|
||||
for item in dados:
|
||||
print(item)
|
||||
else:
|
||||
print(f'erro {codigo}: {dados}')
|
||||
|
||||
|
||||
def coin_data_by_id(
|
||||
|
||||
Reference in New Issue
Block a user