kaq-quant-common 0.2.8__py3-none-any.whl → 0.2.10__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.
@@ -68,7 +68,16 @@ class FundingRateHelper:
68
68
  for symbol, (data, arg) in to_process:
69
69
  sub_data = self._build_data(symbol, data, arg)
70
70
 
71
+ if sub_data is None:
72
+ continue
73
+
74
+ if len(sub_data) == 0:
75
+ continue
76
+
71
77
  if not self._isMtwDdb:
78
+ # 可以是数组,可以是dataFrame
79
+ is_df = type(sub_data) is pd.DataFrame
80
+
72
81
  if is_df:
73
82
  # df就用df的方式写入
74
83
  # data_first_now = int(sub_data["create_time"].iloc[0])
@@ -82,21 +91,30 @@ class FundingRateHelper:
82
91
  df = pd.concat([df, sub_data], ignore_index=True)
83
92
  else:
84
93
  # 数组就用数组的方式写入
85
- # data_first_now = int(sub_data[0])
86
- # if now - data_first_now > 2000:
87
- # self._logger.warning(f"数据时间{data_first_now} 与当前时间{now} 差值{now - data_first_now} 超过2000ms")
88
- # pass
89
-
90
- list_data.append(sub_data)
94
+ # 子元素是否数组
95
+ is_sub_list = type(sub_data) is list
96
+ if is_sub_list:
97
+ # 多条数据
98
+ # data_first_now = int(sub_data[0][0])
99
+ # if now - data_first_now > 2000:
100
+ # self._logger.debug(f"数据时间{data_first_now} 与当前时间{now} 差值{now - data_first_now} 超过2000ms")
101
+ # pass
102
+ list_data.extend(sub_data)
103
+ else:
104
+ # 单条数据
105
+ # data_first_now = int(sub_data[0])
106
+ # if now - data_first_now > 2000:
107
+ # self._logger.debug(f"数据时间{data_first_now} 与当前时间{now} 差值{now - data_first_now} 超过2000ms")
108
+ # pass
109
+ list_data.append(sub_data)
91
110
  else:
92
- # 只能是数组
93
- if len(sub_data) > 0:
94
- # 直接调用 save2stream_list 写入
95
- try:
96
- self._ddb.save2stream_list(sub_data)
97
- except Exception as e:
98
- # 避免刷库异常导致线程退出
99
- self._logger.error(f"批量写入数组失败: {e}")
111
+ # 直接调用 save2stream_list 写入
112
+ try:
113
+ self._ddb.save2stream_list(sub_data)
114
+ except Exception as e:
115
+ # 避免刷库异常导致线程退出
116
+ self._logger.error(f"批量写入数组失败: {e}")
117
+
100
118
 
101
119
  # 入库
102
120
  if not self._isMtwDdb:
@@ -70,6 +70,12 @@ class LimitOrderHelper:
70
70
  for symbol, (data, arg) in to_process:
71
71
  sub_data = self._build_data(symbol, data, arg)
72
72
 
73
+ if sub_data is None:
74
+ continue
75
+
76
+ if len(sub_data) == 0:
77
+ continue
78
+
73
79
  if not self._isMtwDdb:
74
80
  # 可以是数组,可以是dataFrame
75
81
  is_df = type(sub_data) is pd.DataFrame
@@ -87,21 +93,30 @@ class LimitOrderHelper:
87
93
  df = pd.concat([df, sub_data], ignore_index=True)
88
94
  else:
89
95
  # 数组就用数组的方式写入
90
- data_first_now = int(sub_data[0])
91
- if now - data_first_now > 2000:
92
- self._logger.debug(f"数据时间{data_first_now} 与当前时间{now} 差值{now - data_first_now} 超过2000ms")
93
- pass
96
+ # 子元素是否数组
97
+ is_sub_list = type(sub_data[0]) is list
98
+ if is_sub_list:
99
+ # 多条数据
100
+ data_first_now = int(sub_data[0][0])
101
+ if now - data_first_now > 2000:
102
+ self._logger.debug(f"数据时间{data_first_now} 与当前时间{now} 差值{now - data_first_now} 超过2000ms")
103
+ pass
104
+ list_data.extend(sub_data)
105
+ else:
106
+ # 单条数据
107
+ data_first_now = int(sub_data[0])
108
+ if now - data_first_now > 2000:
109
+ self._logger.debug(f"数据时间{data_first_now} 与当前时间{now} 差值{now - data_first_now} 超过2000ms")
110
+ pass
111
+ list_data.append(sub_data)
94
112
 
95
- list_data.append(sub_data)
96
113
  else:
97
- # 只能是数组
98
- if len(sub_data) > 0:
99
- # 直接调用 save2stream_list 写入
100
- try:
101
- self._ddb.save2stream_list(sub_data)
102
- except Exception as e:
103
- # 避免刷库异常导致线程退出
104
- self._logger.error(f"批量写入数组失败: {e}")
114
+ # 直接调用 save2stream_list 写入
115
+ try:
116
+ self._ddb.save2stream_list(sub_data)
117
+ except Exception as e:
118
+ # 避免刷库异常导致线程退出
119
+ self._logger.error(f"批量写入数组失败: {e}")
105
120
 
106
121
  convert_time = int(datetime.datetime.now().timestamp() * 1000)
107
122
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kaq_quant_common
3
- Version: 0.2.8
3
+ Version: 0.2.10
4
4
  Summary:
5
5
  Author: kevinfuture
6
6
  Author-email: liuenbofuture@foxmail.com
@@ -27,8 +27,8 @@ kaq_quant_common/api/ws/ws_server_base.py,sha256=-JFA5fnYHXPYBZ09aZmhYuhgDHFfJbk
27
27
  kaq_quant_common/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  kaq_quant_common/common/ddb_table_monitor.py,sha256=7Yihz_uGGujo_QqqPl45Gp8fwUMMw1auXx5egbzyYlE,3662
29
29
  kaq_quant_common/common/http_monitor.py,sha256=_yChiwfVv1c5g_lKgYUjWY40fX61BWVK8SL4kXwRfwk,2375
30
- kaq_quant_common/common/modules/funding_rate_helper.py,sha256=jSlokGh2wYYOOTj83FrUeyrcngU-lgpjvK0FawFCxdo,4840
31
- kaq_quant_common/common/modules/limit_order_helper.py,sha256=3JHLP72RxmNiKNk8lC8nRb9yIDK2nhR-xbdXFTNCyrU,6044
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=tRjAcSaCwcxbBVP-0Lncr01Kmo8NIi6Zpogub1zKAS0,6780
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
34
  kaq_quant_common/common/monitor_base.py,sha256=E4EUMsO3adNltCDNRgxkvUSbTTfKOL9S1zzN3WkZvpU,2467
@@ -62,6 +62,6 @@ kaq_quant_common/utils/signal_utils.py,sha256=zBSyEltNTKqkQCsrETd47kEBb3Q_OWUBUn
62
62
  kaq_quant_common/utils/sqlite_utils.py,sha256=UDDFKfwL0N-jFifl40HdyOCENh2YQfW5so6hRaSJpv0,5722
63
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.8.dist-info/METADATA,sha256=Vpw8yaybO3loNes1UmtfsmT0saExZ9EJQjN_nhlKhTY,1970
66
- kaq_quant_common-0.2.8.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
67
- kaq_quant_common-0.2.8.dist-info/RECORD,,
65
+ kaq_quant_common-0.2.10.dist-info/METADATA,sha256=z5p-WdYZLYHuQsfsewfWAxjf4UKIwxlGCnjsCJZR0ss,1971
66
+ kaq_quant_common-0.2.10.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
67
+ kaq_quant_common-0.2.10.dist-info/RECORD,,