kaq-quant-common 0.1.86__tar.gz → 0.1.88__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.
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/PKG-INFO +1 -1
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/rest/instruction/instruction_server_base.py +22 -1
- kaq_quant_common-0.1.88/kaq_quant_common/api/rest/instruction/models/account.py +49 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/rest/instruction/models/position.py +14 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/common/modules/limit_order_symbol_monitor.py +2 -2
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/pyproject.toml +1 -1
- kaq_quant_common-0.1.86/kaq_quant_common/api/rest/instruction/models/account.py +0 -24
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/README.md +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/__init__.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/__init__.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/common/__init__.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/common/api_interface.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/common/auth.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/rest/__init__.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/rest/api_client_base.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/rest/api_server_base.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/rest/instruction/helper/order_helper.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/rest/instruction/instruction_client.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/rest/instruction/models/__init__.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/rest/instruction/models/order.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/rest/instruction/models/transfer.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/ws/__init__.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/ws/exchange/models.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/ws/exchange/ws_exchange_client.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/ws/exchange/ws_exchange_server.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/ws/instruction/__init__.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/ws/instruction/ws_instruction_client.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/ws/instruction/ws_instruction_server_base.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/ws/models.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/ws/ws_client_base.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/ws/ws_server_base.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/common/__init__.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/common/ddb_table_monitor.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/common/http_monitor.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/common/modules/limit_order_helper.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/common/modules/limit_order_symbol_monitor_group.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/common/monitor_base.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/common/monitor_group.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/common/redis_table_monitor.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/common/statistics/funding_rate_history_statistics.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/common/statistics/kline_history_statistics.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/common/ws_wrapper.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/config/config.yaml +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/resources/__init__.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/resources/kaq_ddb_pool_stream_read_resources.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/resources/kaq_ddb_stream_init_resources.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/resources/kaq_ddb_stream_read_resources.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/resources/kaq_ddb_stream_write_resources.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/resources/kaq_mysql_init_resources.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/resources/kaq_mysql_resources.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/resources/kaq_postgresql_resources.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/resources/kaq_quant_hive_resources.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/resources/kaq_redis_resources.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/utils/__init__.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/utils/dagster_job_check_utils.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/utils/dagster_utils.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/utils/date_util.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/utils/enums_utils.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/utils/error_utils.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/utils/hash_utils.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/utils/log_time_utils.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/utils/logger_utils.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/utils/mytt_utils.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/utils/signal_utils.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/utils/sqlite_utils.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/utils/uuid_utils.py +0 -0
- {kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/utils/yml_utils.py +0 -0
|
@@ -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,
|
|
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
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from typing import Optional
|
|
3
|
+
|
|
4
|
+
from pydantic import BaseModel
|
|
5
|
+
|
|
6
|
+
from . import InstructionRequestBase, InstructionResponseBase
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# 资产信息
|
|
10
|
+
class AssetsInfo(BaseModel):
|
|
11
|
+
# 币种
|
|
12
|
+
coin: str
|
|
13
|
+
# 余额
|
|
14
|
+
balance: float
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 查询合约账户余额
|
|
18
|
+
class ContractBalanceRequest(InstructionRequestBase):
|
|
19
|
+
# 币种
|
|
20
|
+
coin: Optional[str] = None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ContractBalanceResponse(InstructionResponseBase):
|
|
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=
|
|
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,24 +0,0 @@
|
|
|
1
|
-
from typing import Optional
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel
|
|
4
|
-
|
|
5
|
-
from . import InstructionRequestBase, InstructionResponseBase
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
# 资产信息
|
|
9
|
-
class AssetsInfo(BaseModel):
|
|
10
|
-
# 币种
|
|
11
|
-
coin: str
|
|
12
|
-
# 余额
|
|
13
|
-
balance: float
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
# ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 查询合约账户余额
|
|
17
|
-
class ContractBalanceRequest(InstructionRequestBase):
|
|
18
|
-
# 币种
|
|
19
|
-
coin: Optional[str] = None
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class ContractBalanceResponse(InstructionResponseBase):
|
|
23
|
-
#
|
|
24
|
-
assets: list[AssetsInfo]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/common/api_interface.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/rest/api_client_base.py
RENAMED
|
File without changes
|
{kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/rest/api_server_base.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/ws/exchange/models.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/ws/instruction/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/ws/ws_client_base.py
RENAMED
|
File without changes
|
{kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/api/ws/ws_server_base.py
RENAMED
|
File without changes
|
|
File without changes
|
{kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/common/ddb_table_monitor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/common/monitor_group.py
RENAMED
|
File without changes
|
{kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/common/redis_table_monitor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kaq_quant_common-0.1.86 → kaq_quant_common-0.1.88}/kaq_quant_common/utils/log_time_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|