kaq-quant-common 0.1.83__py3-none-any.whl → 0.1.85__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.
Files changed (30) hide show
  1. kaq_quant_common/api/common/__init__.py +1 -1
  2. kaq_quant_common/api/common/api_interface.py +38 -38
  3. kaq_quant_common/api/rest/api_client_base.py +42 -42
  4. kaq_quant_common/api/rest/instruction/helper/order_helper.py +324 -324
  5. kaq_quant_common/api/rest/instruction/instruction_client.py +76 -88
  6. kaq_quant_common/api/rest/instruction/instruction_server_base.py +133 -132
  7. kaq_quant_common/api/rest/instruction/models/__init__.py +17 -17
  8. kaq_quant_common/api/rest/instruction/models/account.py +24 -24
  9. kaq_quant_common/api/rest/instruction/models/order.py +248 -223
  10. kaq_quant_common/api/rest/instruction/models/position.py +56 -56
  11. kaq_quant_common/api/rest/instruction/models/transfer.py +32 -32
  12. kaq_quant_common/api/ws/exchange/models.py +23 -23
  13. kaq_quant_common/api/ws/exchange/ws_exchange_server.py +440 -440
  14. kaq_quant_common/common/ddb_table_monitor.py +106 -106
  15. kaq_quant_common/common/http_monitor.py +69 -69
  16. kaq_quant_common/common/modules/limit_order_helper.py +81 -81
  17. kaq_quant_common/common/modules/limit_order_symbol_monitor.py +76 -76
  18. kaq_quant_common/common/modules/limit_order_symbol_monitor_group.py +69 -69
  19. kaq_quant_common/common/monitor_base.py +84 -84
  20. kaq_quant_common/common/monitor_group.py +97 -97
  21. kaq_quant_common/common/statistics/funding_rate_history_statistics.py +208 -0
  22. kaq_quant_common/common/statistics/kline_history_statistics.py +36 -13
  23. kaq_quant_common/common/ws_wrapper.py +21 -21
  24. kaq_quant_common/resources/kaq_ddb_stream_write_resources.py +2 -0
  25. kaq_quant_common/utils/logger_utils.py +5 -5
  26. kaq_quant_common/utils/signal_utils.py +23 -23
  27. kaq_quant_common/utils/uuid_utils.py +5 -5
  28. {kaq_quant_common-0.1.83.dist-info → kaq_quant_common-0.1.85.dist-info}/METADATA +1 -1
  29. {kaq_quant_common-0.1.83.dist-info → kaq_quant_common-0.1.85.dist-info}/RECORD +30 -29
  30. {kaq_quant_common-0.1.83.dist-info → kaq_quant_common-0.1.85.dist-info}/WHEEL +1 -1
