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 auxiliar para ordenação dos dados retornados por coins_list_with_market_data()
|
||||||
lista_tipos_ordenacao = [
|
# lista_tipos_ordenacao = [
|
||||||
'market_cap_asc',
|
# 'market_cap_asc',
|
||||||
'market_cap_desc',
|
# 'market_cap_desc',
|
||||||
'volume_asc',
|
# 'volume_asc',
|
||||||
'volume_desc',
|
# 'volume_desc',
|
||||||
'id_asc',
|
# 'id_asc',
|
||||||
'id_desc'
|
# 'id_desc'
|
||||||
]
|
# ]
|
||||||
# lista auxiliar para parametro 'price_change_percentage'
|
# lista auxiliar para parametro 'price_change_percentage'
|
||||||
lista_timeframe_price_change = [
|
# lista_timeframe_price_change = [
|
||||||
'1h',
|
# '1h',
|
||||||
'24h',
|
# '24h',
|
||||||
'7d',
|
# '7d',
|
||||||
'14d',
|
# '14d',
|
||||||
'30d',
|
# '30d',
|
||||||
'200d',
|
# '200d',
|
||||||
'1y'
|
# '1y'
|
||||||
]
|
# ]
|
||||||
def coins_list_with_market_data(
|
def coins_list_with_market_data(
|
||||||
vs_currency: str = '',
|
vs_currency: str = '',
|
||||||
ids: str = '',
|
ids: str = '',
|
||||||
@ -365,8 +365,8 @@ def coins_list_with_market_data(
|
|||||||
# order
|
# order
|
||||||
if not isinstance(order, str):
|
if not isinstance(order, str):
|
||||||
raise TypeError('\'order\' tem de ser do tipo \'str\'')
|
raise TypeError('\'order\' tem de ser do tipo \'str\'')
|
||||||
if not order in lista_tipos_ordenacao:
|
# if not order in lista_tipos_ordenacao:
|
||||||
order = lista_tipos_ordenacao[1]
|
# order = lista_tipos_ordenacao[1]
|
||||||
api_parameters['order'] = order
|
api_parameters['order'] = order
|
||||||
# per_page
|
# per_page
|
||||||
if not isinstance(per_page, int):
|
if not isinstance(per_page, int):
|
||||||
@ -386,11 +386,11 @@ def coins_list_with_market_data(
|
|||||||
# price_change_percentage
|
# price_change_percentage
|
||||||
if not isinstance(price_change_percentage, str):
|
if not isinstance(price_change_percentage, str):
|
||||||
raise TypeError('\'price_change_percentage\' tem de ser do tipo \'str\'')
|
raise TypeError('\'price_change_percentage\' tem de ser do tipo \'str\'')
|
||||||
for timeframe in price_change_percentage.split(','):
|
# for timeframe in price_change_percentage.split(','):
|
||||||
if not timeframe in lista_timeframe_price_change:
|
# if not timeframe in lista_timeframe_price_change:
|
||||||
price_change_percentage = lista_timeframe_price_change[0]
|
# price_change_percentage = lista_timeframe_price_change[0]
|
||||||
else:
|
# else:
|
||||||
price_change_percentage += f',{timeframe}'
|
# price_change_percentage += f',{timeframe}'
|
||||||
api_parameters['price_change_percentage'] = price_change_percentage
|
api_parameters['price_change_percentage'] = price_change_percentage
|
||||||
# locale
|
# locale
|
||||||
if not isinstance(locale, str):
|
if not isinstance(locale, str):
|
||||||
@ -416,14 +416,14 @@ def coins_list_with_market_data(
|
|||||||
|
|
||||||
|
|
||||||
# debug (decomentar linhas seguintes para testar funcao)
|
# debug (decomentar linhas seguintes para testar funcao)
|
||||||
# url, codigo, dados = coins_list_with_market_data('eur', 'bitcoin')
|
url, codigo, dados = coins_list_with_market_data('eur', 'bitcoin')
|
||||||
# print(f'url: {url}')
|
print(f'url: {url}')
|
||||||
# if codigo == 200:
|
if codigo == 200:
|
||||||
# print(f'codigo: {codigo}')
|
print(f'codigo: {codigo}')
|
||||||
# for item in dados:
|
for item in dados:
|
||||||
# print(item)
|
print(item)
|
||||||
# else:
|
else:
|
||||||
# print(f'erro {codigo}: {dados}')
|
print(f'erro {codigo}: {dados}')
|
||||||
|
|
||||||
|
|
||||||
def coin_data_by_id(
|
def coin_data_by_id(
|
||||||
|
|||||||
Reference in New Issue
Block a user