kaq-quant-common 0.2.9__py3-none-any.whl → 0.2.11__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.
- kaq_quant_common/api/common/__init__.py +1 -1
- kaq_quant_common/api/common/api_interface.py +38 -38
- kaq_quant_common/api/rest/api_client_base.py +42 -42
- kaq_quant_common/api/rest/instruction/helper/order_helper.py +342 -342
- kaq_quant_common/api/rest/instruction/models/__init__.py +17 -17
- kaq_quant_common/api/rest/instruction/models/transfer.py +32 -32
- kaq_quant_common/api/ws/exchange/models.py +23 -23
- kaq_quant_common/api/ws/exchange/ws_exchange_server.py +440 -440
- kaq_quant_common/common/ddb_table_monitor.py +106 -106
- kaq_quant_common/common/http_monitor.py +69 -69
- kaq_quant_common/common/modules/funding_rate_helper.py +30 -15
- kaq_quant_common/common/modules/limit_order_helper.py +35 -20
- kaq_quant_common/common/monitor_base.py +84 -84
- kaq_quant_common/common/monitor_group.py +97 -97
- kaq_quant_common/common/ws_wrapper.py +21 -21
- kaq_quant_common/utils/logger_utils.py +5 -5
- kaq_quant_common/utils/signal_utils.py +23 -23
- kaq_quant_common/utils/uuid_utils.py +5 -5
- {kaq_quant_common-0.2.9.dist-info → kaq_quant_common-0.2.11.dist-info}/METADATA +1 -1
- {kaq_quant_common-0.2.9.dist-info → kaq_quant_common-0.2.11.dist-info}/RECORD +21 -21
- {kaq_quant_common-0.2.9.dist-info → kaq_quant_common-0.2.11.dist-info}/WHEEL +1 -1
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import threading
|
|
2
|
-
import time
|
|
3
|
-
from abc import ABC, abstractmethod
|
|
4
|
-
|
|
5
|
-
from kaq_quant_common.utils import logger_utils, signal_utils
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
# 通用的抽象类
|
|
9
|
-
class MonitorBase(ABC):
|
|
10
|
-
def __init__(self):
|
|
11
|
-
# 初始化
|
|
12
|
-
self.init()
|
|
13
|
-
# 用来标记最后一次收到数据的时间,超过指定时间没有收到数据,认为连接断开
|
|
14
|
-
self._keep_alive_deadline = 0
|
|
15
|
-
|
|
16
|
-
# 初始化
|
|
17
|
-
def init(self):
|
|
18
|
-
# 执行初始化
|
|
19
|
-
self._do_init()
|
|
20
|
-
|
|
21
|
-
@abstractmethod
|
|
22
|
-
def _do_init(self):
|
|
23
|
-
pass
|
|
24
|
-
|
|
25
|
-
# 开始,需要确保这个方法在op线程执行,执行这个方法会阻塞当前线程!
|
|
26
|
-
def start(self, block=True):
|
|
27
|
-
# 全局退出事件,用于传递终止信号
|
|
28
|
-
exit_event = threading.Event()
|
|
29
|
-
self._exit_event = exit_event
|
|
30
|
-
|
|
31
|
-
logger = logger_utils.get_logger(self)
|
|
32
|
-
|
|
33
|
-
#
|
|
34
|
-
def handle_terminate_signal(signum, frame=None):
|
|
35
|
-
"""信号处理函数:捕获终止信号并触发退出事件"""
|
|
36
|
-
logger.info(f"收到终止信号 {signum}")
|
|
37
|
-
exit_event.set()
|
|
38
|
-
# 优雅地停止
|
|
39
|
-
try:
|
|
40
|
-
self.stop()
|
|
41
|
-
except Exception as e:
|
|
42
|
-
pass
|
|
43
|
-
|
|
44
|
-
signal_utils.register_signal_handler(handle_terminate_signal)
|
|
45
|
-
|
|
46
|
-
self._do_start()
|
|
47
|
-
|
|
48
|
-
# 需要阻塞
|
|
49
|
-
if block:
|
|
50
|
-
# 监听退出事件
|
|
51
|
-
while not exit_event.is_set():
|
|
52
|
-
time.sleep(1)
|
|
53
|
-
if self._check_exit():
|
|
54
|
-
# 假装发送信号
|
|
55
|
-
handle_terminate_signal("exit")
|
|
56
|
-
if self._keep_alive_deadline > 0 and time.time() > self._keep_alive_deadline:
|
|
57
|
-
logger.warning("MonitorBase 收据接收超时,需要停止 MonitorBase")
|
|
58
|
-
# 假装发送信号
|
|
59
|
-
handle_terminate_signal("recv time out")
|
|
60
|
-
|
|
61
|
-
logger.warning("MonitorBase 线程退出")
|
|
62
|
-
|
|
63
|
-
# 子类实现,判断连接是否断开,断开返回True
|
|
64
|
-
def _check_exit(self):
|
|
65
|
-
return False
|
|
66
|
-
|
|
67
|
-
@abstractmethod
|
|
68
|
-
def _do_start(self):
|
|
69
|
-
pass
|
|
70
|
-
|
|
71
|
-
# 停止
|
|
72
|
-
def stop(self):
|
|
73
|
-
self._do_stop()
|
|
74
|
-
|
|
75
|
-
@abstractmethod
|
|
76
|
-
def _do_stop(self):
|
|
77
|
-
pass
|
|
78
|
-
|
|
79
|
-
def keep_alive(self, deadline: int = 60):
|
|
80
|
-
"""
|
|
81
|
-
保持连接alive,超过指定时间不活跃,认为需要停止
|
|
82
|
-
"""
|
|
83
|
-
cur_time = time.time()
|
|
84
|
-
self._keep_alive_deadline = cur_time + deadline
|
|
1
|
+
import threading
|
|
2
|
+
import time
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
|
|
5
|
+
from kaq_quant_common.utils import logger_utils, signal_utils
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# 通用的抽象类
|
|
9
|
+
class MonitorBase(ABC):
|
|
10
|
+
def __init__(self):
|
|
11
|
+
# 初始化
|
|
12
|
+
self.init()
|
|
13
|
+
# 用来标记最后一次收到数据的时间,超过指定时间没有收到数据,认为连接断开
|
|
14
|
+
self._keep_alive_deadline = 0
|
|
15
|
+
|
|
16
|
+
# 初始化
|
|
17
|
+
def init(self):
|
|
18
|
+
# 执行初始化
|
|
19
|
+
self._do_init()
|
|
20
|
+
|
|
21
|
+
@abstractmethod
|
|
22
|
+
def _do_init(self):
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
# 开始,需要确保这个方法在op线程执行,执行这个方法会阻塞当前线程!
|
|
26
|
+
def start(self, block=True):
|
|
27
|
+
# 全局退出事件,用于传递终止信号
|
|
28
|
+
exit_event = threading.Event()
|
|
29
|
+
self._exit_event = exit_event
|
|
30
|
+
|
|
31
|
+
logger = logger_utils.get_logger(self)
|
|
32
|
+
|
|
33
|
+
#
|
|
34
|
+
def handle_terminate_signal(signum, frame=None):
|
|
35
|
+
"""信号处理函数:捕获终止信号并触发退出事件"""
|
|
36
|
+
logger.info(f"收到终止信号 {signum}")
|
|
37
|
+
exit_event.set()
|
|
38
|
+
# 优雅地停止
|
|
39
|
+
try:
|
|
40
|
+
self.stop()
|
|
41
|
+
except Exception as e:
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
signal_utils.register_signal_handler(handle_terminate_signal)
|
|
45
|
+
|
|
46
|
+
self._do_start()
|
|
47
|
+
|
|
48
|
+
# 需要阻塞
|
|
49
|
+
if block:
|
|
50
|
+
# 监听退出事件
|
|
51
|
+
while not exit_event.is_set():
|
|
52
|
+
time.sleep(1)
|
|
53
|
+
if self._check_exit():
|
|
54
|
+
# 假装发送信号
|
|
55
|
+
handle_terminate_signal("exit")
|
|
56
|
+
if self._keep_alive_deadline > 0 and time.time() > self._keep_alive_deadline:
|
|
57
|
+
logger.warning("MonitorBase 收据接收超时,需要停止 MonitorBase")
|
|
58
|
+
# 假装发送信号
|
|
59
|
+
handle_terminate_signal("recv time out")
|
|
60
|
+
|
|
61
|
+
logger.warning("MonitorBase 线程退出")
|
|
62
|
+
|
|
63
|
+
# 子类实现,判断连接是否断开,断开返回True
|
|
64
|
+
def _check_exit(self):
|
|
65
|
+
return False
|
|
66
|
+
|
|
67
|
+
@abstractmethod
|
|
68
|
+
def _do_start(self):
|
|
69
|
+
pass
|
|
70
|
+
|
|
71
|
+
# 停止
|
|
72
|
+
def stop(self):
|
|
73
|
+
self._do_stop()
|
|
74
|
+
|
|
75
|
+
@abstractmethod
|
|
76
|
+
def _do_stop(self):
|
|
77
|
+
pass
|
|
78
|
+
|
|
79
|
+
def keep_alive(self, deadline: int = 60):
|
|
80
|
+
"""
|
|
81
|
+
保持连接alive,超过指定时间不活跃,认为需要停止
|
|
82
|
+
"""
|
|
83
|
+
cur_time = time.time()
|
|
84
|
+
self._keep_alive_deadline = cur_time + deadline
|
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
import threading
|
|
2
|
-
import time
|
|
3
|
-
|
|
4
|
-
from kaq_quant_common.common.monitor_base import MonitorBase
|
|
5
|
-
from kaq_quant_common.utils import logger_utils, signal_utils
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class MonitorGroup:
|
|
9
|
-
|
|
10
|
-
def __init__(self):
|
|
11
|
-
#
|
|
12
|
-
self._monitors: list[MonitorBase] = []
|
|
13
|
-
self._logger = logger_utils.get_logger(self)
|
|
14
|
-
|
|
15
|
-
def get_monitors(self) -> list[MonitorBase]:
|
|
16
|
-
return self._monitors
|
|
17
|
-
|
|
18
|
-
# 开始,需要确保这个方法在op线程执行,执行这个方法会阻塞当前线程!
|
|
19
|
-
def start(self, block=True):
|
|
20
|
-
# 全局退出事件,用于传递终止信号
|
|
21
|
-
exit_event = threading.Event()
|
|
22
|
-
self._exit_event = exit_event
|
|
23
|
-
|
|
24
|
-
logger = self._logger
|
|
25
|
-
|
|
26
|
-
#
|
|
27
|
-
def handle_terminate_signal(signum, frame=None):
|
|
28
|
-
"""信号处理函数:捕获终止信号并触发退出事件"""
|
|
29
|
-
logger.info(f"收到终止信号 {signum}")
|
|
30
|
-
exit_event.set()
|
|
31
|
-
# 优雅地停止
|
|
32
|
-
try:
|
|
33
|
-
self.stop()
|
|
34
|
-
except Exception as e:
|
|
35
|
-
pass
|
|
36
|
-
|
|
37
|
-
signal_utils.register_signal_handler(handle_terminate_signal)
|
|
38
|
-
|
|
39
|
-
# 需要阻塞
|
|
40
|
-
if block:
|
|
41
|
-
# 监听退出事件
|
|
42
|
-
while not exit_event.is_set():
|
|
43
|
-
time.sleep(1)
|
|
44
|
-
if self._check_exit():
|
|
45
|
-
# 假装发送信号
|
|
46
|
-
handle_terminate_signal("exit")
|
|
47
|
-
|
|
48
|
-
logger.warning("MonitorGroup 线程退出")
|
|
49
|
-
|
|
50
|
-
# 停止
|
|
51
|
-
def stop(self):
|
|
52
|
-
#
|
|
53
|
-
self.stop_monitors()
|
|
54
|
-
#
|
|
55
|
-
self._exit_event.set()
|
|
56
|
-
|
|
57
|
-
def _check_exit(self):
|
|
58
|
-
# 避免还没有链接monitor
|
|
59
|
-
if len(self._monitors) == 0:
|
|
60
|
-
return False
|
|
61
|
-
|
|
62
|
-
# 标识是否全部都已经退出
|
|
63
|
-
all_exit = True
|
|
64
|
-
one_exit = False
|
|
65
|
-
|
|
66
|
-
# 遍历检测是否全部都退出了
|
|
67
|
-
for monitor in self._monitors:
|
|
68
|
-
if not monitor._check_exit():
|
|
69
|
-
all_exit = False
|
|
70
|
-
else:
|
|
71
|
-
one_exit = True
|
|
72
|
-
|
|
73
|
-
return one_exit
|
|
74
|
-
|
|
75
|
-
# 只停止 monitor
|
|
76
|
-
def stop_monitors(self, clear=False):
|
|
77
|
-
self._logger.info(f"停止 {len(self._monitors)} 个 monitor")
|
|
78
|
-
tmp_monitors = self._monitors.copy()
|
|
79
|
-
if clear:
|
|
80
|
-
# 清空数组
|
|
81
|
-
self._monitors.clear()
|
|
82
|
-
for monitor in tmp_monitors:
|
|
83
|
-
monitor.stop()
|
|
84
|
-
|
|
85
|
-
#
|
|
86
|
-
def link(self, monitors: list[MonitorBase], clear=False):
|
|
87
|
-
# 如果需要clear,先清空之前的
|
|
88
|
-
if clear:
|
|
89
|
-
self.stop_monitors(clear=True)
|
|
90
|
-
self._logger.info(f"开启 {len(monitors)} 个 monitor")
|
|
91
|
-
# 遍历调用start
|
|
92
|
-
for monitor in monitors:
|
|
93
|
-
monitor.start(block=False)
|
|
94
|
-
# 延迟一下,防止同时创建多个连接有问题
|
|
95
|
-
time.sleep(1)
|
|
96
|
-
# 追加新的
|
|
97
|
-
self._monitors.extend(monitors)
|
|
1
|
+
import threading
|
|
2
|
+
import time
|
|
3
|
+
|
|
4
|
+
from kaq_quant_common.common.monitor_base import MonitorBase
|
|
5
|
+
from kaq_quant_common.utils import logger_utils, signal_utils
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class MonitorGroup:
|
|
9
|
+
|
|
10
|
+
def __init__(self):
|
|
11
|
+
#
|
|
12
|
+
self._monitors: list[MonitorBase] = []
|
|
13
|
+
self._logger = logger_utils.get_logger(self)
|
|
14
|
+
|
|
15
|
+
def get_monitors(self) -> list[MonitorBase]:
|
|
16
|
+
return self._monitors
|
|
17
|
+
|
|
18
|
+
# 开始,需要确保这个方法在op线程执行,执行这个方法会阻塞当前线程!
|
|
19
|
+
def start(self, block=True):
|
|
20
|
+
# 全局退出事件,用于传递终止信号
|
|
21
|
+
exit_event = threading.Event()
|
|
22
|
+
self._exit_event = exit_event
|
|
23
|
+
|
|
24
|
+
logger = self._logger
|
|
25
|
+
|
|
26
|
+
#
|
|
27
|
+
def handle_terminate_signal(signum, frame=None):
|
|
28
|
+
"""信号处理函数:捕获终止信号并触发退出事件"""
|
|
29
|
+
logger.info(f"收到终止信号 {signum}")
|
|
30
|
+
exit_event.set()
|
|
31
|
+
# 优雅地停止
|
|
32
|
+
try:
|
|
33
|
+
self.stop()
|
|
34
|
+
except Exception as e:
|
|
35
|
+
pass
|
|
36
|
+
|
|
37
|
+
signal_utils.register_signal_handler(handle_terminate_signal)
|
|
38
|
+
|
|
39
|
+
# 需要阻塞
|
|
40
|
+
if block:
|
|
41
|
+
# 监听退出事件
|
|
42
|
+
while not exit_event.is_set():
|
|
43
|
+
time.sleep(1)
|
|
44
|
+
if self._check_exit():
|
|
45
|
+
# 假装发送信号
|
|
46
|
+
handle_terminate_signal("exit")
|
|
47
|
+
|
|
48
|
+
logger.warning("MonitorGroup 线程退出")
|
|
49
|
+
|
|
50
|
+
# 停止
|
|
51
|
+
def stop(self):
|
|
52
|
+
#
|
|
53
|
+
self.stop_monitors()
|
|
54
|
+
#
|
|
55
|
+
self._exit_event.set()
|
|
56
|
+
|
|
57
|
+
def _check_exit(self):
|
|
58
|
+
# 避免还没有链接monitor
|
|
59
|
+
if len(self._monitors) == 0:
|
|
60
|
+
return False
|
|
61
|
+
|
|
62
|
+
# 标识是否全部都已经退出
|
|
63
|
+
all_exit = True
|
|
64
|
+
one_exit = False
|
|
65
|
+
|
|
66
|
+
# 遍历检测是否全部都退出了
|
|
67
|
+
for monitor in self._monitors:
|
|
68
|
+
if not monitor._check_exit():
|
|
69
|
+
all_exit = False
|
|
70
|
+
else:
|
|
71
|
+
one_exit = True
|
|
72
|
+
|
|
73
|
+
return one_exit
|
|
74
|
+
|
|
75
|
+
# 只停止 monitor
|
|
76
|
+
def stop_monitors(self, clear=False):
|
|
77
|
+
self._logger.info(f"停止 {len(self._monitors)} 个 monitor")
|
|
78
|
+
tmp_monitors = self._monitors.copy()
|
|
79
|
+
if clear:
|
|
80
|
+
# 清空数组
|
|
81
|
+
self._monitors.clear()
|
|
82
|
+
for monitor in tmp_monitors:
|
|
83
|
+
monitor.stop()
|
|
84
|
+
|
|
85
|
+
#
|
|
86
|
+
def link(self, monitors: list[MonitorBase], clear=False):
|
|
87
|
+
# 如果需要clear,先清空之前的
|
|
88
|
+
if clear:
|
|
89
|
+
self.stop_monitors(clear=True)
|
|
90
|
+
self._logger.info(f"开启 {len(monitors)} 个 monitor")
|
|
91
|
+
# 遍历调用start
|
|
92
|
+
for monitor in monitors:
|
|
93
|
+
monitor.start(block=False)
|
|
94
|
+
# 延迟一下,防止同时创建多个连接有问题
|
|
95
|
+
time.sleep(1)
|
|
96
|
+
# 追加新的
|
|
97
|
+
self._monitors.extend(monitors)
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
from abc import abstractmethod
|
|
2
|
-
|
|
3
|
-
from kaq_quant_common.common.monitor_base import MonitorBase
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
# 通用的抽象类,包装一层ws操作
|
|
7
|
-
class WsWrapper(MonitorBase):
|
|
8
|
-
def __init__(self):
|
|
9
|
-
super().__init__()
|
|
10
|
-
|
|
11
|
-
# stop 就是调用close,ws 更好理解
|
|
12
|
-
def _do_stop(self):
|
|
13
|
-
self._do_close()
|
|
14
|
-
|
|
15
|
-
# 断开连接,主动关闭
|
|
16
|
-
def close(self):
|
|
17
|
-
self.stop()
|
|
18
|
-
|
|
19
|
-
@abstractmethod
|
|
20
|
-
def _do_close(self):
|
|
21
|
-
pass
|
|
1
|
+
from abc import abstractmethod
|
|
2
|
+
|
|
3
|
+
from kaq_quant_common.common.monitor_base import MonitorBase
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# 通用的抽象类,包装一层ws操作
|
|
7
|
+
class WsWrapper(MonitorBase):
|
|
8
|
+
def __init__(self):
|
|
9
|
+
super().__init__()
|
|
10
|
+
|
|
11
|
+
# stop 就是调用close,ws 更好理解
|
|
12
|
+
def _do_stop(self):
|
|
13
|
+
self._do_close()
|
|
14
|
+
|
|
15
|
+
# 断开连接,主动关闭
|
|
16
|
+
def close(self):
|
|
17
|
+
self.stop()
|
|
18
|
+
|
|
19
|
+
@abstractmethod
|
|
20
|
+
def _do_close(self):
|
|
21
|
+
pass
|
|
@@ -13,7 +13,7 @@ logger.add(
|
|
|
13
13
|
# 输出到标准输出(控制台)
|
|
14
14
|
sink=sys.stdout,
|
|
15
15
|
# TODO 配置
|
|
16
|
-
level="
|
|
16
|
+
level="INFO",
|
|
17
17
|
#
|
|
18
18
|
# format="{time} {level} [{extra[module]}] {message}", # 显示绑定的module
|
|
19
19
|
format=(
|
|
@@ -36,9 +36,9 @@ def _is_dagster_env():
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
def get_logger(obj: Union[str, object] = None):
|
|
39
|
-
|
|
39
|
+
'''
|
|
40
40
|
获取logger
|
|
41
|
-
|
|
41
|
+
'''
|
|
42
42
|
|
|
43
43
|
is_dagster_env = _is_dagster_env()
|
|
44
44
|
|
|
@@ -46,9 +46,9 @@ def get_logger(obj: Union[str, object] = None):
|
|
|
46
46
|
if isinstance(obj, str):
|
|
47
47
|
# do nothing
|
|
48
48
|
name = obj
|
|
49
|
-
elif hasattr(obj,
|
|
49
|
+
elif hasattr(obj, '__class__'):
|
|
50
50
|
name = obj.__class__.__name__
|
|
51
|
-
elif hasattr(obj,
|
|
51
|
+
elif hasattr(obj, '__name__'):
|
|
52
52
|
name = obj.__name__
|
|
53
53
|
else:
|
|
54
54
|
name = ""
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import signal
|
|
2
|
-
import sys
|
|
3
|
-
|
|
4
|
-
# 1. 为目标信号(例如 SIGINT,即 Ctrl+C 触发)维护一个处理函数列表
|
|
5
|
-
signal_handlers = []
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
# 2. 定义「总处理函数」:触发时依次执行列表中的所有处理逻辑
|
|
9
|
-
def total_handler(signalnum, frame):
|
|
10
|
-
# 依次调用所有注册的处理函数
|
|
11
|
-
for handler in signal_handlers:
|
|
12
|
-
handler(signalnum, frame)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
# 3. 注册「总处理函数」到目标信号(例如 SIGINT)
|
|
16
|
-
# SIGTERM:Dagster通常发送此信号进行终止
|
|
17
|
-
# SIGINT:对应Ctrl+C,用于本地测试
|
|
18
|
-
signal.signal(signal.SIGTERM, total_handler)
|
|
19
|
-
signal.signal(signal.SIGINT, total_handler)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def register_signal_handler(handler):
|
|
23
|
-
signal_handlers.append(handler)
|
|
1
|
+
import signal
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
# 1. 为目标信号(例如 SIGINT,即 Ctrl+C 触发)维护一个处理函数列表
|
|
5
|
+
signal_handlers = []
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# 2. 定义「总处理函数」:触发时依次执行列表中的所有处理逻辑
|
|
9
|
+
def total_handler(signalnum, frame):
|
|
10
|
+
# 依次调用所有注册的处理函数
|
|
11
|
+
for handler in signal_handlers:
|
|
12
|
+
handler(signalnum, frame)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# 3. 注册「总处理函数」到目标信号(例如 SIGINT)
|
|
16
|
+
# SIGTERM:Dagster通常发送此信号进行终止
|
|
17
|
+
# SIGINT:对应Ctrl+C,用于本地测试
|
|
18
|
+
signal.signal(signal.SIGTERM, total_handler)
|
|
19
|
+
signal.signal(signal.SIGINT, total_handler)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def register_signal_handler(handler):
|
|
23
|
+
signal_handlers.append(handler)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import uuid
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def generate_uuid() -> str:
|
|
5
|
-
return str(uuid.uuid4())
|
|
1
|
+
import uuid
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def generate_uuid() -> str:
|
|
5
|
+
return str(uuid.uuid4())
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
kaq_quant_common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
kaq_quant_common/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
kaq_quant_common/api/common/__init__.py,sha256=
|
|
4
|
-
kaq_quant_common/api/common/api_interface.py,sha256=
|
|
3
|
+
kaq_quant_common/api/common/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
4
|
+
kaq_quant_common/api/common/api_interface.py,sha256=E59C2Gh51wmy9NpD9y_SnCh_J-ZbZhT7rUsaORWzXHI,962
|
|
5
5
|
kaq_quant_common/api/common/auth.py,sha256=XqirJRL4D01YfSrBY4hyugw-Op6OJveNE--AnaqhYTQ,3987
|
|
6
6
|
kaq_quant_common/api/rest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
kaq_quant_common/api/rest/api_client_base.py,sha256
|
|
7
|
+
kaq_quant_common/api/rest/api_client_base.py,sha256=LYpqjjVGbVRVyP8qdmlgMelUtEY-jGA0JlMJy9d1r4w,1673
|
|
8
8
|
kaq_quant_common/api/rest/api_server_base.py,sha256=URrvzerHIE6XQLERYFcFH1ftLbCYTz3sENAxFD0HWY0,4653
|
|
9
|
-
kaq_quant_common/api/rest/instruction/helper/order_helper.py,sha256=
|
|
9
|
+
kaq_quant_common/api/rest/instruction/helper/order_helper.py,sha256=eZ-iEZ7HegHYkqpflwKicbdLlp12gcV2wEtBVNLMBiQ,13195
|
|
10
10
|
kaq_quant_common/api/rest/instruction/instruction_client.py,sha256=NwTEypC4eajGq8oWIgvKSbIAO-KMPH4jQ-7J2b9iN4g,4037
|
|
11
11
|
kaq_quant_common/api/rest/instruction/instruction_server_base.py,sha256=pq1wghAlgtm10aWz70-x1OAqtoRH3lBu-HsIuVRHkqY,6223
|
|
12
|
-
kaq_quant_common/api/rest/instruction/models/__init__.py,sha256=
|
|
12
|
+
kaq_quant_common/api/rest/instruction/models/__init__.py,sha256=fx5pnfcf9L5KvAqhsQBZkl9fUf9oABuroLGZqDNycpc,312
|
|
13
13
|
kaq_quant_common/api/rest/instruction/models/account.py,sha256=Lj12EvWNxEt7k9dAKSsFhTJDmLX553duMRa5NroJW30,1375
|
|
14
14
|
kaq_quant_common/api/rest/instruction/models/order.py,sha256=F941DPXlbsklpc8jHLaJ2nQZiUmjPt0zyL_bagijSzI,6847
|
|
15
15
|
kaq_quant_common/api/rest/instruction/models/position.py,sha256=OqtfWWcpGhbijJbwJqERkeFxPiIkzdBnhPx5CfXj8W0,1744
|
|
16
|
-
kaq_quant_common/api/rest/instruction/models/transfer.py,sha256=
|
|
16
|
+
kaq_quant_common/api/rest/instruction/models/transfer.py,sha256=htjk4hb9THUZP4REW5gtyPdo850jHPtHPWFLPA2ERzo,775
|
|
17
17
|
kaq_quant_common/api/ws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
-
kaq_quant_common/api/ws/exchange/models.py,sha256=
|
|
18
|
+
kaq_quant_common/api/ws/exchange/models.py,sha256=RPD5cDRQyISguTjO5Si1V5hJza8Uyr4u2EZEHNFtLb8,664
|
|
19
19
|
kaq_quant_common/api/ws/exchange/ws_exchange_client.py,sha256=Q9ymPcehpUW-lYilBlL7HU4JXkW9jA3kHFYLxnd-pJU,996
|
|
20
|
-
kaq_quant_common/api/ws/exchange/ws_exchange_server.py,sha256=
|
|
20
|
+
kaq_quant_common/api/ws/exchange/ws_exchange_server.py,sha256=z2aJfpx-iHIs7V1PmGFwqZS8t4-I9RiicbQOrfF4d7c,19910
|
|
21
21
|
kaq_quant_common/api/ws/instruction/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
22
|
kaq_quant_common/api/ws/instruction/ws_instruction_client.py,sha256=j8FgMUeuZvz8siknEYoLwElVRgHSX0x29F7dxNWPrsE,3154
|
|
23
23
|
kaq_quant_common/api/ws/instruction/ws_instruction_server_base.py,sha256=zXS0gO8eKkz6sVzY4Ei1RcQhW5_Tb32OQ-g3lbQD_pc,5033
|
|
@@ -25,18 +25,18 @@ kaq_quant_common/api/ws/models.py,sha256=onvZydQBWIoSSTmabZDlLgYCa1TppuCQJb5noO3
|
|
|
25
25
|
kaq_quant_common/api/ws/ws_client_base.py,sha256=QiQnZN3DJUIpP0YDLskx_A5Axu9pdSoQm4slnAQYhUE,9463
|
|
26
26
|
kaq_quant_common/api/ws/ws_server_base.py,sha256=-JFA5fnYHXPYBZ09aZmhYuhgDHFfJbkX-ppnbLfTexY,11574
|
|
27
27
|
kaq_quant_common/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
|
-
kaq_quant_common/common/ddb_table_monitor.py,sha256=
|
|
29
|
-
kaq_quant_common/common/http_monitor.py,sha256=
|
|
30
|
-
kaq_quant_common/common/modules/funding_rate_helper.py,sha256=
|
|
31
|
-
kaq_quant_common/common/modules/limit_order_helper.py,sha256=
|
|
28
|
+
kaq_quant_common/common/ddb_table_monitor.py,sha256=7Yihz_uGGujo_QqqPl45Gp8fwUMMw1auXx5egbzyYlE,3662
|
|
29
|
+
kaq_quant_common/common/http_monitor.py,sha256=_yChiwfVv1c5g_lKgYUjWY40fX61BWVK8SL4kXwRfwk,2375
|
|
30
|
+
kaq_quant_common/common/modules/funding_rate_helper.py,sha256=sW7CacTF2UAz_DigDSEsoPgTKQS-kYUxxjT8Xs70ZV0,5734
|
|
31
|
+
kaq_quant_common/common/modules/limit_order_helper.py,sha256=VWk1NhrQrY-HM3hp_Ri6gpvQjTPlvGN2ahPpNze_nSo,6806
|
|
32
32
|
kaq_quant_common/common/modules/limit_order_symbol_monitor.py,sha256=TBK48qyeCSQvkfDMv3J_0UM7f3OuBRKRFYDcL9kG6Cs,2876
|
|
33
33
|
kaq_quant_common/common/modules/limit_order_symbol_monitor_group.py,sha256=oEqHIwxhqAzckmluHJHZHiHUNmAyaS2JyK2nXO58UhY,2394
|
|
34
|
-
kaq_quant_common/common/monitor_base.py,sha256=
|
|
35
|
-
kaq_quant_common/common/monitor_group.py,sha256=
|
|
34
|
+
kaq_quant_common/common/monitor_base.py,sha256=E4EUMsO3adNltCDNRgxkvUSbTTfKOL9S1zzN3WkZvpU,2467
|
|
35
|
+
kaq_quant_common/common/monitor_group.py,sha256=cNLD-vU6CI8_2u5oV_joxDavK64weaUD0UND1__Hfuo,2862
|
|
36
36
|
kaq_quant_common/common/redis_table_monitor.py,sha256=nckt1-Jq2hU2fBA-OWSRyoSwOCmDZg79u1VRaAI7ArA,4464
|
|
37
37
|
kaq_quant_common/common/statistics/funding_rate_history_statistics.py,sha256=DFEhotfQkv83pzkGghDXb0sSFJo4rYpS2AkVXLANIl0,8533
|
|
38
38
|
kaq_quant_common/common/statistics/kline_history_statistics.py,sha256=pQgWkP7Z0nRUm1FBb3ssy_uHFs4mnYLuTXFkz36PHWk,7839
|
|
39
|
-
kaq_quant_common/common/ws_wrapper.py,sha256=
|
|
39
|
+
kaq_quant_common/common/ws_wrapper.py,sha256=JNJ0CIjDXgCsRjOLSbCi7ysYDHw7tT_aK7V4ADqw3vA,452
|
|
40
40
|
kaq_quant_common/config/config.yaml,sha256=ST_QBLo7kwVaoNOvuN3mpeSF7LPNSWdD7EjxrBYZYBs,230
|
|
41
41
|
kaq_quant_common/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
42
42
|
kaq_quant_common/resources/kaq_ddb_pool_stream_read_resources.py,sha256=q4P96rSrEcWn9ki09UD0vw00iFq_bpgOFTrRzVG7uCA,2537
|
|
@@ -56,12 +56,12 @@ kaq_quant_common/utils/enums_utils.py,sha256=8pswCiVH4rf0vhGduhxgxt4xkNIqkBcJkTF
|
|
|
56
56
|
kaq_quant_common/utils/error_utils.py,sha256=u9jGnfQItSSgCeFJf8_67ud_F_uV_sY5Dh5HcbILJDs,423
|
|
57
57
|
kaq_quant_common/utils/hash_utils.py,sha256=uAiRbiIpPjVLWD-6X0EZtn6_zDkiMDIcjVqEhWn54vU,1672
|
|
58
58
|
kaq_quant_common/utils/log_time_utils.py,sha256=thuCD6j6eu9YUuhBBq2DGkrDpXVh1PvuoUozR1S8q9g,832
|
|
59
|
-
kaq_quant_common/utils/logger_utils.py,sha256=
|
|
59
|
+
kaq_quant_common/utils/logger_utils.py,sha256=uj4Z0QEdm8-BnUdqvWHmg9BT-mhS35KefQhHTi1U9gY,2526
|
|
60
60
|
kaq_quant_common/utils/mytt_utils.py,sha256=gMdxJu_PV140Sxwjtnv5ppf483PPgsudPDlbNRsk_PU,14078
|
|
61
|
-
kaq_quant_common/utils/signal_utils.py,sha256=
|
|
61
|
+
kaq_quant_common/utils/signal_utils.py,sha256=zBSyEltNTKqkQCsrETd47kEBb3Q_OWUBUn2W5wonFyU,711
|
|
62
62
|
kaq_quant_common/utils/sqlite_utils.py,sha256=UDDFKfwL0N-jFifl40HdyOCENh2YQfW5so6hRaSJpv0,5722
|
|
63
|
-
kaq_quant_common/utils/uuid_utils.py,sha256=
|
|
63
|
+
kaq_quant_common/utils/uuid_utils.py,sha256=pm_pnXpd8n9CI66x3A20cOEUiriJyqHaKGCeLrgkBxU,71
|
|
64
64
|
kaq_quant_common/utils/yml_utils.py,sha256=gcKjb_-uuUajBGAl5QBPIZTg2wXm7qeeJvtHflj_zOE,4513
|
|
65
|
-
kaq_quant_common-0.2.
|
|
66
|
-
kaq_quant_common-0.2.
|
|
67
|
-
kaq_quant_common-0.2.
|
|
65
|
+
kaq_quant_common-0.2.11.dist-info/METADATA,sha256=wKGpgoPfYOyaiLVvO5PX1z_GXBvgYdT0E5L7Ij79G-s,1971
|
|
66
|
+
kaq_quant_common-0.2.11.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
67
|
+
kaq_quant_common-0.2.11.dist-info/RECORD,,
|