kaq-quant-common 0.2.1__py3-none-any.whl → 0.2.2__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.
@@ -88,6 +88,19 @@ class OrderHelper:
88
88
  redis = self._server._redis
89
89
  if redis is None:
90
90
  return
91
+
92
+ # 先从 redis 读取现有的 position 数据,获取 funding_rate_records 字段
93
+ funding_rate_records = None
94
+ try:
95
+ existing_position_json = redis.client.hget(self._redis_key_position, position_id)
96
+ if existing_position_json:
97
+ existing_position = json.loads(existing_position_json)
98
+ if existing_position and "funding_rate_records" in existing_position:
99
+ funding_rate_records = existing_position.get("funding_rate_records")
100
+ except Exception as e:
101
+ # 读取失败不影响后续流程,记录日志
102
+ self._logger.warning(f"Failed to get funding_rate_records for position {position_id}: {e}")
103
+
91
104
  data = {
92
105
  "id": position_id,
93
106
  "exchange": exchange,
@@ -107,6 +120,11 @@ class OrderHelper:
107
120
  "close_time": close_time,
108
121
  "status": PositionStatus.CLOSE.value,
109
122
  }
123
+
124
+ # 如果存在 funding_rate_records,添加到 data 中
125
+ if funding_rate_records is not None:
126
+ data["funding_rate_records"] = funding_rate_records
127
+
110
128
  redis.client.hdel(self._redis_key_position, position_id)
111
129
  redis.client.rpush(self._redis_key_position_history, json.dumps(data))
112
130
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kaq_quant_common
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary:
5
5
  Author: kevinfuture
6
6
  Author-email: liuenbofuture@foxmail.com
@@ -6,7 +6,7 @@ kaq_quant_common/api/common/auth.py,sha256=XqirJRL4D01YfSrBY4hyugw-Op6OJveNE--An
6
6
  kaq_quant_common/api/rest/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
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=q2opRLHrysvgqoFpAC70WNQpFJsbviHqjRldXj6tiMY,12267
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
12
  kaq_quant_common/api/rest/instruction/models/__init__.py,sha256=fx5pnfcf9L5KvAqhsQBZkl9fUf9oABuroLGZqDNycpc,312
@@ -61,6 +61,6 @@ kaq_quant_common/utils/signal_utils.py,sha256=zBSyEltNTKqkQCsrETd47kEBb3Q_OWUBUn
61
61
  kaq_quant_common/utils/sqlite_utils.py,sha256=UDDFKfwL0N-jFifl40HdyOCENh2YQfW5so6hRaSJpv0,5722
62
62
  kaq_quant_common/utils/uuid_utils.py,sha256=pm_pnXpd8n9CI66x3A20cOEUiriJyqHaKGCeLrgkBxU,71
63
63
  kaq_quant_common/utils/yml_utils.py,sha256=gcKjb_-uuUajBGAl5QBPIZTg2wXm7qeeJvtHflj_zOE,4513
64
- kaq_quant_common-0.2.1.dist-info/METADATA,sha256=BQR0H2Zhcjyow-c0bEgxlkTrbuR7FEh7I8HJmTszrqk,1970
65
- kaq_quant_common-0.2.1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
66
- kaq_quant_common-0.2.1.dist-info/RECORD,,
64
+ kaq_quant_common-0.2.2.dist-info/METADATA,sha256=hUaUne0whJ4kpE4AxkfLs2DsyWjJd5GEm4UYfyvISY8,1970
65
+ kaq_quant_common-0.2.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
66
+ kaq_quant_common-0.2.2.dist-info/RECORD,,