okxv5 1.8.11__py3-none-any.whl → 1.8.13__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.
- okxv5/Account_api.py +28 -489
- okxv5/Affiliate_api.py +4 -12
- okxv5/Broker_api.py +2 -179
- okxv5/Convert_api.py +1 -7
- okxv5/Copytrading_api.py +2 -309
- okxv5/FDBroker_api.py +6 -20
- okxv5/Finance_api.py +47 -40
- okxv5/Funding_api.py +26 -25
- okxv5/Market_api.py +29 -193
- okxv5/Public_api.py +20 -64
- okxv5/Recurring_api.py +0 -57
- okxv5/Rfq_api.py +0 -22
- okxv5/Singal_api.py +45 -100
- okxv5/SprdApi_api.py +8 -154
- okxv5/Trade_api.py +27 -459
- okxv5/TradingBot_api.py +27 -87
- okxv5/TradingData_api.py +6 -49
- okxv5/client.py +30 -84
- okxv5/consts.py +400 -399
- okxv5/exceptions.py +11 -44
- okxv5/status_api.py +0 -14
- okxv5/subAccount_api.py +1 -172
- okxv5/utils.py +14 -67
- okxv5-1.8.13.dist-info/METADATA +915 -0
- okxv5-1.8.13.dist-info/RECORD +28 -0
- okxv5/hunyuan_client.py +0 -74
- okxv5-1.8.11.dist-info/METADATA +0 -59
- okxv5-1.8.11.dist-info/RECORD +0 -29
- {okxv5-1.8.11.dist-info → okxv5-1.8.13.dist-info}/WHEEL +0 -0
- {okxv5-1.8.11.dist-info → okxv5-1.8.13.dist-info}/top_level.txt +0 -0
okxv5/Account_api.py
CHANGED
@@ -3,559 +3,224 @@ from .consts import *
|
|
3
3
|
|
4
4
|
|
5
5
|
class AccountAPI(Client):
|
6
|
-
|
7
|
-
账户API类,继承自Client,用于与账户相关的操作
|
8
|
-
"""
|
6
|
+
|
9
7
|
def __init__(self, api_key, api_secret_key, passphrase, use_server_time=False, flag='1'):
|
10
|
-
"""
|
11
|
-
初始化AccountAPI客户端
|
12
|
-
:param api_key: API Key
|
13
|
-
:param api_secret_key: API Secret Key
|
14
|
-
:param passphrase: 密码
|
15
|
-
:param use_server_time: 是否使用服务器时间,默认为False
|
16
|
-
:param flag: 区域标识,默认为'1'
|
17
|
-
"""
|
18
8
|
Client.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag)
|
19
9
|
|
20
|
-
#
|
10
|
+
# Get Positions
|
21
11
|
def get_position_risk(self, instType=''):
|
22
|
-
"""
|
23
|
-
获取持仓风险
|
24
|
-
:param instType: 产品类型
|
25
|
-
:return: 响应数据
|
26
|
-
"""
|
27
12
|
params = {}
|
28
13
|
if instType:
|
29
14
|
params['instType'] = instType
|
30
15
|
return self._request_with_params(GET, POSITION_RISK, params)
|
31
16
|
|
32
|
-
#
|
17
|
+
# Get Balance
|
33
18
|
def get_account(self, ccy=''):
|
34
|
-
"""
|
35
|
-
获取账户余额信息
|
36
|
-
:param ccy: 币种
|
37
|
-
:return: 响应数据
|
38
|
-
"""
|
39
19
|
params = {}
|
40
20
|
if ccy:
|
41
21
|
params['ccy'] = ccy
|
42
22
|
return self._request_with_params(GET, ACCOUNT_INFO, params)
|
43
23
|
|
44
|
-
#
|
24
|
+
# Get Positions
|
45
25
|
def get_positions(self, instType='', instId=''):
|
46
|
-
"""
|
47
|
-
获取持仓信息
|
48
|
-
:param instType: 产品类型
|
49
|
-
:param instId: 产品ID
|
50
|
-
:return: 响应数据
|
51
|
-
"""
|
52
26
|
params = {'instType': instType, 'instId': instId}
|
53
27
|
return self._request_with_params(GET, POSITION_INFO, params)
|
54
28
|
|
55
|
-
#
|
29
|
+
# Get Bills Details (recent 7 days)
|
56
30
|
def get_bills_detail(self, instType='', instId='', ccy='', mgnMode='', ctType='', type='', subType='', after='', before='',begin='',end='',
|
57
31
|
limit=''):
|
58
|
-
"""
|
59
|
-
获取账单明细 (近7天)
|
60
|
-
:param instType: 产品类型
|
61
|
-
:param instId: 产品ID
|
62
|
-
:param ccy: 币种
|
63
|
-
:param mgnMode: 保证金模式
|
64
|
-
:param ctType: 合约类型
|
65
|
-
:param type: 账单类型
|
66
|
-
:param subType: 账单子类型
|
67
|
-
:param after: 查询ID的起始点
|
68
|
-
:param before: 查询ID的结束点
|
69
|
-
:param begin: 起始时间戳
|
70
|
-
:param end: 结束时间戳
|
71
|
-
:param limit: 返回结果的数量
|
72
|
-
:return: 响应数据
|
73
|
-
"""
|
74
32
|
params = {'instType': instType, 'ccy': ccy, 'mgnMode': mgnMode, 'ctType': ctType, 'type': type,
|
75
33
|
'subType': subType, 'after': after, 'before': before, 'limit': limit, 'instId':instId, 'begin':begin, 'end':end}
|
76
34
|
return self._request_with_params(GET, BILLS_DETAIL, params)
|
77
35
|
|
78
|
-
#
|
36
|
+
# Get Bills Details (recent 3 months)
|
79
37
|
def get_bills_details(self, instType='', instId = '', ccy='', mgnMode='', ctType='', type='', subType='', after='', before='',begin='',end='',
|
80
38
|
limit=''):
|
81
|
-
"""
|
82
|
-
获取账单明细 (近3个月)
|
83
|
-
:param instType: 产品类型
|
84
|
-
:param instId: 产品ID
|
85
|
-
:param ccy: 币种
|
86
|
-
:param mgnMode: 保证金模式
|
87
|
-
:param ctType: 合约类型
|
88
|
-
:param type: 账单类型
|
89
|
-
:param subType: 账单子类型
|
90
|
-
:param after: 查询ID的起始点
|
91
|
-
:param before: 查询ID的结束点
|
92
|
-
:param begin: 起始时间戳
|
93
|
-
:param end: 结束时间戳
|
94
|
-
:param limit: 返回结果的数量
|
95
|
-
:return: 响应数据
|
96
|
-
"""
|
97
39
|
params = {'instType': instType, 'ccy': ccy, 'mgnMode': mgnMode, 'ctType': ctType, 'type': type,
|
98
40
|
'subType': subType, 'after': after, 'before': before, 'limit': limit, 'instId':instId, 'begin':begin, 'end':end}
|
99
41
|
return self._request_with_params(GET, BILLS_ARCHIVE, params)
|
100
42
|
|
101
|
-
#
|
43
|
+
# Get Account Configuration
|
102
44
|
def get_account_config(self):
|
103
|
-
"""
|
104
|
-
获取账户配置
|
105
|
-
:return: 响应数据
|
106
|
-
"""
|
107
45
|
return self._request_without_params(GET, ACCOUNT_CONFIG)
|
108
46
|
|
109
|
-
#
|
47
|
+
# Get Account Configuration
|
110
48
|
def get_position_mode(self, posMode):
|
111
|
-
"""
|
112
|
-
获取持仓模式
|
113
|
-
:param posMode: 持仓模式
|
114
|
-
:return: 响应数据
|
115
|
-
"""
|
116
49
|
params = {'posMode': posMode}
|
117
50
|
return self._request_with_params(POST, POSITION_MODE, params)
|
118
51
|
|
119
|
-
#
|
52
|
+
# Get Account Configuration
|
120
53
|
def set_leverage(self, lever, mgnMode, instId='', ccy='', posSide=''):
|
121
|
-
"""
|
122
|
-
设置杠杆
|
123
|
-
:param lever: 杠杆倍数
|
124
|
-
:param mgnMode: 保证金模式
|
125
|
-
:param instId: 产品ID
|
126
|
-
:param ccy: 币种
|
127
|
-
:param posSide: 持仓方向
|
128
|
-
:return: 响应数据
|
129
|
-
"""
|
130
54
|
params = {'lever': lever, 'mgnMode': mgnMode, 'instId': instId, 'ccy': ccy, 'posSide': posSide}
|
131
55
|
return self._request_with_params(POST, SET_LEVERAGE, params)
|
132
56
|
|
133
|
-
#
|
57
|
+
# Get Maximum Tradable Size For Instrument
|
134
58
|
def get_maximum_trade_size(self, instId, tdMode, ccy='', px='', leverage='',unSpotOffset=''):
|
135
|
-
"""
|
136
|
-
获取单个产品最大可交易量
|
137
|
-
:param instId: 产品ID
|
138
|
-
:param tdMode: 交易模式
|
139
|
-
:param ccy: 币种
|
140
|
-
:param px: 价格
|
141
|
-
:param leverage: 杠杆倍数
|
142
|
-
:param unSpotOffset: 现货对冲模式下,对手方交易账户中的对手币种余额
|
143
|
-
:return: 响应数据
|
144
|
-
"""
|
145
59
|
params = {'instId': instId, 'tdMode': tdMode, 'ccy': ccy, 'px': px, 'leverage':leverage,'unSpotOffset':unSpotOffset}
|
146
60
|
return self._request_with_params(GET, MAX_TRADE_SIZE, params)
|
147
61
|
|
148
|
-
#
|
62
|
+
# Get Maximum Available Tradable Amount
|
149
63
|
def get_max_avail_size(self, instId, tdMode, ccy='', reduceOnly='', unSpotOffset='',quickMgnType='',px=''):
|
150
|
-
"""
|
151
|
-
获取最大可用交易量
|
152
|
-
:param instId: 产品ID
|
153
|
-
:param tdMode: 交易模式
|
154
|
-
:param ccy: 币种
|
155
|
-
:param reduceOnly: 是否只减仓
|
156
|
-
:param unSpotOffset: 现货对冲模式下,对手方交易账户中的对手币种余额
|
157
|
-
:param quickMgnType: 快捷杠杆类型
|
158
|
-
:param px: 价格
|
159
|
-
:return: 响应数据
|
160
|
-
"""
|
161
64
|
params = {'instId': instId, 'tdMode': tdMode, 'ccy': ccy, 'reduceOnly': reduceOnly,
|
162
65
|
'unSpotOffset':unSpotOffset,'quickMgnType':quickMgnType,'px': px}
|
163
66
|
return self._request_with_params(GET, MAX_AVAIL_SIZE, params)
|
164
67
|
|
165
|
-
#
|
68
|
+
# Increase / Decrease margin
|
166
69
|
def Adjustment_margin(self, instId, posSide, type, amt,loanTrans=''):
|
167
|
-
"""
|
168
|
-
调整保证金
|
169
|
-
:param instId: 产品ID
|
170
|
-
:param posSide: 持仓方向
|
171
|
-
:param type: 调整类型
|
172
|
-
:param amt: 调整金额
|
173
|
-
:param loanTrans: 借币还币场景
|
174
|
-
:return: 响应数据
|
175
|
-
"""
|
176
70
|
params = {'instId': instId, 'posSide': posSide, 'type': type, 'amt': amt,'loanTrans':loanTrans}
|
177
71
|
return self._request_with_params(POST, ADJUSTMENT_MARGIN, params)
|
178
72
|
|
179
|
-
#
|
73
|
+
# Get Leverage
|
180
74
|
def get_leverage(self, instId, mgnMode, ccy):
|
181
|
-
"""
|
182
|
-
获取杠杆倍数
|
183
|
-
:param instId: 产品ID
|
184
|
-
:param mgnMode: 保证金模式
|
185
|
-
:param ccy: 币种
|
186
|
-
:return: 响应数据
|
187
|
-
"""
|
188
75
|
params = {'instId': instId, 'mgnMode': mgnMode, 'ccy':ccy}
|
189
76
|
return self._request_with_params(GET, GET_LEVERAGE, params)
|
190
77
|
|
191
|
-
#
|
78
|
+
# Get the maximum loan of isolated MARGIN
|
192
79
|
def get_max_load(self, instId, mgnMode, mgnCcy):
|
193
|
-
"""
|
194
|
-
获取逐仓最大可借币量
|
195
|
-
:param instId: 产品ID
|
196
|
-
:param mgnMode: 保证金模式
|
197
|
-
:param mgnCcy: 保证金币种
|
198
|
-
:return: 响应数据
|
199
|
-
"""
|
200
80
|
params = {'instId': instId, 'mgnMode': mgnMode, 'mgnCcy': mgnCcy}
|
201
81
|
return self._request_with_params(GET, MAX_LOAN, params)
|
202
82
|
|
203
|
-
#
|
83
|
+
# Get Fee Rates
|
204
84
|
def get_fee_rates(self, instType = '', instId='', uly='', category='', instFamily='',ruleType = ''):
|
205
|
-
"""
|
206
|
-
获取手续费率
|
207
|
-
:param instType: 产品类型
|
208
|
-
:param instId: 产品ID
|
209
|
-
:param uly: 标的指数
|
210
|
-
:param category: 市场分类
|
211
|
-
:param instFamily: 产品族
|
212
|
-
:param ruleType: 规则类型
|
213
|
-
:return: 响应数据
|
214
|
-
"""
|
215
85
|
params = {'instType': instType, 'instId': instId, 'uly': uly, 'category': category,'instFamily':instFamily,'ruleType':ruleType}
|
216
86
|
return self._request_with_params(GET, FEE_RATES, params)
|
217
87
|
|
218
|
-
#
|
88
|
+
# Get interest-accrued
|
219
89
|
def get_interest_accrued(self, instId='', ccy='', mgnMode='', after='', before='', limit='', type=''):
|
220
|
-
"""
|
221
|
-
获取计息记录
|
222
|
-
:param instId: 产品ID
|
223
|
-
:param ccy: 币种
|
224
|
-
:param mgnMode: 保证金模式
|
225
|
-
:param after: 查询ID的起始点
|
226
|
-
:param before: 查询ID的结束点
|
227
|
-
:param limit: 返回结果的数量
|
228
|
-
:param type: 利率类型
|
229
|
-
:return: 响应数据
|
230
|
-
"""
|
231
90
|
params = {'instId': instId, 'ccy': ccy, 'mgnMode': mgnMode, 'after': after, 'before': before, 'limit': limit, 'type':type}
|
232
91
|
return self._request_with_params(GET, INTEREST_ACCRUED, params)
|
233
92
|
|
234
|
-
#
|
93
|
+
# Get interest-accrued
|
235
94
|
def get_interest_rate(self, ccy=''):
|
236
|
-
"""
|
237
|
-
获取借币利率
|
238
|
-
:param ccy: 币种
|
239
|
-
:return: 响应数据
|
240
|
-
"""
|
241
95
|
params = {'ccy': ccy}
|
242
96
|
return self._request_with_params(GET, INTEREST_RATE, params)
|
243
97
|
|
244
|
-
#
|
98
|
+
# Set Greeks (PA/BS)
|
245
99
|
def set_greeks(self, greeksType):
|
246
|
-
"""
|
247
|
-
设置Greeks (PA/BS)
|
248
|
-
:param greeksType: Greeks类型
|
249
|
-
:return: 响应数据
|
250
|
-
"""
|
251
100
|
params = {'greeksType': greeksType}
|
252
101
|
return self._request_with_params(POST, SET_GREEKS, params)
|
253
102
|
|
254
|
-
#
|
103
|
+
# Set Isolated Mode
|
255
104
|
def set_isolated_mode(self, isoMode,type):
|
256
|
-
"""
|
257
|
-
设置逐仓模式
|
258
|
-
:param isoMode: 逐仓模式
|
259
|
-
:param type: 类型
|
260
|
-
:return: 响应数据
|
261
|
-
"""
|
262
105
|
params = {'isoMode': isoMode, 'type':type}
|
263
106
|
return self._request_with_params(POST, ISOLATED_MODE, params)
|
264
107
|
|
265
|
-
#
|
108
|
+
# Get Maximum Withdrawals
|
266
109
|
def get_max_withdrawal(self, ccy=''):
|
267
|
-
"""
|
268
|
-
获取最大提币量
|
269
|
-
:param ccy: 币种
|
270
|
-
:return: 响应数据
|
271
|
-
"""
|
272
110
|
params = {'ccy': ccy}
|
273
111
|
return self._request_with_params(GET, MAX_WITHDRAWAL, params)
|
274
112
|
|
275
|
-
#
|
113
|
+
# Get account risk state
|
276
114
|
def get_account_risk(self):
|
277
|
-
"""
|
278
|
-
获取账户风险状态
|
279
|
-
:return: 响应数据
|
280
|
-
"""
|
281
115
|
return self._request_without_params(GET, ACCOUNT_RISK)
|
282
116
|
|
283
|
-
#
|
117
|
+
# Get borrow repay
|
284
118
|
def borrow_repay(self, ccy='', side='', amt='', ordId = ''):
|
285
|
-
"""
|
286
|
-
借币/还币
|
287
|
-
:param ccy: 币种
|
288
|
-
:param side: 方向 (borrow:借入, repay:归还)
|
289
|
-
:param amt: 数量
|
290
|
-
:param ordId: 订单ID
|
291
|
-
:return: 响应数据
|
292
|
-
"""
|
293
119
|
params = {'ccy': ccy, 'side': side, 'amt': amt, 'ordId':ordId}
|
294
120
|
return self._request_with_params(POST, BORROW_REPAY, params)
|
295
121
|
|
296
|
-
#
|
122
|
+
# Get borrow repay history
|
297
123
|
def get_borrow_repay_history(self, ccy='', after='', before='', limit=''):
|
298
|
-
"""
|
299
|
-
获取借币/还币历史
|
300
|
-
:param ccy: 币种
|
301
|
-
:param after: 查询ID的起始点
|
302
|
-
:param before: 查询ID的结束点
|
303
|
-
:param limit: 返回结果的数量
|
304
|
-
:return: 响应数据
|
305
|
-
"""
|
306
124
|
params = {'ccy': ccy, 'after': after, 'before': before, 'limit':limit}
|
307
125
|
return self._request_with_params(GET, BORROW_REPAY_HISTORY, params)
|
308
126
|
|
309
|
-
#
|
127
|
+
# Get Obtain borrowing rate and limit
|
310
128
|
def get_interest_limits(self, type='',ccy=''):
|
311
|
-
"""
|
312
|
-
获取借币利率及限额
|
313
|
-
:param type: 类型
|
314
|
-
:param ccy: 币种
|
315
|
-
:return: 响应数据
|
316
|
-
"""
|
317
129
|
params = {'type': type, 'ccy': ccy}
|
318
130
|
return self._request_with_params(GET, INTEREST_LIMITS, params)
|
319
131
|
|
320
|
-
#
|
132
|
+
# Get Simulated Margin
|
321
133
|
def get_simulated_margin(self, instType ='',inclRealPos='',spotOffsetType='',simPos=[]):
|
322
|
-
"""
|
323
|
-
获取模拟保证金
|
324
|
-
:param instType: 产品类型
|
325
|
-
:param inclRealPos: 是否包含真实仓位
|
326
|
-
:param spotOffsetType: 现货对冲模式类型
|
327
|
-
:param simPos: 模拟持仓
|
328
|
-
:return: 响应数据
|
329
|
-
"""
|
330
134
|
params = {'instType': instType, 'inclRealPos': inclRealPos,'spotOffsetType':spotOffsetType,'simPos': simPos}
|
331
135
|
return self._request_with_params(POST, SIMULATED_MARGIN, params)
|
332
136
|
|
333
|
-
#
|
137
|
+
# Get Greeks
|
334
138
|
def get_greeks(self, ccy=''):
|
335
|
-
"""
|
336
|
-
获取Greeks
|
337
|
-
:param ccy: 币种
|
338
|
-
:return: 响应数据
|
339
|
-
"""
|
340
139
|
params = {'ccy': ccy,}
|
341
140
|
return self._request_with_params(GET, GREEKS, params)
|
342
141
|
|
343
142
|
def get_positions_history(self, instType='', instId = '', mgnMode = '', type = '', after = '', before = '', limit = '', posId = ''):
|
344
|
-
"""
|
345
|
-
获取历史持仓信息
|
346
|
-
:param instType: 产品类型
|
347
|
-
:param instId: 产品ID
|
348
|
-
:param mgnMode: 保证金模式
|
349
|
-
:param type: 类型
|
350
|
-
:param after: 查询ID的起始点
|
351
|
-
:param before: 查询ID的结束点
|
352
|
-
:param limit: 返回结果的数量
|
353
|
-
:param posId: 持仓ID
|
354
|
-
:return: 响应数据
|
355
|
-
"""
|
356
143
|
params = {'instType': instType, 'instId':instId, 'mgnMode':mgnMode, 'type':type, 'after':after, 'before':before, 'limit':limit, 'posId':posId}
|
357
144
|
return self._request_with_params(GET, POSITIONS_HISTORY, params)
|
358
145
|
|
359
146
|
def position_tiers(self, instType='',uly=''):
|
360
|
-
"""
|
361
|
-
获取持仓档位
|
362
|
-
:param instType: 产品类型
|
363
|
-
:param uly: 标的指数
|
364
|
-
:return: 响应数据
|
365
|
-
"""
|
366
147
|
params = {'instType': instType, 'uly': uly}
|
367
148
|
return self._request_with_params(GET, POSITION_TIRES, params)
|
368
149
|
|
369
150
|
def activate_option(self):
|
370
|
-
"""
|
371
|
-
激活期权
|
372
|
-
:return: 响应数据
|
373
|
-
"""
|
374
151
|
params = {}
|
375
152
|
return self._request_with_params(POST, ACTIVATE_OPTION, params)
|
376
153
|
|
377
154
|
def set_auto_loan(self,autoLoan = ''):
|
378
|
-
"""
|
379
|
-
设置自动借币
|
380
|
-
:param autoLoan: 是否自动借币
|
381
|
-
:return: 响应数据
|
382
|
-
"""
|
383
155
|
params = {'autoLoan':autoLoan}
|
384
156
|
return self._request_with_params(POST, SET_AUTO_LOAN, params)
|
385
157
|
|
386
158
|
def quick_margin_borrow_repay(self, instId='', ccy='', side='', amt=''):
|
387
|
-
"""
|
388
|
-
快捷杠杆借币/还币
|
389
|
-
:param instId: 产品ID
|
390
|
-
:param ccy: 币种
|
391
|
-
:param side: 方向 (borrow:借入, repay:归还)
|
392
|
-
:param amt: 数量
|
393
|
-
:return: 响应数据
|
394
|
-
"""
|
395
159
|
params = {'instId':instId, 'ccy':ccy, 'side':side, 'amt':amt}
|
396
160
|
return self._request_with_params(POST, QUICK_MARGIN_BRROW_REPAY, params)
|
397
161
|
|
398
162
|
def quick_margin_borrow_repay_history(self, instId='', ccy='', side='', after='', before='', begin='', end='', limit=''):
|
399
|
-
"""
|
400
|
-
获取快捷杠杆借币/还币历史
|
401
|
-
:param instId: 产品ID
|
402
|
-
:param ccy: 币种
|
403
|
-
:param side: 方向 (borrow:借入, repay:归还)
|
404
|
-
:param after: 查询ID的起始点
|
405
|
-
:param before: 查询ID的结束点
|
406
|
-
:param begin: 起始时间戳
|
407
|
-
:param end: 结束时间戳
|
408
|
-
:param limit: 返回结果的数量
|
409
|
-
:return: 响应数据
|
410
|
-
"""
|
411
163
|
params = {'instId': instId, 'ccy': ccy, 'side': side, 'after': after, 'before': before, 'begin': begin, 'end': end, 'limit': limit}
|
412
164
|
return self._request_with_params(GET, QUICK_MARGIN_BORROW_REPAY_HISTORY, params)
|
413
165
|
|
414
166
|
# GET /api/v5/account/vip-interest-accrued
|
415
167
|
def vip_interest_accrued(self, ccy = '', ordId = '', after = '', before = '', limit = ''):
|
416
|
-
"""
|
417
|
-
获取VIP计息记录
|
418
|
-
:param ccy: 币种
|
419
|
-
:param ordId: 订单ID
|
420
|
-
:param after: 查询ID的起始点
|
421
|
-
:param before: 查询ID的结束点
|
422
|
-
:param limit: 返回结果的数量
|
423
|
-
:return: 响应数据
|
424
|
-
"""
|
425
168
|
params = {'ccy': ccy, 'ordId': ordId, 'after': after, 'before': before, 'limit': limit}
|
426
169
|
return self._request_with_params(GET, VIP_INTEREST_ACCRUED, params)
|
427
170
|
|
428
171
|
# GET /api/v5/account/vip-interest-deducted
|
429
172
|
def vip_interest_deducted(self, ccy = '', ordId = '', after = '', before = '', limit = ''):
|
430
|
-
"""
|
431
|
-
获取VIP扣息记录
|
432
|
-
:param ccy: 币种
|
433
|
-
:param ordId: 订单ID
|
434
|
-
:param after: 查询ID的起始点
|
435
|
-
:param before: 查询ID的结束点
|
436
|
-
:param limit: 返回结果的数量
|
437
|
-
:return: 响应数据
|
438
|
-
"""
|
439
173
|
params = {'ccy': ccy, 'ordId': ordId, 'after': after, 'before': before, 'limit': limit}
|
440
174
|
return self._request_with_params(GET, VIP_INTEREST_DEDUCTED, params)
|
441
175
|
|
442
176
|
# GET /api/v5/account/vip-loan-order-list
|
443
177
|
def vip_loan_order_list(self, ordId = '', state = '', ccy = '', after = '', before = '', limit = ''):
|
444
|
-
"""
|
445
|
-
获取VIP借贷订单列表
|
446
|
-
:param ordId: 订单ID
|
447
|
-
:param state: 订单状态
|
448
|
-
:param ccy: 币种
|
449
|
-
:param after: 查询ID的起始点
|
450
|
-
:param before: 查询ID的结束点
|
451
|
-
:param limit: 返回结果的数量
|
452
|
-
:return: 响应数据
|
453
|
-
"""
|
454
178
|
params = {'ordId': ordId, 'state': state, 'ccy': ccy, 'after': after, 'before': before, 'limit': limit}
|
455
179
|
return self._request_with_params(GET, VIP_LOAN_ORDER_LIST, params)
|
456
180
|
|
457
181
|
# GET /api/v5/account/vip-loan-order-detail
|
458
182
|
def vip_loan_order_detail(self, ccy = '', ordId = '', after = '', before = '', limit = ''):
|
459
|
-
"""
|
460
|
-
获取VIP借贷订单详情
|
461
|
-
:param ccy: 币种
|
462
|
-
:param ordId: 订单ID
|
463
|
-
:param after: 查询ID的起始点
|
464
|
-
:param before: 查询ID的结束点
|
465
|
-
:param limit: 返回结果的数量
|
466
|
-
:return: 响应数据
|
467
|
-
"""
|
468
183
|
params = {'ccy': ccy, 'ordId': ordId, 'after': after, 'before': before, 'limit': limit}
|
469
184
|
return self._request_with_params(GET, VIP_LOAN_ORDER_DETAIL, params)
|
470
185
|
|
471
186
|
# POST /api/v5/account/subaccount/set-loan-allocation
|
472
187
|
def set_loan_allocation(self, enable, alloc:[]):
|
473
|
-
"""
|
474
|
-
设置借贷分配
|
475
|
-
:param enable: 是否启用
|
476
|
-
:param alloc: 分配列表
|
477
|
-
:return: 响应数据
|
478
|
-
"""
|
479
188
|
params = {'enable': enable, 'alloc': alloc}
|
480
189
|
return self._request_with_params(POST, SET_LOAN_ALLOCATION, params)
|
481
190
|
|
482
191
|
# GET /api/v5/account/subaccount/interest-limits
|
483
192
|
def interest_limits(self, subAcct = '', ccy = ''):
|
484
|
-
"""
|
485
|
-
获取子账户借币限额
|
486
|
-
:param subAcct: 子账户名称
|
487
|
-
:param ccy: 币种
|
488
|
-
:return: 响应数据
|
489
|
-
"""
|
490
193
|
params = {'subAcct': subAcct, 'ccy': ccy}
|
491
194
|
return self._request_with_params(GET, INTEREST_LIMITS, params)
|
492
195
|
|
493
196
|
# POST /api/v5/account/set-riskOffset-type
|
494
197
|
def set_riskOffset_type(self, type = ''):
|
495
|
-
"""
|
496
|
-
设置风险对冲类型
|
497
|
-
:param type: 风险对冲类型
|
498
|
-
:return: 响应数据
|
499
|
-
"""
|
500
198
|
params = {'type':type}
|
501
199
|
return self._request_with_params(POST, SET_RISKOFFSET_TYPE, params)
|
502
200
|
|
503
201
|
# POST /api/v5/account/mmp-reset
|
504
202
|
def mmp_reset(self,instType,instFamily):
|
505
|
-
"""
|
506
|
-
MMP重置
|
507
|
-
:param instType: 产品类型
|
508
|
-
:param instFamily: 产品族
|
509
|
-
:return: 响应数据
|
510
|
-
"""
|
511
203
|
params = {'instType': instType,'instFamily':instFamily}
|
512
204
|
return self._request_with_params(POST, MMP_RESET, params)
|
513
205
|
|
514
206
|
# POST /api/v5/account/mmp-config
|
515
207
|
def mmp_config(self,instFamily,timeInterval,frozenInterval,qtyLimit):
|
516
|
-
"""
|
517
|
-
MMP配置
|
518
|
-
:param instFamily: 产品族
|
519
|
-
:param timeInterval: 时间间隔
|
520
|
-
:param frozenInterval: 冻结间隔
|
521
|
-
:param qtyLimit: 数量限制
|
522
|
-
:return: 响应数据
|
523
|
-
"""
|
524
208
|
params = {'instFamily': instFamily,'timeInterval': timeInterval,'frozenInterval': frozenInterval,'qtyLimit': qtyLimit,}
|
525
209
|
return self._request_with_params(POST, MMP_CONFIG, params)
|
526
210
|
|
527
211
|
# GET /api/v5/account/mmp-config
|
528
212
|
def mmp(self,instFamily):
|
529
|
-
"""
|
530
|
-
获取MMP配置
|
531
|
-
:param instFamily: 产品族
|
532
|
-
:return: 响应数据
|
533
|
-
"""
|
534
213
|
params = {'instFamily': instFamily}
|
535
214
|
return self._request_with_params(GET, MMP, params)
|
536
215
|
|
537
216
|
# POST /api/v5/account/set-account-level
|
538
217
|
def set_account_level(self,acctLv):
|
539
|
-
"""
|
540
|
-
设置账户等级
|
541
|
-
:param acctLv: 账户等级
|
542
|
-
:return: 响应数据
|
543
|
-
"""
|
544
218
|
params = {'acctLv': acctLv}
|
545
219
|
return self._request_with_params(POST, SET_ACCOUNT_LEVEL, params)
|
546
220
|
|
547
221
|
|
548
222
|
def position_builder(self,inclRealPosAndEq='',spotOffsetType='',simPos='',simAsset='',
|
549
223
|
greeksType='',):
|
550
|
-
"""
|
551
|
-
持仓构建器
|
552
|
-
:param inclRealPosAndEq: 是否包含真实持仓和权益
|
553
|
-
:param spotOffsetType: 现货对冲模式类型
|
554
|
-
:param simPos: 模拟持仓
|
555
|
-
:param simAsset: 模拟资产
|
556
|
-
:param greeksType: Greeks类型
|
557
|
-
:return: 响应数据
|
558
|
-
"""
|
559
224
|
params = {'acctLv': acctLv, 'spotOffsetType': spotOffsetType, 'simPos': simPos, 'simAsset': simAsset,
|
560
225
|
'greeksType': greeksType, }
|
561
226
|
return self._request_with_params(POST, POSITION_BUILDER, params)
|
@@ -563,229 +228,103 @@ class AccountAPI(Client):
|
|
563
228
|
|
564
229
|
# POST /api/v5/account/set-riskOffset-amt
|
565
230
|
def set_riskOffset_amt(self,ccy = '', clSpotInUseAmt = ''):
|
566
|
-
"""
|
567
|
-
设置风险对冲金额
|
568
|
-
:param ccy: 币种
|
569
|
-
:param clSpotInUseAmt: 现货对冲使用金额
|
570
|
-
:return: 响应数据
|
571
|
-
"""
|
572
231
|
params = {'ccy': ccy, 'clSpotInUseAmt': clSpotInUseAmt}
|
573
232
|
return self._request_with_params(POST, SET_RISKOFFSET_AMT, params)
|
574
233
|
|
575
234
|
# GET /api/v5/account/fixed-loan/borrowing-limit
|
576
235
|
def get_fixed_loan_borrowing_limit(self):
|
577
|
-
"""
|
578
|
-
获取固收借贷限额
|
579
|
-
:return: 响应数据
|
580
|
-
"""
|
581
236
|
params = {}
|
582
237
|
return self._request_with_params(GET, GET_FIXED_LOAN_BORROWING_LIMIT, params)
|
583
238
|
|
584
239
|
# GET /api/v5/account/fixed-loan/borrowing-quote
|
585
240
|
def get_fixed_loan_borrowing_quote(self,type = '', ccy = '', amt = '', maxRate = '', term = '', ordId = ''):
|
586
|
-
"""
|
587
|
-
获取固收借贷报价
|
588
|
-
:param type: 类型
|
589
|
-
:param ccy: 币种
|
590
|
-
:param amt: 数量
|
591
|
-
:param maxRate: 最大利率
|
592
|
-
:param term: 期限
|
593
|
-
:param ordId: 订单ID
|
594
|
-
:return: 响应数据
|
595
|
-
"""
|
596
241
|
params = {'type':type, 'ccy':ccy, 'amt':amt, 'maxRate':maxRate, 'maxRate':maxRate, 'term':term, 'ordId':ordId}
|
597
242
|
return self._request_with_params(GET, GET_FIXED_LOAN_BORROWING_QUOTE, params)
|
598
243
|
|
599
244
|
|
600
245
|
# POST /api/v5/account/fixed-loan/borrowing-order
|
601
246
|
def fixed_loan_borrowing_order(self,ccy = '', amt = '', maxRate = '', term = '', reborrow = '', reborrowRate = ''):
|
602
|
-
"""
|
603
|
-
固收借贷下单
|
604
|
-
:param ccy: 币种
|
605
|
-
:param amt: 数量
|
606
|
-
:param maxRate: 最大利率
|
607
|
-
:param term: 期限
|
608
|
-
:param reborrow: 是否续借
|
609
|
-
:param reborrowRate: 续借利率
|
610
|
-
:return: 响应数据
|
611
|
-
"""
|
612
247
|
params = {'ccy':ccy, 'amt':amt, 'maxRate':maxRate, 'term':term, 'reborrow':reborrow, 'reborrowRate':reborrowRate}
|
613
248
|
return self._request_with_params(POST, FIXED_LOAN_BORROWING_ORDER, params)
|
614
249
|
|
615
250
|
|
616
251
|
# POST /api/v5/account/fixed-loan/amend-borrowing-order
|
617
252
|
def fixed_loan_amend_borrowing_order(self,ordId = '', reborrow = '', renewMaxRate = ''):
|
618
|
-
"""
|
619
|
-
修改固收借贷订单
|
620
|
-
:param ordId: 订单ID
|
621
|
-
:param reborrow: 是否续借
|
622
|
-
:param renewMaxRate: 续借最大利率
|
623
|
-
:return: 响应数据
|
624
|
-
"""
|
625
253
|
params = {'ordId':ordId, 'reborrow':reborrow, 'renewMaxRate':renewMaxRate}
|
626
254
|
return self._request_with_params(POST, FIXED_LOAN_AMEND_BORROWING_ORDER, params)
|
627
255
|
|
628
256
|
|
629
257
|
# POST /api/v5/account/fixed-loan/manual-reborrow
|
630
258
|
def fixed_loan_manual_reborrow(self,ordId = '', maxRate = ''):
|
631
|
-
"""
|
632
|
-
手动续借固收借贷订单
|
633
|
-
:param ordId: 订单ID
|
634
|
-
:param maxRate: 最大利率
|
635
|
-
:return: 响应数据
|
636
|
-
"""
|
637
259
|
params = {'ordId':ordId, 'maxRate':maxRate}
|
638
260
|
return self._request_with_params(POST, FIXED_LOAN_MANUAL_BORROWING, params)
|
639
261
|
|
640
262
|
# POST /api/v5/account/fixed-loan/repay-borrowing-order
|
641
263
|
def fixed_loan_repay_borrowing_order(self,ordId = ''):
|
642
|
-
"""
|
643
|
-
归还固收借贷订单
|
644
|
-
:param ordId: 订单ID
|
645
|
-
:return: 响应数据
|
646
|
-
"""
|
647
264
|
params = {'ordId':ordId}
|
648
265
|
return self._request_with_params(POST, FIXED_LOAN_REPAY_BORROWING_ORDER, params)
|
649
266
|
|
650
267
|
|
651
268
|
# GET /api/v5/account/fixed-loan/borrowing-orders-list
|
652
269
|
def get_fixed_loan_borrowing_orders_list(self,ordId = '', ccy = '', state = '', after = '', before = '',limit = '',term = ''):
|
653
|
-
"""
|
654
|
-
获取固收借贷订单列表
|
655
|
-
:param ordId: 订单ID
|
656
|
-
:param ccy: 币种
|
657
|
-
:param state: 状态
|
658
|
-
:param after: 查询ID的起始点
|
659
|
-
:param before: 查询ID的结束点
|
660
|
-
:param limit: 返回结果的数量
|
661
|
-
:param term: 期限
|
662
|
-
:return: 响应数据
|
663
|
-
"""
|
664
270
|
params = {'ordId':ordId, 'ccy':ccy, 'state':state, 'after':after, 'before':before, 'limit':limit, 'term':term}
|
665
271
|
return self._request_with_params(GET, GET_FIXED_LOAN_BORROWING_ORDERS_LIST, params)
|
666
272
|
|
667
273
|
# GET /api/v5/account/instruments
|
668
274
|
def get_account_instruments(self,instType = '', uly = '', instFamily = '', instId = ''):
|
669
|
-
"""
|
670
|
-
获取账户产品信息
|
671
|
-
:param instType: 产品类型
|
672
|
-
:param uly: 标的指数
|
673
|
-
:param instFamily: 产品族
|
674
|
-
:param instId: 产品ID
|
675
|
-
:return: 响应数据
|
676
|
-
"""
|
677
275
|
params = {'instType':instType, 'uly':uly, 'instFamily':instFamily, 'instId':instId}
|
678
276
|
return self._request_with_params(GET, GET_ACCOUNT_INSTRUMENTS, params)
|
679
277
|
|
680
278
|
|
681
279
|
# POST /api/v5/account/spot-manual-borrow-repay
|
682
280
|
def spot_manual_borrow_repay(self,ccy = '', side = '', amt = ''):
|
683
|
-
"""
|
684
|
-
现货手动借币/还币
|
685
|
-
:param ccy: 币种
|
686
|
-
:param side: 方向 (borrow:借入, repay:归还)
|
687
|
-
:param amt: 数量
|
688
|
-
:return: 响应数据
|
689
|
-
"""
|
690
281
|
params = {'ccy':ccy, 'side':side, 'amt':amt}
|
691
282
|
return self._request_with_params(POST, SPOT_MANUAL_BORROW_REPAY, params)
|
692
283
|
|
693
284
|
|
694
285
|
# POST /api/v5/account/set-auto-repay
|
695
286
|
def set_auto_repay(self,autoRepay = ''):
|
696
|
-
"""
|
697
|
-
设置自动还币
|
698
|
-
:param autoRepay: 是否自动还币
|
699
|
-
:return: 响应数据
|
700
|
-
"""
|
701
287
|
params = {'autoRepay':autoRepay}
|
702
288
|
return self._request_with_params(POST, SET_AUTO_REPAY, params)
|
703
289
|
|
704
290
|
|
705
291
|
# GET /api/v5/account/spot-borrow-repay-history
|
706
292
|
def get_spot_borrow_repay_history(self,ccy = '', type = '', after = '', before = '', limit = ''):
|
707
|
-
"""
|
708
|
-
获取现货借币/还币历史
|
709
|
-
:param ccy: 币种
|
710
|
-
:param type: 类型
|
711
|
-
:param after: 查询ID的起始点
|
712
|
-
:param before: 查询ID的结束点
|
713
|
-
:param limit: 返回结果的数量
|
714
|
-
:return: 响应数据
|
715
|
-
"""
|
716
293
|
params = {'ccy':ccy, 'type':type, 'after':after, 'before':before, 'limit':limit}
|
717
294
|
return self._request_with_params(GET, GET_SPOT_BORROW_REPAY_HISTORY, params)
|
718
295
|
|
719
296
|
# POST /api/v5/account/fixed-loan/convert-to-market-loan
|
720
297
|
def convert_to_market_loan(self,ordId = ''):
|
721
|
-
"""
|
722
|
-
转换为市场借贷
|
723
|
-
:param ordId: 订单ID
|
724
|
-
:return: 响应数据
|
725
|
-
"""
|
726
298
|
params = {'ordId':ordId}
|
727
299
|
return self._request_with_params(POST, CONVERT_TO_MARKET_LOAN, params)
|
728
300
|
|
729
301
|
# POST /api/v5/account/fixed-loan/reduce-liabilities
|
730
302
|
def reduce_liabilities(self,ordId = '',pendingRepay = ''):
|
731
|
-
"""
|
732
|
-
减少负债
|
733
|
-
:param ordId: 订单ID
|
734
|
-
:param pendingRepay: 待还金额
|
735
|
-
:return: 响应数据
|
736
|
-
"""
|
737
303
|
params = {'ordId':ordId,'pendingRepay':pendingRepay}
|
738
304
|
return self._request_with_params(POST, REDYCE_LIABILITIES, params)
|
739
|
-
|
305
|
+
|
740
306
|
# GET /api/v5/trade/account-rate-limit
|
741
307
|
def account_rate_limit(self,):
|
742
|
-
"""
|
743
|
-
获取账户限速
|
744
|
-
:return: 响应数据
|
745
|
-
"""
|
746
308
|
params = {}
|
747
309
|
return self._request_with_params(GET, ACC_RATE_LIMIT, params)
|
748
310
|
|
749
311
|
# POST /api/v5/account/bills-history-archive
|
750
312
|
def bills_history_archive(self,year = '', quarter = ''):
|
751
|
-
"""
|
752
|
-
账单历史归档
|
753
|
-
:param year: 年份
|
754
|
-
:param quarter: 季度
|
755
|
-
:return: 响应数据
|
756
|
-
"""
|
757
313
|
params = {'year':year, 'quarter':quarter}
|
758
314
|
return self._request_with_params(POST, BILLS_HISTORY_ARCHIVE, params)
|
759
315
|
|
760
316
|
# GET /api/v5/account/bills-history-archive
|
761
317
|
def get_bills_history_archive(self, year = '', quarter = ''):
|
762
|
-
"""
|
763
|
-
获取账单历史归档
|
764
|
-
:param year: 年份
|
765
|
-
:param quarter: 季度
|
766
|
-
:return: 响应数据
|
767
|
-
"""
|
768
318
|
params = {'year':year, 'quarter':quarter}
|
769
319
|
return self._request_with_params(GET, GET_BILLS_HISTORY_ARCHIVE, params)
|
770
320
|
|
771
321
|
# POST /api/v5/account/account-level-switch-preset
|
772
322
|
def account_level_switch_preset(self,acctLv = '', lever = '', riskOffsetType = ''):
|
773
|
-
"""
|
774
|
-
账户等级切换预设
|
775
|
-
:param acctLv: 账户等级
|
776
|
-
:param lever: 杠杆倍数
|
777
|
-
:param riskOffsetType: 风险对冲类型
|
778
|
-
:return: 响应数据
|
779
|
-
"""
|
780
323
|
params = {'acctLv':acctLv, 'lever':lever, 'riskOffsetType':riskOffsetType}
|
781
324
|
return self._request_with_params(POST, ACCOUNT_LEVEL_SWITCH_PRESET, params)
|
782
325
|
|
783
326
|
# GET /api/v5/account/set-account-switch-precheck
|
784
327
|
def set_account_switch_precheck(self, acctLv = ''):
|
785
|
-
"""
|
786
|
-
设置账户切换预检
|
787
|
-
:param acctLv: 账户等级
|
788
|
-
:return: 响应数据
|
789
|
-
"""
|
790
328
|
params = {'acctLv':acctLv}
|
791
329
|
return self._request_with_params(GET, SET_ACCOUNT_SWITCH_PRECHECK, params)
|
330
|
+
|