hyperquant 0.24__tar.gz → 0.25__tar.gz

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.
Files changed (23) hide show
  1. {hyperquant-0.24 → hyperquant-0.25}/PKG-INFO +1 -1
  2. {hyperquant-0.24 → hyperquant-0.25}/pyproject.toml +1 -1
  3. {hyperquant-0.24 → hyperquant-0.25}/src/hyperquant/notikit.py +30 -10
  4. {hyperquant-0.24 → hyperquant-0.25}/uv.lock +1 -1
  5. {hyperquant-0.24 → hyperquant-0.25}/.gitignore +0 -0
  6. {hyperquant-0.24 → hyperquant-0.25}/.python-version +0 -0
  7. {hyperquant-0.24 → hyperquant-0.25}/README.md +0 -0
  8. {hyperquant-0.24 → hyperquant-0.25}/pub.sh +0 -0
  9. {hyperquant-0.24 → hyperquant-0.25}/requirements-dev.lock +0 -0
  10. {hyperquant-0.24 → hyperquant-0.25}/requirements.lock +0 -0
  11. {hyperquant-0.24 → hyperquant-0.25}/src/hyperquant/__init__.py +0 -0
  12. {hyperquant-0.24 → hyperquant-0.25}/src/hyperquant/broker/hyperliquid.py +0 -0
  13. {hyperquant-0.24 → hyperquant-0.25}/src/hyperquant/broker/lib/hpstore.py +0 -0
  14. {hyperquant-0.24 → hyperquant-0.25}/src/hyperquant/broker/lib/hyper_types.py +0 -0
  15. {hyperquant-0.24 → hyperquant-0.25}/src/hyperquant/core.py +0 -0
  16. {hyperquant-0.24 → hyperquant-0.25}/src/hyperquant/datavison/_util.py +0 -0
  17. {hyperquant-0.24 → hyperquant-0.25}/src/hyperquant/datavison/binance.py +0 -0
  18. {hyperquant-0.24 → hyperquant-0.25}/src/hyperquant/datavison/coinglass.py +0 -0
  19. {hyperquant-0.24 → hyperquant-0.25}/src/hyperquant/datavison/okx.py +0 -0
  20. {hyperquant-0.24 → hyperquant-0.25}/src/hyperquant/db.py +0 -0
  21. {hyperquant-0.24 → hyperquant-0.25}/src/hyperquant/draw.py +0 -0
  22. {hyperquant-0.24 → hyperquant-0.25}/src/hyperquant/logkit.py +0 -0
  23. {hyperquant-0.24 → hyperquant-0.25}/test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperquant
3
- Version: 0.24
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hyperquant"
3
- version = "0.24"
3
+ version = "0.25"
4
4
  description = "A minimal yet hyper-efficient backtesting framework for quantitative trading"
5
5
  authors = [
6
6
  { name = "MissinA", email = "1421329142@qq.com" }
@@ -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
- r = requests.post(webhook_url, data=json.dumps(data), timeout=10, proxies=proxy)
49
- logger.info(f'调用企业微信接口返回: {r.text}')
50
- logger.ok('成功发送企业微信')
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
- # 服务器上传bytes图片的时候,json.dumps解析会出错,需要自己手动去转一下
97
- r = requests.post(webhook_url, data=json.dumps(data, cls=MyEncoder, indent=4), timeout=10, proxies=proxy)
98
- logger.info(f'调用企业微信接口返回: {r.text}')
99
- logger.ok('成功发送企业微信图片')
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:
@@ -530,7 +530,7 @@ wheels = [
530
530
 
531
531
  [[package]]
532
532
  name = "hyperquant"
533
- version = "0.23"
533
+ version = "0.24"
534
534
  source = { editable = "." }
535
535
  dependencies = [
536
536
  { name = "aiohttp" },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes