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/Copytrading_api.py
CHANGED
@@ -3,67 +3,23 @@ from .consts import *
|
|
3
3
|
|
4
4
|
|
5
5
|
class CopytradingAPI(Client):
|
6
|
-
"""
|
7
|
-
跟单交易API客户端
|
8
|
-
继承自Client类,提供了跟单交易相关的API接口
|
9
|
-
"""
|
10
6
|
|
11
7
|
def __init__(self, api_key, api_secret_key, passphrase, use_server_time=False, flag='1'):
|
12
|
-
"""
|
13
|
-
初始化CopytradingAPI客户端
|
14
|
-
:param api_key: API Key
|
15
|
-
:param api_secret_key: Secret Key
|
16
|
-
:param passphrase: 交易密码
|
17
|
-
:param use_server_time: 是否使用服务器时间,默认为False
|
18
|
-
:param flag: 请求类型,默认为'1'
|
19
|
-
"""
|
20
8
|
Client.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag)
|
21
9
|
|
22
10
|
# GET /api/v5/copytrading/current-subpositions
|
23
11
|
def current_subpositions(self, instId='',after='', before='', limit='',uniqueCode='',subPosType=''):
|
24
|
-
"""
|
25
|
-
获取当前跟单子仓位列表 (交易员/带单员)
|
26
|
-
:param instId: 标的ID
|
27
|
-
:param after: 查询ID,分页用
|
28
|
-
:param before: 查询ID,分页用
|
29
|
-
:param limit: 返回结果集数量,默认100
|
30
|
-
:param uniqueCode: 交易员唯一编码
|
31
|
-
:param subPosType: 子仓类型
|
32
|
-
:return: 当前跟单子仓位列表
|
33
|
-
"""
|
34
12
|
params = {'instId': instId, 'after': after, 'before': before, 'limit': limit,'uniqueCode': uniqueCode,'subPosType': subPosType, }
|
35
13
|
return self._request_with_params(GET, CURRENT_SUBPOSITIONS, params)
|
36
14
|
|
37
15
|
# GET /api/v5/copytrading/subpositions-history
|
38
16
|
def subpositions_history(self, instId='', after='', before='', limit='',subPosType=''):
|
39
|
-
"""
|
40
|
-
获取跟单历史子仓位列表 (交易员/带单员)
|
41
|
-
:param instId: 标的ID
|
42
|
-
:param after: 查询ID,分页用
|
43
|
-
:param before: 查询ID,分页用
|
44
|
-
:param limit: 返回结果集数量,默认100
|
45
|
-
:param subPosType: 子仓类型
|
46
|
-
:return: 跟单历史子仓位列表
|
47
|
-
"""
|
48
17
|
params = {'instId': instId, 'after': after, 'before': before, 'limit': limit,'subPosType':subPosType}
|
49
18
|
return self._request_with_params(GET, SUBPOSITIONS_HISTORY, params)
|
50
19
|
|
51
20
|
# POST /api/v5/copytrading/algo-order
|
52
21
|
def copytrading_algo_order(self, subPosId='', tpTriggerPx='', slTriggerPx='', tpTriggerPxType='',
|
53
22
|
slTriggerPxType='', tag='',subPosType='',tpOrdPx='',slOrdPx=''):
|
54
|
-
"""
|
55
|
-
设置跟单止盈止损订单 (交易员/带单员)
|
56
|
-
:param subPosId: 子仓ID
|
57
|
-
:param tpTriggerPx: 止盈触发价
|
58
|
-
:param slTriggerPx: 止损触发价
|
59
|
-
:param tpTriggerPxType: 止盈触发价类型
|
60
|
-
:param slTriggerPxType: 止损触发价类型
|
61
|
-
:param tag: 自定义标签
|
62
|
-
:param subPosType: 子仓类型
|
63
|
-
:param tpOrdPx: 止盈委托价格
|
64
|
-
:param slOrdPx: 止损委托价格
|
65
|
-
:return: 止盈止损订单结果
|
66
|
-
"""
|
67
23
|
params = {'subPosId': subPosId, 'tpTriggerPx': tpTriggerPx,'tpOrdPx': tpOrdPx,'slOrdPx': slOrdPx,
|
68
24
|
'slTriggerPx': slTriggerPx, 'tpTriggerPxType': tpTriggerPxType,
|
69
25
|
'slTriggerPxType': slTriggerPxType,'tag':tag,'subPosType':subPosType}
|
@@ -71,64 +27,31 @@ class CopytradingAPI(Client):
|
|
71
27
|
|
72
28
|
# POST /api/v5/copytrading/close-subposition
|
73
29
|
def copytrading_close_subposition(self, subPosId='',tag='',subPosType='',ordType='',px=''):
|
74
|
-
"""
|
75
|
-
平仓跟单子仓位 (交易员/带单员)
|
76
|
-
:param subPosId: 子仓ID
|
77
|
-
:param tag: 自定义标签
|
78
|
-
:param subPosType: 子仓类型
|
79
|
-
:param ordType: 订单类型
|
80
|
-
:param px: 委托价格
|
81
|
-
:return: 平仓结果
|
82
|
-
"""
|
83
30
|
params = {'subPosId': subPosId,'tag':tag,"subPosType":subPosType,"ordType":ordType,'px':px}
|
84
31
|
return self._request_with_params(POST, COPYTRADING_CLOSE_POS, params)
|
85
32
|
|
86
33
|
# GET /api/v5/copytrading/instruments
|
87
34
|
def copytrading_instruments(self):
|
88
|
-
"""
|
89
|
-
获取跟单交易员交易对 (带单员)
|
90
|
-
:return: 跟单交易员交易对列表
|
91
|
-
"""
|
92
35
|
params = {}
|
93
36
|
return self._request_with_params(GET, COPYTRADING_INSTRUMENTS, params)
|
94
37
|
|
95
38
|
# POST /api/v5/copytrading/set-instruments
|
96
39
|
def copytrading_set_instruments(self, instId=''):
|
97
|
-
"""
|
98
|
-
设置跟单交易员交易对 (带单员)
|
99
|
-
:param instId: 交易对ID
|
100
|
-
:return: 设置结果
|
101
|
-
"""
|
102
40
|
params = {'instId': instId}
|
103
41
|
return self._request_with_params(POST, COPYTRADING_SET_INSTRUMENTS, params)
|
104
42
|
|
105
43
|
# GET /api/v5/copytrading/profit-sharing-details
|
106
44
|
def profit_sharing_details(self, after='', before='', limit=''):
|
107
|
-
"""
|
108
|
-
获取跟单员分润明细 (交易员)
|
109
|
-
:param after: 查询ID,分页用
|
110
|
-
:param before: 查询ID,分页用
|
111
|
-
:param limit: 返回结果集数量,默认100
|
112
|
-
:return: 跟单员分润明细列表
|
113
|
-
"""
|
114
45
|
params = {'after': after, 'before': before, 'limit': limit}
|
115
46
|
return self._request_with_params(GET, PROFIT_SHARING_DETAILS, params)
|
116
47
|
|
117
48
|
# GET /api/v5/copytrading/total-profit-sharing
|
118
49
|
def total_profit_sharing(self):
|
119
|
-
"""
|
120
|
-
获取总分润收益 (交易员)
|
121
|
-
:return: 总分润收益
|
122
|
-
"""
|
123
50
|
params = {}
|
124
51
|
return self._request_with_params(GET, TOTAL_PROFIT_SHARING, params)
|
125
52
|
|
126
53
|
# GET /api/v5/copytrading/unrealized-profit-sharing-details
|
127
54
|
def unrealized_profit_sharing_details(self):
|
128
|
-
"""
|
129
|
-
获取未结算分润明细 (交易员)
|
130
|
-
:return: 未结算分润明细
|
131
|
-
"""
|
132
55
|
params = {}
|
133
56
|
return self._request_with_params(GET, UNREALIZED_PROFIT_SHARING_DETAILS, params)
|
134
57
|
|
@@ -136,23 +59,6 @@ class CopytradingAPI(Client):
|
|
136
59
|
def first_copy_settings(self,instType='',uniqueCode='',copyMgnMode='',copyInstIdType='',instId='',copyMode='',
|
137
60
|
copyTotalAmt='',copyAmt='',copyRatio='',tpRatio='',slRatio='',slTotalAmt='',
|
138
61
|
subPosCloseType=''):
|
139
|
-
"""
|
140
|
-
首次设置跟单参数 (交易员)
|
141
|
-
:param instType: 产品类型
|
142
|
-
:param uniqueCode: 交易员唯一编码
|
143
|
-
:param copyMgnMode: 跟单保证金模式
|
144
|
-
:param copyInstIdType: 跟单交易对类型
|
145
|
-
:param instId: 标的ID
|
146
|
-
:param copyMode: 跟单模式
|
147
|
-
:param copyTotalAmt: 跟单总金额
|
148
|
-
:param copyAmt: 单笔跟单金额
|
149
|
-
:param copyRatio: 跟单比例
|
150
|
-
:param tpRatio: 止盈比例
|
151
|
-
:param slRatio: 止损比例
|
152
|
-
:param slTotalAmt: 总止损金额
|
153
|
-
:param subPosCloseType: 子仓平仓类型
|
154
|
-
:return: 设置结果
|
155
|
-
"""
|
156
62
|
params = {'instType':instType,'uniqueCode':uniqueCode,'copyMgnMode':copyMgnMode,'copyInstIdType':copyInstIdType,'instId':instId,'copyMode':copyMode,
|
157
63
|
'copyTotalAmt':copyTotalAmt,'copyAmt':copyAmt,'copyRatio':copyRatio,'tpRatio':tpRatio,'slRatio':slRatio,
|
158
64
|
'slTotalAmt':slTotalAmt,'subPosCloseType':subPosCloseType,}
|
@@ -162,23 +68,6 @@ class CopytradingAPI(Client):
|
|
162
68
|
def amend_copy_settings(self,instType='',uniqueCode='',copyMgnMode='',copyInstIdType='',instId='',copyMode='',
|
163
69
|
copyTotalAmt='',copyAmt='',copyRatio='',tpRatio='',slRatio='',slTotalAmt='',
|
164
70
|
subPosCloseType=''):
|
165
|
-
"""
|
166
|
-
修改跟单参数 (交易员)
|
167
|
-
:param instType: 产品类型
|
168
|
-
:param uniqueCode: 交易员唯一编码
|
169
|
-
:param copyMgnMode: 跟单保证金模式
|
170
|
-
:param copyInstIdType: 跟单交易对类型
|
171
|
-
:param instId: 标的ID
|
172
|
-
:param copyMode: 跟单模式
|
173
|
-
:param copyTotalAmt: 跟单总金额
|
174
|
-
:param copyAmt: 单笔跟单金额
|
175
|
-
:param copyRatio: 跟单比例
|
176
|
-
:param tpRatio: 止盈比例
|
177
|
-
:param slRatio: 止损比例
|
178
|
-
:param slTotalAmt: 总止损金额
|
179
|
-
:param subPosCloseType: 子仓平仓类型
|
180
|
-
:return: 修改结果
|
181
|
-
"""
|
182
71
|
params = {'instType':instType,'uniqueCode':uniqueCode,'copyMgnMode':copyMgnMode,'copyInstIdType':copyInstIdType,'instId':instId,'copyMode':copyMode,
|
183
72
|
'copyTotalAmt':copyTotalAmt,'copyAmt':copyAmt,'copyRatio':copyRatio,'tpRatio':tpRatio,'slRatio':slRatio,
|
184
73
|
'slTotalAmt':slTotalAmt,'subPosCloseType':subPosCloseType,}
|
@@ -186,92 +75,37 @@ class CopytradingAPI(Client):
|
|
186
75
|
|
187
76
|
# POST /api/v5/copytrading/stop-copy-trading
|
188
77
|
def stop_copy_trading(self,instType='',uniqueCode='',subPosCloseType=''):
|
189
|
-
"""
|
190
|
-
停止跟单 (交易员)
|
191
|
-
:param instType: 产品类型
|
192
|
-
:param uniqueCode: 交易员唯一编码
|
193
|
-
:param subPosCloseType: 子仓平仓类型
|
194
|
-
:return: 停止结果
|
195
|
-
"""
|
196
78
|
params = {'instType':instType,'uniqueCode':uniqueCode,'subPosCloseType':subPosCloseType,}
|
197
79
|
return self._request_with_params(POST, STOP_COPY_SETTINGS, params)
|
198
80
|
|
199
81
|
# GET /api/v5/copytrading/copy-trading
|
200
82
|
def copy_settings(self,instType='',uniqueCode=''):
|
201
|
-
"""
|
202
|
-
获取跟单参数 (交易员)
|
203
|
-
:param instType: 产品类型
|
204
|
-
:param uniqueCode: 交易员唯一编码
|
205
|
-
:return: 跟单参数
|
206
|
-
"""
|
207
83
|
params = {'instType':instType,'uniqueCode':uniqueCode,}
|
208
84
|
return self._request_with_params(GET, COPY_SETTINGS, params)
|
209
85
|
|
210
86
|
# GET /api/v5/copytrading/batch-leverage-info
|
211
87
|
def batch_leverage_inf(self,mgnMode='',uniqueCode='',instId=''):
|
212
|
-
"""
|
213
|
-
批量获取交易员杠杆信息 (交易员)
|
214
|
-
:param mgnMode: 保证金模式
|
215
|
-
:param uniqueCode: 交易员唯一编码
|
216
|
-
:param instId: 标的ID
|
217
|
-
:return: 杠杆信息列表
|
218
|
-
"""
|
219
88
|
params = {'mgnMode':mgnMode,'uniqueCode':uniqueCode,'instId':instId,}
|
220
89
|
return self._request_with_params(GET, BATCH_LEVERAGE_INF, params)
|
221
90
|
|
222
91
|
# POST /api/v5/copytrading/batch-set-leverage
|
223
92
|
def batch_set_leverage(self,mgnMode='',lever='',instId=''):
|
224
|
-
"""
|
225
|
-
批量设置交易员杠杆 (交易员)
|
226
|
-
:param mgnMode: 保证金模式
|
227
|
-
:param lever: 杠杆倍数
|
228
|
-
:param instId: 标的ID
|
229
|
-
:return: 设置结果
|
230
|
-
"""
|
231
93
|
params = {'mgnMode':mgnMode,'lever':lever,'instId':instId,}
|
232
94
|
return self._request_with_params(POST, BATCH_SET_LEVERAGE, params)
|
233
95
|
|
234
96
|
# GET /api/v5/copytrading/current-lead-traders
|
235
97
|
def current_lead_traders(self,instType='',):
|
236
|
-
"""
|
237
|
-
获取当前带单员列表 (带单员)
|
238
|
-
:param instType: 产品类型
|
239
|
-
:return: 当前带单员列表
|
240
|
-
"""
|
241
98
|
params = {'instType':instType,}
|
242
99
|
return self._request_with_params(GET, CURRENT_LEAD_TRADERS, params)
|
243
100
|
|
244
101
|
# GET /api/v5/copytrading/lead-traders-history
|
245
102
|
def lead_traders_history(self, instType='',after='',before='',limit='', ):
|
246
|
-
"""
|
247
|
-
获取历史带单员列表 (带单员)
|
248
|
-
:param instType: 产品类型
|
249
|
-
:param after: 查询ID,分页用
|
250
|
-
:param before: 查询ID,分页用
|
251
|
-
:param limit: 返回结果集数量,默认100
|
252
|
-
:return: 历史带单员列表
|
253
|
-
"""
|
254
103
|
params = {'instType': instType,'after': after,'before': before,'limit': limit, }
|
255
104
|
return self._request_with_params(GET, LEAD_TRADERS_HISTORY, params)
|
256
105
|
|
257
106
|
# GET /api/v5/copytrading/public-lead-traders
|
258
107
|
def public_lead_traders(instType='',sortType='',state='',minLeadDays='',minAssets='',maxAssets='',
|
259
108
|
minAum='',maxAum='',dataVer='',page='',limit=''):
|
260
|
-
"""
|
261
|
-
获取公共带单员列表
|
262
|
-
:param instType: 产品类型
|
263
|
-
:param sortType: 排序类型
|
264
|
-
:param state: 状态
|
265
|
-
:param minLeadDays: 最少带单天数
|
266
|
-
:param minAssets: 最少资产
|
267
|
-
:param maxAssets: 最多资产
|
268
|
-
:param minAum: 最少管理资产
|
269
|
-
:param maxAum: 最多管理资产
|
270
|
-
:param dataVer: 数据版本
|
271
|
-
:param page: 页码
|
272
|
-
:param limit: 返回结果集数量,默认100
|
273
|
-
:return: 公共带单员列表
|
274
|
-
"""
|
275
109
|
params = {'instType': sortType, 'sortType': sortType, 'state': state, 'minLeadDays': minLeadDays,
|
276
110
|
'minAssets': minAssets, 'maxAssets': maxAssets, 'minAum': minAum, 'maxAum': maxAum,
|
277
111
|
'dataVer': dataVer, 'page': page, 'limit': limit,
|
@@ -280,127 +114,51 @@ class CopytradingAPI(Client):
|
|
280
114
|
|
281
115
|
# GET /api/v5/copytrading/public-weekly-pnl
|
282
116
|
def public_weekly_pnl(self, instType='', uniqueCode=''):
|
283
|
-
"""
|
284
|
-
获取公共带单员周Pnl数据
|
285
|
-
:param instType: 产品类型
|
286
|
-
:param uniqueCode: 交易员唯一编码
|
287
|
-
:return: 周Pnl数据
|
288
|
-
"""
|
289
117
|
params = {'instType': instType, 'uniqueCode': uniqueCode, }
|
290
118
|
return self._request_with_params(GET, PUBLIC_WEEKLY_PNL, params)
|
291
119
|
|
292
120
|
# GET /api/v5/copytrading/public-pnl
|
293
121
|
def public_pnl(self, instType='', uniqueCode='',lastDays=''):
|
294
|
-
"""
|
295
|
-
获取公共带单员Pnl数据
|
296
|
-
:param instType: 产品类型
|
297
|
-
:param uniqueCode: 交易员唯一编码
|
298
|
-
:param lastDays: 最近天数
|
299
|
-
:return: Pnl数据
|
300
|
-
"""
|
301
122
|
params = {'instType': instType, 'uniqueCode': uniqueCode, 'lastDays': lastDays}
|
302
123
|
return self._request_with_params(GET, PUBLIC_PNL, params)
|
303
124
|
|
304
125
|
# GET /api/v5/copytrading/public-stats
|
305
126
|
def public_stats(self, instType='', uniqueCode='', lastDays=''):
|
306
|
-
"""
|
307
|
-
获取公共带单员统计数据
|
308
|
-
:param instType: 产品类型
|
309
|
-
:param uniqueCode: 交易员唯一编码
|
310
|
-
:param lastDays: 最近天数
|
311
|
-
:return: 统计数据
|
312
|
-
"""
|
313
127
|
params = {'instType': instType, 'uniqueCode': uniqueCode, 'lastDays': lastDays}
|
314
128
|
return self._request_with_params(GET, PUBLIC_STATS, params)
|
315
129
|
|
316
130
|
# GET /api/v5/copytrading/public-preference-currency
|
317
131
|
def public_preference_currency(self, instType='', uniqueCode=''):
|
318
|
-
"""
|
319
|
-
获取公共带单员偏好币种
|
320
|
-
:param instType: 产品类型
|
321
|
-
:param uniqueCode: 交易员唯一编码
|
322
|
-
:return: 偏好币种
|
323
|
-
"""
|
324
132
|
params = {'instType': instType, 'uniqueCode': uniqueCode, }
|
325
133
|
return self._request_with_params(GET, PUBLIC_PRE_CURR, params)
|
326
134
|
|
327
135
|
|
328
136
|
# GET /api/v5/copytrading/public-current-subpositions
|
329
137
|
def public_current_subpositions(self, after='', before='', limit='', instType='', uniqueCode=''):
|
330
|
-
"""
|
331
|
-
获取公共带单员当前跟单子仓位列表
|
332
|
-
:param after: 查询ID,分页用
|
333
|
-
:param before: 查询ID,分页用
|
334
|
-
:param limit: 返回结果集数量,默认100
|
335
|
-
:param instType: 产品类型
|
336
|
-
:param uniqueCode: 交易员唯一编码
|
337
|
-
:return: 公共带单员当前跟单子仓位列表
|
338
|
-
"""
|
339
138
|
params = {'instType': instType,'after': after,'before': before,'limit': limit, 'uniqueCode':uniqueCode}
|
340
139
|
return self._request_with_params(GET, PUBLIC_CURR_SUBPOS, params)
|
341
140
|
|
342
141
|
# GET /api/v5/copytrading/public-subpositions-history
|
343
142
|
def public_subpositions_history(self, after='', before='', limit='', instType='', uniqueCode=''):
|
344
|
-
"""
|
345
|
-
获取公共带单员历史跟单子仓位列表
|
346
|
-
:param after: 查询ID,分页用
|
347
|
-
:param before: 查询ID,分页用
|
348
|
-
:param limit: 返回结果集数量,默认100
|
349
|
-
:param instType: 产品类型
|
350
|
-
:param uniqueCode: 交易员唯一编码
|
351
|
-
:return: 公共带单员历史跟单子仓位列表
|
352
|
-
"""
|
353
143
|
params = {'instType': instType, 'after': after, 'before': before, 'limit': limit, 'uniqueCode': uniqueCode}
|
354
144
|
return self._request_with_params(GET, PUBLIC_SUBPOS_HIS, params)
|
355
145
|
|
356
146
|
def apply_lead_trading(self, instType='',instId='', ):
|
357
|
-
"""
|
358
|
-
申请带单
|
359
|
-
:param instType: 产品类型
|
360
|
-
:param instId: 标的ID
|
361
|
-
:return: 申请结果
|
362
|
-
"""
|
363
147
|
params = {'instType': instType, 'instId': instId,}
|
364
148
|
return self._request_with_params(POST, APP_LEA_TRAD, params)
|
365
149
|
|
366
150
|
def stop_lead_trading(self, instType='',):
|
367
|
-
"""
|
368
|
-
停止带单
|
369
|
-
:param instType: 产品类型
|
370
|
-
:return: 停止结果
|
371
|
-
"""
|
372
151
|
params = {'instType': instType,}
|
373
152
|
return self._request_with_params(POST, STOP_LEA_TRAD, params)
|
374
153
|
|
375
154
|
|
376
155
|
def amend_profit_sharing_ratio(self, instType='',profitSharingRatio=''):
|
377
|
-
"""
|
378
|
-
修改分润比例 (带单员)
|
379
|
-
:param instType: 产品类型
|
380
|
-
:param profitSharingRatio: 分润比例
|
381
|
-
:return: 修改结果
|
382
|
-
"""
|
383
156
|
params = {'instType': instType,'profitSharingRatio': profitSharingRatio}
|
384
157
|
return self._request_with_params(POST, AMEDN_PRO_SHAR_RATIO, params)
|
385
158
|
|
386
159
|
|
387
160
|
def lead_traders(self, instType='',sortType='',state='',minLeadDays='',minAssets='',maxAssets='',
|
388
161
|
minAum='',maxAum='',dataVer='',page='',limit='',):
|
389
|
-
"""
|
390
|
-
获取带单员列表 (交易员)
|
391
|
-
:param instType: 产品类型
|
392
|
-
:param sortType: 排序类型
|
393
|
-
:param state: 状态
|
394
|
-
:param minLeadDays: 最少带单天数
|
395
|
-
:param minAssets: 最少资产
|
396
|
-
:param maxAssets: 最多资产
|
397
|
-
:param minAum: 最少管理资产
|
398
|
-
:param maxAum: 最多管理资产
|
399
|
-
:param dataVer: 数据版本
|
400
|
-
:param page: 页码
|
401
|
-
:param limit: 返回结果集数量,默认100
|
402
|
-
:return: 带单员列表
|
403
|
-
"""
|
404
162
|
params = {'instType': instType,'sortType': sortType,'state': state,'minLeadDays': minLeadDays,
|
405
163
|
'minAssets': minAssets,'maxAssets': maxAssets,'minAum': minAum,'maxAum': maxAum,
|
406
164
|
'dataVer': dataVer,'page': page,'limit': limit,}
|
@@ -408,117 +166,52 @@ class CopytradingAPI(Client):
|
|
408
166
|
|
409
167
|
|
410
168
|
def weekly_pnl(self, instType='',uniqueCode=''):
|
411
|
-
"""
|
412
|
-
获取交易员周Pnl数据 (交易员)
|
413
|
-
:param instType: 产品类型
|
414
|
-
:param uniqueCode: 交易员唯一编码
|
415
|
-
:return: 周Pnl数据
|
416
|
-
"""
|
417
169
|
params = {'instType': instType,'uniqueCode': uniqueCode,}
|
418
170
|
return self._request_with_params(GET, WEEKLY_PNL, params)
|
419
171
|
|
420
172
|
|
421
173
|
def pnl(self, instType='',uniqueCode='',lastDays = ''):
|
422
|
-
"""
|
423
|
-
获取交易员Pnl数据 (交易员)
|
424
|
-
:param instType: 产品类型
|
425
|
-
:param uniqueCode: 交易员唯一编码
|
426
|
-
:param lastDays: 最近天数
|
427
|
-
:return: Pnl数据
|
428
|
-
"""
|
429
174
|
params = {'instType': instType,'uniqueCode': uniqueCode,'lastDays': lastDays,}
|
430
175
|
return self._request_with_params(GET, PNL, params)
|
431
176
|
|
432
177
|
|
433
178
|
def stats(self, instType='',uniqueCode='',lastDays = ''):
|
434
|
-
"""
|
435
|
-
获取交易员统计数据 (交易员)
|
436
|
-
:param instType: 产品类型
|
437
|
-
:param uniqueCode: 交易员唯一编码
|
438
|
-
:param lastDays: 最近天数
|
439
|
-
:return: 统计数据
|
440
|
-
"""
|
441
179
|
params = {'instType': instType,'uniqueCode': uniqueCode,'lastDays': lastDays,}
|
442
180
|
return self._request_with_params(GET, STATS, params)
|
443
181
|
|
444
182
|
|
445
183
|
def preference_currency(self, instType='',uniqueCode=''):
|
446
|
-
"""
|
447
|
-
获取交易员偏好币种 (交易员)
|
448
|
-
:param instType: 产品类型
|
449
|
-
:param uniqueCode: 交易员唯一编码
|
450
|
-
:return: 偏好币种
|
451
|
-
"""
|
452
184
|
params = {'instType': instType,'uniqueCode': uniqueCode,}
|
453
185
|
return self._request_with_params(GET, PRE_CURR, params)
|
454
186
|
|
455
187
|
|
456
188
|
def performance_current_subpositions(self, instType='',uniqueCode='', after='', before='', limit='', ):
|
457
|
-
"""
|
458
|
-
获取交易员当前跟单子仓位列表 (交易员)
|
459
|
-
:param instType: 产品类型
|
460
|
-
:param uniqueCode: 交易员唯一编码
|
461
|
-
:param after: 查询ID,分页用
|
462
|
-
:param before: 查询ID,分页用
|
463
|
-
:param limit: 返回结果集数量,默认100
|
464
|
-
:return: 交易员当前跟单子仓位列表
|
465
|
-
"""
|
466
189
|
params = {'instType': instType,'uniqueCode': uniqueCode,'after': after,'before': before,'limit': limit, }
|
467
190
|
return self._request_with_params(GET, PRE_CURR_SUNPOSITION, params)
|
468
191
|
|
469
192
|
|
470
193
|
def performance_subpositions_history(self, instType='',uniqueCode='', after='', before='', limit='', ):
|
471
|
-
"""
|
472
|
-
获取交易员历史跟单子仓位列表 (交易员)
|
473
|
-
:param instType: 产品类型
|
474
|
-
:param uniqueCode: 交易员唯一编码
|
475
|
-
:param after: 查询ID,分页用
|
476
|
-
:param before: 查询ID,分页用
|
477
|
-
:param limit: 返回结果集数量,默认100
|
478
|
-
:return: 交易员历史跟单子仓位列表
|
479
|
-
"""
|
480
194
|
params = {'instType': instType,'uniqueCode': uniqueCode,'after': after,'before': before,'limit': limit, }
|
481
195
|
return self._request_with_params(GET, PRE_SUNPOSITION_HISTORY, params)
|
482
196
|
|
483
197
|
|
484
198
|
def copy_traders(self, instType='',uniqueCode='', limit='', ):
|
485
|
-
"""
|
486
|
-
获取跟单员列表 (带单员)
|
487
|
-
:param instType: 产品类型
|
488
|
-
:param uniqueCode: 交易员唯一编码
|
489
|
-
:param limit: 返回结果集数量,默认100
|
490
|
-
:return: 跟单员列表
|
491
|
-
"""
|
492
199
|
params = {'instType': instType,'uniqueCode': uniqueCode,'limit': limit, }
|
493
200
|
return self._request_with_params(GET, COPY_TRADERS, params)
|
494
201
|
|
495
202
|
|
496
203
|
def public_copy_traders(self, instType='',uniqueCode='', limit='', ):
|
497
|
-
"""
|
498
|
-
获取公共跟单员列表 (带单员)
|
499
|
-
:param instType: 产品类型
|
500
|
-
:param uniqueCode: 交易员唯一编码
|
501
|
-
:param limit: 返回结果集数量,默认100
|
502
|
-
:return: 公共跟单员列表
|
503
|
-
"""
|
504
204
|
params = {'instType': instType,'uniqueCode': uniqueCode,'limit': limit, }
|
505
205
|
return self._request_with_params(GET, PUB_COPY_TRADERS, params)
|
506
206
|
|
507
207
|
|
508
208
|
def config(self, ):
|
509
|
-
"""
|
510
|
-
获取跟单配置 (交易员/带单员)
|
511
|
-
:return: 跟单配置
|
512
|
-
"""
|
513
209
|
params = {}
|
514
210
|
return self._request_with_params(GET, CONFIG, params)
|
515
211
|
|
516
212
|
|
517
213
|
def total_unrealized_profit_sharing(self, instType = ''):
|
518
|
-
"""
|
519
|
-
获取未结算总分润收益 (交易员)
|
520
|
-
:param instType: 产品类型
|
521
|
-
:return: 未结算总分润收益
|
522
|
-
"""
|
523
214
|
params = {'instType':instType}
|
524
215
|
return self._request_with_params(GET, TOTAL_UNREA_PRO_SHAR, params)
|
216
|
+
|
217
|
+
|
okxv5/FDBroker_api.py
CHANGED
@@ -1,33 +1,19 @@
|
|
1
|
-
# 从 .client 模块导入 Client 类
|
2
1
|
from .client import Client
|
3
|
-
# 从 .consts 模块导入所有常量
|
4
2
|
from .consts import *
|
5
3
|
|
6
4
|
|
7
|
-
# FDBrokerAPI 类,继承自 Client 类
|
8
5
|
class FDBrokerAPI(Client):
|
9
|
-
# 构造函数
|
10
6
|
def __init__(self, api_key, api_secret_key, passphrase, use_server_time=False, flag='1'):
|
11
|
-
# 调用父类 Client 的构造函数进行初始化
|
12
7
|
Client.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag)
|
13
8
|
|
14
|
-
|
15
|
-
|
16
|
-
# 构建请求参数字典
|
17
|
-
params = {'begin': begin, 'end': end, 'brokerType': brokerType}
|
18
|
-
# 发送 POST 请求并返回结果
|
9
|
+
def fd_rebate_per_orders(self, begin = '', end = '', brokerType = ''):
|
10
|
+
params = {'begin': begin, 'end': end, 'brokerType':brokerType}
|
19
11
|
return self._request_with_params(POST, FD_REBATE_PER_ORDERS, params)
|
20
12
|
|
21
|
-
|
22
|
-
|
23
|
-
# 构建请求参数字典
|
24
|
-
params = {'type': type, 'begin': begin, 'end': end, 'brokerType': brokerType}
|
25
|
-
# 发送 GET 请求并返回结果
|
13
|
+
def fd_get_rebate_per_orders(self, type = '', begin = '', end = '', brokerType = ''):
|
14
|
+
params = {'type': type, 'begin': begin, 'end': end, 'brokerType':brokerType}
|
26
15
|
return self._request_with_params(GET, FD_GET_REBATE_PER_ORDERS, params)
|
27
16
|
|
28
|
-
|
29
|
-
|
30
|
-
# 构建请求参数字典
|
31
|
-
params = {'apiKey': apiKey, 'brokerType': brokerType}
|
32
|
-
# 发送 GET 请求并返回结果
|
17
|
+
def fd_if_rebate(self, apiKey = '', brokerType = ''):
|
18
|
+
params = {'apiKey': apiKey, 'brokerType':brokerType}
|
33
19
|
return self._request_with_params(GET, FD_IF_REBATE, params)
|