kaq-quant-common 0.1.86__py3-none-any.whl → 0.1.88__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.
@@ -9,13 +9,16 @@ from kaq_quant_common.api.rest.instruction.helper.order_helper import \
9
9
  from kaq_quant_common.api.rest.instruction.models import \
10
10
  InstructionResponseBase
11
11
  from kaq_quant_common.api.rest.instruction.models.account import (
12
- ContractBalanceRequest, ContractBalanceResponse)
12
+ AccountIncomeRequest, AccountIncomeResponse, ContractBalanceRequest,
13
+ ContractBalanceResponse)
13
14
  from kaq_quant_common.api.rest.instruction.models.order import (
14
15
  AllOpenOrdersRequest, AllOpenOrdersResponse, CancelOrderRequest,
15
16
  CancelOrderResponse, ChangeLeverageRequest, ChangeLeverageResponse,
16
17
  LimitOrderBookRequest, LimitOrderBookResponse, ModifyOrderRequest,
17
18
  ModifyOrderResponse, OrderRequest, OrderResponse, QuerySymbolConfigRequest,
18
19
  QuerySymbolConfigResponse)
20
+ from kaq_quant_common.api.rest.instruction.models.position import (
21
+ QueryOpenInterestRequest, QueryOpenInterestResponse)
19
22
  from kaq_quant_common.api.rest.instruction.models.transfer import (
20
23
  TransferRequest, TransferResponse)
21
24
  from kaq_quant_common.resources.kaq_mysql_resources import \
@@ -93,6 +96,16 @@ class InstructionServerBase(ApiServerBase, ApiInterface, ABC):
93
96
  @api_method(LimitOrderBookRequest, LimitOrderBookResponse)
94
97
  def get_limit_order(self, request: LimitOrderBookRequest) -> LimitOrderBookResponse:
95
98
  return self._on_get_limit_order(request)
99
+
100
+ # 查询账户损益资金流水
101
+ @api_method(AccountIncomeRequest, AccountIncomeResponse)
102
+ def get_account_income(self, request: AccountIncomeRequest) -> AccountIncomeResponse:
103
+ return self._on_get_account_income(request)
104
+
105
+ # 查询未平仓合约数量
106
+ @api_method(QueryOpenInterestRequest, QueryOpenInterestResponse)
107
+ def query_open_interest(self, request: QueryOpenInterestRequest) -> QueryOpenInterestResponse:
108
+ return self._on_query_open_interest(request)
96
109
 
97
110
  # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ abstract methods
98
111
 
@@ -130,4 +143,12 @@ class InstructionServerBase(ApiServerBase, ApiInterface, ABC):
130
143
 
131
144
  @abstractmethod
132
145
  def _on_get_limit_order(self, request: LimitOrderBookRequest) -> LimitOrderBookResponse:
146
+ pass
147
+
148
+ @abstractmethod
149
+ def _on_get_account_income(self, request: AccountIncomeRequest) -> AccountIncomeResponse:
150
+ pass
151
+
152
+ @abstractmethod
153
+ def _on_query_open_interest(self, request: QueryOpenInterestRequest) -> QueryOpenInterestResponse:
133
154
  pass
@@ -1,3 +1,4 @@
1
+ from enum import Enum
1
2
  from typing import Optional
2
3
 
3
4
  from pydantic import BaseModel
@@ -22,3 +23,27 @@ class ContractBalanceRequest(InstructionRequestBase):
22
23
  class ContractBalanceResponse(InstructionResponseBase):
23
24
  #
24
25
  assets: list[AssetsInfo]
26
+
27
+
28
+ # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 查询账户损益资金流水
29
+ class AccountIncomeInfo(BaseModel):
30
+ symbol: str
31
+ incomeType: int
32
+ income: float
33
+ time: int
34
+ subType: Optional[str] = None
35
+
36
+
37
+ class AccountIncomeRequest(InstructionRequestBase):
38
+ # 交易对
39
+ symbol: Optional[str] = None
40
+ # 收益类型
41
+ incomeType: Optional[int] = None
42
+ # 起始时间
43
+ startTime: Optional[int] = None
44
+ # 结束时间
45
+ endTime: Optional[int] = None
46
+
47
+
48
+ class AccountIncomeResponse(InstructionResponseBase):
49
+ income_list: list[AccountIncomeInfo]
@@ -54,3 +54,17 @@ class QueryPositionRequest(InstructionRequestBase):
54
54
  class QueryPositionResponse(InstructionResponseBase):
55
55
  #
56
56
  positions: list[PositionInfo]
57
+
58
+
59
+ # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 查询未平仓合约数
60
+ class QueryOpenInterestRequest(InstructionRequestBase):
61
+ # 交易对
62
+ symbol: str
63
+
64
+ class QueryOpenInterestResponse(InstructionResponseBase):
65
+ # 交易对
66
+ symbol: str
67
+ # 未平仓合约数量(币)
68
+ open_interest: float
69
+ # 时间
70
+ time: int
@@ -6,7 +6,7 @@ from kaq_quant_common.utils import yml_utils
6
6
 
