rgfewfger
This commit is contained in:
Binary file not shown.
BIN
telegram/sign.db
BIN
telegram/sign.db
Binary file not shown.
5
test.py
5
test.py
@@ -44,10 +44,11 @@ def main(sql_info):
|
||||
proxies=proxies,
|
||||
)
|
||||
|
||||
print(response.json()["address"])
|
||||
print(response.json())
|
||||
|
||||
if response.json()["address"] == sql_info.host:
|
||||
sql_info.start = 1
|
||||
sql_info.country = response.json()["country"]
|
||||
sql_info.save()
|
||||
|
||||
break
|
||||
@@ -62,6 +63,6 @@ if __name__ == '__main__':
|
||||
with ThreadPoolExecutor(max_workers=100) as executor:
|
||||
for i in Ips.select():
|
||||
executor.submit(main, i)
|
||||
time.sleep(random.randint(1, 3))
|
||||
time.sleep(random.random())
|
||||
|
||||
# https://x.com/Websea_MY
|
||||
69
test1.py
69
test1.py
@@ -1,68 +1,3 @@
|
||||
import datetime
|
||||
import requests
|
||||
import random
|
||||
|
||||
headers = {
|
||||
'accept': 'application/json, text/plain, */*',
|
||||
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
|
||||
'cache-control': 'no-cache',
|
||||
'dnt': '1',
|
||||
'origin': 'https://www.websea.com',
|
||||
'pragma': 'no-cache',
|
||||
'priority': 'u=1, i',
|
||||
'referer': 'https://www.websea.com/',
|
||||
'sec-ch-ua': '"Chromium";v="142", "Microsoft Edge";v="142", "Not_A Brand";v="99"',
|
||||
'sec-ch-ua-mobile': '?0',
|
||||
'sec-ch-ua-platform': '"Windows"',
|
||||
'sec-fetch-dest': 'empty',
|
||||
'sec-fetch-mode': 'cors',
|
||||
'sec-fetch-site': 'same-site',
|
||||
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36 Edg/142.0.0.0',
|
||||
}
|
||||
|
||||
# # 获取当前日期(UTC)
|
||||
# today = datetime.datetime.now(datetime.timezone.utc).date()
|
||||
#
|
||||
# # 当天开始和结束时间
|
||||
# start_of_day = datetime.datetime.combine(today, datetime.time.min, tzinfo=datetime.timezone.utc)
|
||||
# end_of_day = datetime.datetime.combine(today, datetime.time.max, tzinfo=datetime.timezone.utc)
|
||||
|
||||
# 获取今天日期(本地时间,中国时区 UTC+8)
|
||||
tz = datetime.timezone(datetime.timedelta(hours=8))
|
||||
today = datetime.datetime.now(tz).date()
|
||||
|
||||
# 当天开始时间(北京时间 00:00)
|
||||
start_of_day = datetime.datetime.combine(today, datetime.time.min, tzinfo=tz)
|
||||
# 当天结束时间(北京时间 23:59:59.999999)
|
||||
end_of_day = datetime.datetime.combine(today, datetime.time.max, tzinfo=tz)
|
||||
|
||||
params = {
|
||||
'symbol': 'BTC-USDT',
|
||||
'period': '30min',
|
||||
'start': int(start_of_day.timestamp()),
|
||||
'end': int(end_of_day.timestamp()),
|
||||
}
|
||||
|
||||
response = requests.get('https://eapi.websea.com/webApi/market/getKline', params=params, headers=headers)
|
||||
data = response.json()["result"]["data"]
|
||||
|
||||
if not data:
|
||||
print("没有获取到数据")
|
||||
else:
|
||||
# 当前价格 = 最新一条 K 线的 close
|
||||
current_price = float(data[0]['close'])
|
||||
|
||||
# 当天最高价 = 当天所有 K 线的 high
|
||||
today_high = max(float(item['high']) for item in data)
|
||||
# 当天最低价 = 当天所有 K 线的 low
|
||||
today_low = min(float(item['low']) for item in data)
|
||||
|
||||
# 24 小时涨幅计算(用最新一条 close 与 24 小时前的价格对比)
|
||||
# 如果接口只能获取当天数据,可能不足 24 小时,可根据需求扩展
|
||||
# 假设获取过去 24 小时数据,使用第一条 K 线的 open 作为 24 小时前价格
|
||||
price_24h_ago = float(data[-1]['open'])
|
||||
change_24h = (current_price - price_24h_ago) / price_24h_ago * 100
|
||||
|
||||
print(f"当前价格: {current_price}")
|
||||
print(f"24小时涨幅: {change_24h:.2f}%")
|
||||
print(f"当天最高价: {today_high}")
|
||||
print(f"当天最低价: {today_low}")
|
||||
print(random.random())
|
||||
Reference in New Issue
Block a user