@@ -1,223 +1,248 @@
1
- from enum import Enum
2
- from typing import Optional
3
-
4
- from pydantic import BaseModel
5
-
6
- from kaq_quant_common.utils import uuid_utils
7
-
8
- from . import InstructionRequestBase, InstructionResponseBase
9
-
10
-
11
- # 订单类型
12
- class OrderType(str, Enum):
13
- # 现货
14
- SPOT = "spot"
15
- # 合约
16
- FUTURES = "futures"
17
-
18
-
19
- # 订单方向(多单可以正向理解,空单需要反向理解)
20
- class OrderSide(str, Enum):
21
- BUY = "buy"
22
- SELL = "sell"
23
-
24
-
25
- # 持仓方向
26
- class OrderPositionSide(str, Enum):
27
- # 看多
28
- LONG = "long"
29
- # 看空
30
- SHORT = "short"
31
-
32
-
33
- # 订单交易类型
34
- class OrderTradeType(str, Enum):
35
- # 市价
36
- MARKET = "market"
37
- # 限价
38
- LIMIT = "limit"
39
-
40
-
41
- # 订单状态
42
- class OrderStatus(str, Enum):
43
- CREATE = "create"
44
- FINISH = "finish"
45
-
46
-
47
- # 持仓状态
48
- class PositionStatus(str, Enum):
49
- OPEN = "open"
50
- CLOSE = "close"
51
-
52
-
53
- # 订单信息
54
- class OrderInfo(BaseModel):
55
- # 指令id-两个交易所会有一笔一样的指令id
56
- instruction_id: Optional[str] = None
57
- # 订单id-指定生成的订单id, 如果没有,需要生成
58
- order_id: Optional[str] = None
59
- # 交易对
60
- symbol: str
61
- # 订单类型 现货/合约
62
- order_type: OrderType
63
- # 卖买方向
64
- side: OrderSide
65
- # 持仓方向
66
- position_side: OrderPositionSide
67
- # 保证金,?什么时候用
68
- margin: Optional[float] = 0.0
69
- # 补充保证金,?什么时候用
70
- supply_margin: Optional[float] = 0.0
71
- # 杠杆
72
- level: int
73
- # 数量(币种,不是USDT)
74
- quantity: float
75
- # 限价单才用
76
- target_price: float
77
- # 当前价格,?什么时候用
78
- current_price: Optional[float] = 0.0
79
- # 交易类型 市价单/限价单
80
- trade_type: OrderTradeType
81
- # 风险等级
82
- risk_level: int
83
- # 是否强制平仓
84
- forced_liqu: bool
85
- # 有效期
86
- validity_period: Optional[str] = None
87
- # 策略类型
88
- strategy_type: Optional[str] = None
89
-
90
- # 平仓用的,指定仓位
91
- position_id: Optional[str] = None
92
-
93
- def __init__(self, **data):
94
- super().__init__(**data)
95
- if self.instruction_id is None:
96
- self.instruction_id = uuid_utils.generate_uuid()
97
- if self.order_id is None:
98
- self.order_id = uuid_utils.generate_uuid()
99
-
100
-
101
- # 修改订单信息
102
- class ModifyOrderInfo(BaseModel):
103
- # 订单ID,自定义的订单id
104
- order_id: str
105
- # TODO 暂时不知道修改什么,先定个修改数量
106
- quantity: Optional[float] = None
107
- # TODO 暂时不知道修改什么,先定个修改价格
108
- price: Optional[float] = None
109
-
110
-
111
- # 已下单信息
112
- class OpenedOrderInfo(BaseModel):
113
- # 订单ID
114
- order_id: str
115
- # 交易对
116
- symbol: Optional[str] = None
117
- # 价格
118
- price: Optional[float] = 0
119
-
120
- # 操作反馈信息,一般是错误信息
121
- message: Optional[str] = None
122
-
123
-
124
- # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 批量下单
125
- # 下单请求
126
- class OrderRequest(InstructionRequestBase):
127
- orders: list[OrderInfo]
128
-
129
-
130
- # 下单响应
131
- class OrderResponse(InstructionResponseBase):
132
- # 返回成功下单的订单信息
133
- orders: list[OpenedOrderInfo]
134
-
135
-
136
- # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 批量修改订单
137
-
138
-
139
- class ModifyOrderRequest(InstructionRequestBase):
140
- orders: list[ModifyOrderInfo]
141
-
142
-
143
- class ModifyOrderResponse(InstructionResponseBase):
144
- # 返回成功下单的订单信息
145
- orders: list[OpenedOrderInfo]
146
-
147
-
148
- # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 撤销订单
149
-
150
-
151
- class CancelOrderRequest(InstructionRequestBase):
152
- # 可选的,可能某些平台需要指定交易对
153
- symbol: Optional[str]
154
- # 订单id列表
155
- orders: list[str]
156
-
157
-
158
- class CancelOrderResponse(InstructionResponseBase):
159
- orders: list[OpenedOrderInfo]
160
-
161
-
162
- # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 查询当前全部挂单请求
163
- class AllOpenOrdersRequest(InstructionRequestBase):
164
- # 交易对,用作筛选,不传取全部
165
- symbol: Optional[str] = None
166
-
167
-
168
- # 查询当前全部挂单响应
169
- class AllOpenOrdersResponse(InstructionResponseBase):
170
- # TODO
171
- orders: list[OpenedOrderInfo]
172
-
173
-
174
- # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 查询账户交易对设置
175
- class QuerySymbolConfigRequest(InstructionRequestBase):
176
- # 交易对
177
- symbol: str
178
-
179
-
180
- class QuerySymbolConfigResponse(InstructionResponseBase):
181
- # 交易对
182
- symbol: str
183
- # 杠杆-当前设置的杠杆
184
- level: int
185
- # 最大杠杆-可选,有些是需要账户权限获取,有些不需要
186
- max_level: Optional[int] = 0
187
-
188
-
189
- # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 调整杠杆
190
- class ChangeLeverageRequest(InstructionRequestBase):
191
- # 交易对
192
- symbol: str
193
- # 杠杆
194
- level: int
195
-
196
-
197
- class ChangeLeverageResponse(InstructionResponseBase):
198
- # 交易对
199
- symbol: str
200
- # 杠杆
201
- level: int
202
-
203
-
204
- # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 联合保证金模式
205
- # 查询
206
- class QueryMarginModeRequest(InstructionRequestBase):
207
- pass
208
-
209
-
210
- class QueryMarginModeResponse(InstructionResponseBase):
211
- # 是否联合
212
- is_margin: bool
213
-
214
-
215
- # 修改
216
- class ChangeMarginModeRequest(InstructionRequestBase):
217
- # 是否联合
218
- is_margin: bool
219
-
220
-
221
- class ChangeMarginModeResponse(InstructionResponseBase):
222
- # 是否联合
223
- is_margin: bool
1
+ from enum import Enum
2
+ from typing import Optional
3
+
4
+ import pandas as pd
5
+ from pydantic import BaseModel
6
+
7
+ from kaq_quant_common.utils import uuid_utils
8
+
9
+ from . import InstructionRequestBase, InstructionResponseBase
10
+
11
+
12
+ # 订单类型
13
+ class OrderType(str, Enum):
14
+ # 现货
15
+ SPOT = "spot"
16
+ # 合约
17
+ FUTURES = "futures"
18
+
19
+
20
+ # 订单方向(多单可以正向理解,空单需要反向理解)
21
+ class OrderSide(str, Enum):
22
+ BUY = "buy"
23
+ SELL = "sell"
24
+
25
+
26
+ # 持仓方向
27
+ class OrderPositionSide(str, Enum):
28
+ # 看多
29
+ LONG = "long"
30
+ # 看空
31
+ SHORT = "short"
32
+
33
+
34
+ # 订单交易类型
35
+ class OrderTradeType(str, Enum):
36
+ # 市价
37
+ MARKET = "market"
38
+ # 限价
39
+ LIMIT = "limit"
40
+
41
+
42
+ # 订单状态
43
+ class OrderStatus(str, Enum):
44
+ CREATE = "create"
45
+ FINISH = "finish"
46
+
47
+
48
+ # 持仓状态
49
+ class PositionStatus(str, Enum):
50
+ OPEN = "open"
51
+ CLOSE = "close"
52
+
53
+
54
+ # 订单信息
55
+ class OrderInfo(BaseModel):
56
+ # 指令id-两个交易所会有一笔一样的指令id
57
+ instruction_id: Optional[str] = None
58
+ # 订单id-指定生成的订单id, 如果没有,需要生成
59
+ order_id: Optional[str] = None
60
+ # 交易对
61
+ symbol: str
62
+ # 订单类型 现货/合约
63
+ order_type: OrderType
64
+ # 卖买方向
65
+ side: OrderSide
66
+ # 持仓方向
67
+ position_side: OrderPositionSide
68
+ # 保证金,?什么时候用
69
+ margin: Optional[float] = 0.0
70
+ # 补充保证金,?什么时候用
71
+ supply_margin: Optional[float] = 0.0
72
+ # 杠杆
73
+ level: int
74
+ # 数量(币种,不是USDT)
75
+ quantity: float
76
+ # 限价单才用
77
+ target_price: float
78
+ # 当前价格,?什么时候用
79
+ current_price: Optional[float] = 0.0
80
+ # 交易类型 市价单/限价单
81
+ trade_type: OrderTradeType
82
+ # 风险等级
83
+ risk_level: int
84
+ # 是否强制平仓
85
+ forced_liqu: bool
86
+ # 有效期
87
+ validity_period: Optional[str] = None
88
+ # 策略类型
89
+ strategy_type: Optional[str] = None
90
+
91
+ # 平仓用的,指定仓位
92
+ position_id: Optional[str] = None
93
+
94
+ def __init__(self, **data):
95
+ super().__init__(**data)
96
+ if self.instruction_id is None:
97
+ self.instruction_id = uuid_utils.generate_uuid()
98
+ if self.order_id is None:
99
+ self.order_id = uuid_utils.generate_uuid()
100
+
101
+
102
+ # 修改订单信息
103
+ class ModifyOrderInfo(BaseModel):
104
+ # 订单ID,自定义的订单id
105
+ order_id: str
106
+ # TODO 暂时不知道修改什么,先定个修改数量
107
+ quantity: Optional[float] = None
108
+ # TODO 暂时不知道修改什么,先定个修改价格
109
+ price: Optional[float] = None
110
+
111
+
112
+ # 已下单信息
113
+ class OpenedOrderInfo(BaseModel):
114
+ # 订单ID
115
+ order_id: str
116
+ # 交易对
117
+ symbol: Optional[str] = None
118
+ # 价格
119
+ price: Optional[float] = 0
120
+
121
+ # 操作反馈信息,一般是错误信息
122
+ message: Optional[str] = None
123
+
124
+
125
+ # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 批量下单
126
+ # 下单请求
127
+ class OrderRequest(InstructionRequestBase):
128
+ orders: list[OrderInfo]
129
+
130
+
131
+ # 下单响应
132
+ class OrderResponse(InstructionResponseBase):
133
+ # 返回成功下单的订单信息
134
+ orders: list[OpenedOrderInfo]
135
+
136
+
137
+ # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 批量修改订单
138
+
139
+
140
+ class ModifyOrderRequest(InstructionRequestBase):
141
+ orders: list[ModifyOrderInfo]
142
+
143
+
144
+ class ModifyOrderResponse(InstructionResponseBase):
145
+ # 返回成功下单的订单信息
146
+ orders: list[OpenedOrderInfo]
147
+
148
+
149
+ # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 撤销订单
150
+
151
+
152
+ class CancelOrderRequest(InstructionRequestBase):
153
+ # 可选的,可能某些平台需要指定交易对
154
+ symbol: Optional[str]
155
+ # 订单id列表
156
+ orders: list[str]
157
+
158
+
159
+ class CancelOrderResponse(InstructionResponseBase):
160
+ orders: list[OpenedOrderInfo]
161
+
162
+
163
+ # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 查询当前全部挂单请求
164
+ class AllOpenOrdersRequest(InstructionRequestBase):
165
+ # 交易对,用作筛选,不传取全部
166
+ symbol: Optional[str] = None
167
+
168
+
169
+ # 查询当前全部挂单响应
170
+ class AllOpenOrdersResponse(InstructionResponseBase):
171
+ # TODO
172
+ orders: list[OpenedOrderInfo]
173
+
174
+
175
+ # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 查询账户交易对设置
176
+ class QuerySymbolConfigRequest(InstructionRequestBase):
177
+ # 交易对
178
+ symbol: str
179
+
180
+
181
+ class QuerySymbolConfigResponse(InstructionResponseBase):
182
+ # 交易对
183
+ symbol: str
184
+ # 杠杆-当前设置的杠杆
185
+ level: int
186
+ # 最大杠杆-可选,有些是需要账户权限获取,有些不需要
187
+ max_level: Optional[int] = 0
188
+
189
+
190
+ # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 调整杠杆
191
+ class ChangeLeverageRequest(InstructionRequestBase):
192
+ # 交易对
193
+ symbol: str
194
+ # 杠杆
195
+ level: int
196
+
197
+
198
+ class ChangeLeverageResponse(InstructionResponseBase):
199
+ # 交易对
200
+ symbol: str
201
+ # 杠杆
202
+ level: int
203
+
204
+
205
+ # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 联合保证金模式
206
+ # 查询
207
+ class QueryMarginModeRequest(InstructionRequestBase):
208
+ pass
209
+
210
+
211
+ class QueryMarginModeResponse(InstructionResponseBase):
212
+ # 是否联合
213
+ is_margin: bool
214
+
215
+
216
+ # 修改
217
+ class ChangeMarginModeRequest(InstructionRequestBase):
218
+ # 是否联合
219
+ is_margin: bool
220
+
221
+
222
+ class ChangeMarginModeResponse(InstructionResponseBase):
223
+ # 是否联合
224
+ is_margin: bool
225
+
226
+
227
+ # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 5档深度
228
+ class LimitOrderBookInfo(BaseModel):
229
+ # 价格
230
+ price: float
231
+ # 数量
232
+ vol: float
233
+
234
+
235
+ class LimitOrderBookRequest(InstructionRequestBase):
236
+ # 交易对
237
+ symbol: str
238
+
239
+
240
+ class LimitOrderBookResponse(InstructionResponseBase):
241
+ # 交易对
242
+ symbol: str
243
+ # 接口返回的ts
244
+ event_time: int
245
+ # 买单数据
246
+ bids: list[LimitOrderBookInfo]
247
+ # 卖单数据
248
+ asks: list[LimitOrderBookInfo]
@@ -1,56 +1,56 @@
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 PositionSide(str, Enum):
11
- # 看多
12
- LONG = "long"
13
- # 看空
14
- SHORT = "short"
15
- # 双向
16
- BOTH = "both"
17
-
18
-
19
- class PositionInfo(BaseModel):
20
- # 交易对
21
- symbol: str
22
- # 持仓方向
23
- position: PositionSide
24
- # 持仓数量
25
- amount: float
26
- # 开仓价格
27
- open_price: float
28
- # 标记价格
29
- mark_price: float
30
- # 强平价格
31
- liquidation_price: float
32
- # 未实现盈亏
33
- unrealized_pnl: float
34
- # 初始保证金
35
- initial_margin: float
36
- # 维持保证金
37
- maintain_margin: float
38
- # 仓位初始保证金
39
- position_initial_margin: float
40
- # 订单初始保证金
41
- order_initial_margin: float
42
- # 更新时间
43
- update_time: int
44
-
45
-
46
- # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 持仓
47
-
48
-
49
- class QueryPositionRequest(InstructionRequestBase):
50
- # 交易对
51
- symbol: Optional[str] = None
52
-
53
-
54
- class QueryPositionResponse(InstructionResponseBase):
55
- #
56
- positions: list[PositionInfo]
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 PositionSide(str, Enum):
11
+ # 看多
12
+ LONG = "long"
13
+ # 看空
14
+ SHORT = "short"
15
+ # 双向
16
+ BOTH = "both"
17
+
18
+
19
+ class PositionInfo(BaseModel):
20
+ # 交易对
21
+ symbol: str
22
+ # 持仓方向
23
+ position: PositionSide
24
+ # 持仓数量
25
+ amount: float
26
+ # 开仓价格
27
+ open_price: float
28
+ # 标记价格
29
+ mark_price: float
30
+ # 强平价格
31
+ liquidation_price: float
32
+ # 未实现盈亏
33
+ unrealized_pnl: float
34
+ # 初始保证金
35
+ initial_margin: float
36
+ # 维持保证金
37
+ maintain_margin: float
38
+ # 仓位初始保证金
39
+ position_initial_margin: float
40
+ # 订单初始保证金
41
+ order_initial_margin: float
42
+ # 更新时间
43
+ update_time: int
44
+
45
+
46
+ # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 持仓
47
+
48
+
49
+ class QueryPositionRequest(InstructionRequestBase):
50
+ # 交易对
51
+ symbol: Optional[str] = None
52
+
53
+
54
+ class QueryPositionResponse(InstructionResponseBase):
55
+ #
56
+ positions: list[PositionInfo]
@@ -1,32 +1,32 @@
1
- from enum import Enum
2
-
3
- from . import InstructionRequestBase, InstructionResponseBase
4
-
5
- # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 划转
6
-
7
-
8
- # 划转类型
9
- class TransferType(int, Enum):
10
- # 资金&现货
11
- FUNDING_SPOT = 1
12
- # 资金&合约
13
- FUNDING_FUTURES = 2
14
- # 合约&现货
15
- SPOT_FUTURES = 3
16
-
17
-
18
- # 划转请求
19
- class TransferRequest(InstructionRequestBase):
20
- # 划转类型
21
- type: TransferType
22
- # 资产/币种
23
- assets: str
24
- # 划转数量
25
- amount: float
26
- # 划转方向 1正向,2反向
27
- direction: int
28
-
29
-
30
- # 划转响应
31
- class TransferResponse(InstructionResponseBase):
32
- transfer_id: str
1
+ from enum import Enum
2
+
3
+ from . import InstructionRequestBase, InstructionResponseBase
4
+
5
+ # ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 划转
6
+
7
+
8
+ # 划转类型
9
+ class TransferType(int, Enum):
10
+ # 资金&现货
11
+ FUNDING_SPOT = 1
12
+ # 资金&合约
13
+ FUNDING_FUTURES = 2
14
+ # 合约&现货
15
+ SPOT_FUTURES = 3
16
+
17
+
18
+ # 划转请求
19
+ class TransferRequest(InstructionRequestBase):
20
+ # 划转类型
21
+ type: TransferType
22
+ # 资产/币种
23
+ assets: str
24
+ # 划转数量
25
+ amount: float
26
+ # 划转方向 1正向,2反向
27
+ direction: int
28
+
29
+
30
+ # 划转响应
31
+ class TransferResponse(InstructionResponseBase):
32
+ transfer_id: str