fix bug
This commit is contained in:
parent
cb4ac50cbb
commit
639c81e446
@ -17,4 +17,4 @@ oklink_api_headers = {
|
|||||||
|
|
||||||
#whaleAlert
|
#whaleAlert
|
||||||
whaleAlert_apikey='gPkElMPR8Hpe5LxjKisR4YSFzxRxMLj6'
|
whaleAlert_apikey='gPkElMPR8Hpe5LxjKisR4YSFzxRxMLj6'
|
||||||
whaleAlert_max_limit = os.getenv('TQ_WHALEALERT_MAX_USD_AMOUNT',2000 * 20000)
|
whaleAlert_max_limit = os.getenv('TQ_WHALEALERT_MAX_USD_AMOUNT',1000 * 10000)
|
||||||
@ -4,23 +4,31 @@ import settings
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import time
|
import time
|
||||||
import tg
|
import tg
|
||||||
|
import traceback
|
||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def strategy_run():
|
def strategy_run():
|
||||||
# 获取上一分钟的timestamp
|
# 获取上一分钟的timestamp
|
||||||
last_min = datetime.now() - timedelta(minutes=1)
|
last_min = datetime.now() - timedelta(minutes=5)
|
||||||
ts = time.mktime(last_min.timetuple())
|
ts = time.mktime(last_min.timetuple())
|
||||||
|
|
||||||
url = f'https://api.whale-alert.io/v1/transactions?api_key={settings.whaleAlert_apikey}&start={int(ts)}'
|
url = f'https://api.whale-alert.io/v1/transactions?api_key={settings.whaleAlert_apikey}&start={int(ts)}'
|
||||||
resp = requests.get(url).json()
|
resp = requests.get(url).json()
|
||||||
|
print(resp)
|
||||||
|
try:
|
||||||
|
if 'transactions' in resp:
|
||||||
|
data = resp['transactions']
|
||||||
|
|
||||||
data = resp['transactions']
|
for ts in data:
|
||||||
|
usd = int(ts['amount_usd'])
|
||||||
|
if ts['to']['owner_type'] == 'exchange' and usd > settings.whaleAlert_max_limit:
|
||||||
|
from_text = 'unknown wallet'
|
||||||
|
content = f"🚨 {ts['amount']} #{ts['symbol']} ({ts['amount_usd']} USD) 从 {from_text} 转入 #{ts['to']['owner']}"
|
||||||
|
|
||||||
for ts in data:
|
print(content)
|
||||||
usd = int(ts['amount_usd'])
|
tg.send_message(settings.chat_id, content)
|
||||||
if ts['to']['owner_type'] == 'exchange' and ts['from']['owner_type'] == 'unknown' and usd > settings.whaleAlert_max_limit:
|
except Exception as e:
|
||||||
from_text = 'unknown wallet'
|
logging.error(traceback.format_exc())
|
||||||
content = f"🚨 {ts['amount']} #{ts['symbol']} ({ts['amount_usd']} USD) 从 {from_text} 转入 #{ts['to']['owner']}"
|
tg.send_message(settings.chat_id, traceback.format_exc())
|
||||||
|
|
||||||
print(content)
|
|
||||||
tg.send_message(settings.chat_id, content)
|
|
||||||
@ -1,4 +1,9 @@
|
|||||||
import strategy.support_resistance as sr
|
import strategy.support_resistance as sr
|
||||||
|
import strategy.large_trans as lt
|
||||||
|
|
||||||
|
|
||||||
sr.strategy_run('BTCUSDT', '1h')
|
|
||||||
|
lt.strategy_run()
|
||||||
|
|
||||||
|
|
||||||
|
# sr.strategy_run('BTCUSDT', '1h')
|
||||||
Loading…
Reference in New Issue
Block a user