33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
|
|
import requests
|
|
import setting
|
|
import telegram_sender
|
|
|
|
|
|
# 你的Whale Alert API密钥
|
|
api_key = 'gPkElMPR8Hpe5LxjKisR4YSFzxRxMLj6'
|
|
base_url = 'https://api.whale-alert.io/v1/transactions'
|
|
|
|
def get_large_transactions(min_value=50000000):
|
|
params = {
|
|
'api_key': api_key,
|
|
'min_value': min_value
|
|
}
|
|
response = requests.get(base_url, params=params)
|
|
return response.json()
|
|
|
|
def run():
|
|
transactions = get_large_transactions()
|
|
if transactions and 'transactions' in transactions:
|
|
for ts in transactions['transactions']:
|
|
if ts['to']['owner_type'] == 'exchange':
|
|
amount = int(ts['amount'])
|
|
amount_usd = int(ts['amount_usd'])
|
|
|
|
amount_format = f'{int(amount_usd):,d}'
|
|
amount_usd_format = f'{int(amount_usd):,d}'
|
|
|
|
content = f"🚨大额链上交易提醒🚨\r\n\r\n{amount_format} #{ts['symbol']} (价值: {amount_usd_format} USD) 从 {ts['from']['owner']} 转入 {ts['to']['owner']}"
|
|
|
|
print(content)
|
|
telegram_sender.send_message(setting.chat_id, content) |