|
|
@@ -40,7 +40,7 @@ def fetch_coin_data(target):
|
|
|
target_data = eval(data['result'][0]['data'])
|
|
|
target_data = target_data[0]
|
|
|
|
|
|
- print(target_data)
|
|
|
+ # print(target_data)
|
|
|
|
|
|
# 获取数据值
|
|
|
name = target_data['name']
|
|
|
@@ -53,16 +53,18 @@ def fetch_coin_data(target):
|
|
|
logoUrl = target_data['logoUrl']
|
|
|
|
|
|
# 拼接到 text 中
|
|
|
- text += f'Name: {name}\n'
|
|
|
- text += f'Ranking: {rank}\n'
|
|
|
- text += f'Price: {price}\n'
|
|
|
- text += f'24H Transaction Volume: {volume}\n'
|
|
|
- text += f'24H Price Change: {change}\n'
|
|
|
- text += f'Market Capitalization: {market_cap}\n'
|
|
|
- text += f'Diluted Market Value: {dilute}\n'
|
|
|
- text += f'Logo: {logoUrl}\n'
|
|
|
+ text = '{} {} {} {} {} {}'.format(name, price, change, volume, rank, market_cap)
|
|
|
+ print(text)
|
|
|
+ # text += f'Name: {name}\n'
|
|
|
+ # text += f'Ranking: {rank}\n'
|
|
|
+ # text += f'Price: {price}\n'
|
|
|
+ # text += f'24H Transaction Volume: {volume}\n'
|
|
|
+ # text += f'24H Price Change: {change}\n'
|
|
|
+ # text += f'Market Capitalization: {market_cap}\n'
|
|
|
+ # text += f'Diluted Market Value: {dilute}\n'
|
|
|
+ # text += f'Logo: {logoUrl}\n'
|
|
|
|
|
|
- return text
|
|
|
+ return text + '\n'
|
|
|
|
|
|
|
|
|
def fetch_vix_data():
|
|
|
@@ -152,7 +154,7 @@ def main():
|
|
|
text = ''
|
|
|
|
|
|
# 获取币币实时价格
|
|
|
- target_list = ['btc', 'eth', 'sol', 'grass', 'sui', 'doge', 'arb', 'ath', 'move', 'pepe']
|
|
|
+ target_list = ['btc', 'eth', 'sol', 'grass', 'sui', 'doge', 'arb', 'ath', 'move', 'pepe', 'degen']
|
|
|
for target in target_list:
|
|
|
for retry in range(1, retry_count + 1):
|
|
|
result = fetch_coin_data(target)
|
|
|
@@ -182,14 +184,14 @@ def main():
|
|
|
text += result + '\n\n'
|
|
|
break
|
|
|
else:
|
|
|
- print(f"Failed to fetch Gas data. retry: {retry}")
|
|
|
+ # print(f"Failed to fetch Gas data. retry: {retry}")
|
|
|
if retry == retry_count:
|
|
|
text += f"Failed to fetch Gas data. retry count: {retry}"
|
|
|
|
|
|
- if text:
|
|
|
- GotifyNotifier('Real-time coin price\n', text, 'AgfOJESqDKftBTQ').send_message()
|
|
|
- else:
|
|
|
- print('No Data')
|
|
|
+ # if text:
|
|
|
+ # GotifyNotifier('Real-time coin price\n', text, 'AgfOJESqDKftBTQ').send_message()
|
|
|
+ # else:
|
|
|
+ # print('No Data')
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|