hyperquant 0.24__py3-none-any.whl → 0.25__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
hyperquant/notikit.py
CHANGED
@@ -11,9 +11,10 @@ author: 邢不行
|
|
11
11
|
import base64
|
12
12
|
import hashlib
|
13
13
|
import os.path
|
14
|
-
import requests
|
15
14
|
import json
|
16
15
|
import traceback
|
16
|
+
import aiohttp
|
17
|
+
import asyncio
|
17
18
|
from datetime import datetime
|
18
19
|
|
19
20
|
from hyperquant.logkit import get_logger
|
@@ -31,13 +32,14 @@ def handle_exception(e: Exception, msg: str = '') -> None:
|
|
31
32
|
|
32
33
|
|
33
34
|
# 企业微信通知
|
34
|
-
def send_wecom_msg(content, webhook_url):
|
35
|
+
async def send_wecom_msg(content: str, webhook_url: str) -> None:
|
35
36
|
if not webhook_url:
|
36
37
|
logger.warning('未配置wecom_webhook_url,不发送信息')
|
37
38
|
return
|
38
39
|
if not content:
|
39
40
|
logger.warning('未配置content,不发送信息')
|
40
41
|
return
|
42
|
+
|
41
43
|
try:
|
42
44
|
data = {
|
43
45
|
"msgtype": "text",
|
@@ -45,9 +47,17 @@ def send_wecom_msg(content, webhook_url):
|
|
45
47
|
"content": content + '\n' + datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
46
48
|
}
|
47
49
|
}
|
48
|
-
|
49
|
-
|
50
|
-
|
50
|
+
|
51
|
+
async with aiohttp.ClientSession() as session:
|
52
|
+
async with session.post(
|
53
|
+
webhook_url,
|
54
|
+
json=data,
|
55
|
+
proxy=proxy.get('http') if proxy else None,
|
56
|
+
timeout=aiohttp.ClientTimeout(total=10)
|
57
|
+
) as response:
|
58
|
+
result = await response.text()
|
59
|
+
logger.info(f'调用企业微信接口返回: {result}')
|
60
|
+
logger.ok('成功发送企业微信')
|
51
61
|
except Exception as e:
|
52
62
|
handle_exception(e, '发送企业微信失败')
|
53
63
|
|
@@ -66,7 +76,7 @@ class MyEncoder(json.JSONEncoder):
|
|
66
76
|
|
67
77
|
|
68
78
|
# 企业微信发送图片
|
69
|
-
def send_wecom_img(file_path, webhook_url):
|
79
|
+
async def send_wecom_img(file_path: str, webhook_url: str) -> None:
|
70
80
|
"""
|
71
81
|
企业微信发送图片
|
72
82
|
:param file_path: 图片地址
|
@@ -79,13 +89,16 @@ def send_wecom_img(file_path, webhook_url):
|
|
79
89
|
if not webhook_url:
|
80
90
|
logger.warning('未配置wecom_webhook_url,不发送信息')
|
81
91
|
return
|
92
|
+
|
82
93
|
try:
|
83
94
|
with open(file_path, 'rb') as f:
|
84
95
|
image_content = f.read()
|
96
|
+
|
85
97
|
image_base64 = base64.b64encode(image_content).decode('utf-8')
|
86
98
|
md5 = hashlib.md5()
|
87
99
|
md5.update(image_content)
|
88
100
|
image_md5 = md5.hexdigest()
|
101
|
+
|
89
102
|
data = {
|
90
103
|
'msgtype': 'image',
|
91
104
|
'image': {
|
@@ -93,10 +106,17 @@ def send_wecom_img(file_path, webhook_url):
|
|
93
106
|
'md5': image_md5
|
94
107
|
}
|
95
108
|
}
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
109
|
+
|
110
|
+
async with aiohttp.ClientSession() as session:
|
111
|
+
async with session.post(
|
112
|
+
webhook_url,
|
113
|
+
json=data,
|
114
|
+
proxy=proxy.get('http') if proxy else None,
|
115
|
+
timeout=aiohttp.ClientTimeout(total=10)
|
116
|
+
) as response:
|
117
|
+
result = await response.text()
|
118
|
+
logger.info(f'调用企业微信接口返回: {result}')
|
119
|
+
logger.ok('成功发送企业微信图片')
|
100
120
|
except Exception as e:
|
101
121
|
handle_exception(e, '发送企业微信图片失败')
|
102
122
|
finally:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: hyperquant
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.25
|
4
4
|
Summary: A minimal yet hyper-efficient backtesting framework for quantitative trading
|
5
5
|
Project-URL: Homepage, https://github.com/yourusername/hyperquant
|
6
6
|
Project-URL: Issues, https://github.com/yourusername/hyperquant/issues
|
@@ -3,7 +3,7 @@ hyperquant/core.py,sha256=vKv8KElo1eGhr_aw0I-j6ZxPOneDx86KqAoOI-wbq0A,18838
|
|
3
3
|
hyperquant/db.py,sha256=i2TjkCbmH4Uxo7UTDvOYBfy973gLcGexdzuT_YcSeIE,6678
|
4
4
|
hyperquant/draw.py,sha256=up_lQ3pHeVLoNOyh9vPjgNwjD0M-6_IetSGviQUgjhY,54624
|
5
5
|
hyperquant/logkit.py,sha256=WALpXpIA3Ywr5DxKKK3k5EKubZ2h-ISGfc5dUReQUBQ,7795
|
6
|
-
hyperquant/notikit.py,sha256=
|
6
|
+
hyperquant/notikit.py,sha256=x5yAZ_tAvLQRXcRbcg-VabCaN45LUhvlTZnUqkIqfAA,3596
|
7
7
|
hyperquant/broker/hyperliquid.py,sha256=mSBVfmjcv6ciI1vWrmHYwBOTHrg-NQrwcyVFUXYEgVw,21998
|
8
8
|
hyperquant/broker/lib/hpstore.py,sha256=LnLK2zmnwVvhEbLzYI-jz_SfYpO1Dv2u2cJaRAb84D8,8296
|
9
9
|
hyperquant/broker/lib/hyper_types.py,sha256=HqjjzjUekldjEeVn6hxiWA8nevAViC2xHADOzDz9qyw,991
|
@@ -11,6 +11,6 @@ hyperquant/datavison/_util.py,sha256=92qk4vO856RqycO0YqEIHJlEg-W9XKapDVqAMxe6rbw
|
|
11
11
|
hyperquant/datavison/binance.py,sha256=3yNKTqvt_vUQcxzeX4ocMsI5k6Q6gLZrvgXxAEad6Kc,5001
|
12
12
|
hyperquant/datavison/coinglass.py,sha256=PEjdjISP9QUKD_xzXNzhJ9WFDTlkBrRQlVL-5pxD5mo,10482
|
13
13
|
hyperquant/datavison/okx.py,sha256=yg8WrdQ7wgWHNAInIgsWPM47N3Wkfr253169IPAycAY,6898
|
14
|
-
hyperquant-0.
|
15
|
-
hyperquant-0.
|
16
|
-
hyperquant-0.
|
14
|
+
hyperquant-0.25.dist-info/METADATA,sha256=re5JjxsJCj3BOunjieCHlp7c_fOuyaHZVZc8RDrCNKw,4317
|
15
|
+
hyperquant-0.25.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
16
|
+
hyperquant-0.25.dist-info/RECORD,,
|
File without changes
|