7
7
  # 订单簿交易对监听器
8
8
  class LimitOrderSymbolMonitor(RedisTableMonitor):
9
- def __init__(self, exchange: str, handler: callable = None, default_symbols=["BTCUSDT", "ETHUSDT"]):
9
+ def __init__(self, exchange: str, handler: callable = None, default_symbols=["BTCUSDT", "ETHUSDT"], table_name="kaq_all_futures_limit_order_symbols_config"):
10
10
  #
11
11
  self._exchange = exchange
12
12
  # 回调
@@ -17,7 +17,7 @@ class LimitOrderSymbolMonitor(RedisTableMonitor):
17
17
  self._str_value = None
18
18
 
19
19
  # 间隔1秒
20
- super().__init__(table_name="kaq_all_futures_limit_order_symbols_config", interval=1)
20
+ super().__init__(table_name=table_name, interval=1)
21
21
 
22
22
  # 输出一下支持的交易对
23
23
  # self._logger.info(f"init {self._exchange} limit order support symbols: {self._support_symbols}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kaq_quant_common
3
- Version: 0.1.86
3
+ Version: 0.1.88
4
4
  Summary:
5
5
  Author: kevinfuture
6
6
  Author-email: liuenbofuture@foxmail.com
@@ -8,11 +8,11 @@ kaq_quant_common/api/rest/api_client_base.py,sha256=LYpqjjVGbVRVyP8qdmlgMelUtEY-
8
8
  kaq_quant_common/api/rest/api_server_base.py,sha256=URrvzerHIE6XQLERYFcFH1ftLbCYTz3sENAxFD0HWY0,4653
9
9
  kaq_quant_common/api/rest/instruction/helper/order_helper.py,sha256=q2opRLHrysvgqoFpAC70WNQpFJsbviHqjRldXj6tiMY,12267
10
10
  kaq_quant_common/api/rest/instruction/instruction_client.py,sha256=CI5RidyBN51qxq3NKNMIJGs3boCIt-EYN5bnn12ywIo,3489
11
- kaq_quant_common/api/rest/instruction/instruction_server_base.py,sha256=uKE0O_x3hC3595YCFbIZ2CDnmsk6V7b0dQ4J-5lvbI0,5279
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
13
- kaq_quant_common/api/rest/instruction/models/account.py,sha256=3rdsEnEqaHWjQ3yHMZ4pOupfHqHMRZ_W5kxIxuRQoac,632
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
- kaq_quant_common/api/rest/instruction/models/position.py,sha256=PGyZg_z4ZIB09BWl1uRtmePz8T3mzgrHSgpdN0ZKRzA,1268
15
+ kaq_quant_common/api/rest/instruction/models/position.py,sha256=OqtfWWcpGhbijJbwJqERkeFxPiIkzdBnhPx5CfXj8W0,1744
16
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
18
  kaq_quant_common/api/ws/exchange/models.py,sha256=RPD5cDRQyISguTjO5Si1V5hJza8Uyr4u2EZEHNFtLb8,664
@@ -28,7 +28,7 @@ kaq_quant_common/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
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
30
  kaq_quant_common/common/modules/limit_order_helper.py,sha256=Pbh1RHapr9D0Uacup5oQqeXgfI72zLAG2vZHEjPgoPY,2894
31
- kaq_quant_common/common/modules/limit_order_symbol_monitor.py,sha256=cizWXXqeHWYc0MM26qfDtSz9wFPMccAHBL0Fk_XfVGw,2853
31
+ kaq_quant_common/common/modules/limit_order_symbol_monitor.py,sha256=TBK48qyeCSQvkfDMv3J_0UM7f3OuBRKRFYDcL9kG6Cs,2876
32
32
  kaq_quant_common/common/modules/limit_order_symbol_monitor_group.py,sha256=-H4Aw82DwP-OQ0xGF2csiVX7QSkeMu8tPusAzbQbd3Y,2314
33
33
  kaq_quant_common/common/monitor_base.py,sha256=E4EUMsO3adNltCDNRgxkvUSbTTfKOL9S1zzN3WkZvpU,2467
34
34
  kaq_quant_common/common/monitor_group.py,sha256=cNLD-vU6CI8_2u5oV_joxDavK64weaUD0UND1__Hfuo,2862
@@ -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.1.86.dist-info/METADATA,sha256=JrMd46r9p3OhQxZdmwf8h8izdgpEnQda9ZXzERdvo4o,1971
65
- kaq_quant_common-0.1.86.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
66
- kaq_quant_common-0.1.86.dist-info/RECORD,,
64
+ kaq_quant_common-0.1.88.dist-info/METADATA,sha256=PSIwKDKRmLOBp7-cSDBGeuswnKnaVSW3caeGSOP0E2k,1971
65
+ kaq_quant_common-0.1.88.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
66
+ kaq_quant_common-0.1.88.dist-info/RECORD,,