okxv5 1.8.10__py3-none-any.whl → 1.8.12__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.12.dist-info/METADATA +915 -0
- okxv5-1.8.12.dist-info/RECORD +28 -0
- okxv5/hunyuan_client.py +0 -74
- okxv5-1.8.10.dist-info/METADATA +0 -58
- okxv5-1.8.10.dist-info/RECORD +0 -29
- {okxv5-1.8.10.dist-info → okxv5-1.8.12.dist-info}/WHEEL +0 -0
- {okxv5-1.8.10.dist-info → okxv5-1.8.12.dist-info}/top_level.txt +0 -0
okxv5/Affiliate_api.py
CHANGED
@@ -1,16 +1,8 @@
|
|
1
|
-
from .client import Client
|
2
|
-
from .consts import *
|
1
|
+
from .client import Client
|
2
|
+
from .consts import *
|
3
3
|
|
4
4
|
|
5
|
-
class AffiliateAPI(Client):
|
5
|
+
class AffiliateAPI(Client):
|
6
6
|
|
7
7
|
def __init__(self, api_key, api_secret_key, passphrase, use_server_time=False, flag='1'):
|
8
|
-
|
9
|
-
# 参数:
|
10
|
-
# api_key: API 密钥
|
11
|
-
# api_secret_key: API 秘密密钥
|
12
|
-
# passphrase: 交易密码
|
13
|
-
# use_server_time: 是否使用服务器时间,默认为 False
|
14
|
-
# flag: 标志位,默认为 '1'
|
15
|
-
Client.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag)
|
16
|
-
# 调用父类 Client 的构造函数来初始化父类部分
|
8
|
+
Client.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag)
|
okxv5/Broker_api.py
CHANGED
@@ -3,274 +3,97 @@ from .consts import *
|
|
3
3
|
|
4
4
|
|
5
5
|
class BrokerAPI(Client):
|
6
|
-
"""
|
7
|
-
BrokerAPI 类继承自 Client,用于处理经纪商相关的 API 请求。
|
8
|
-
"""
|
9
6
|
def __init__(self, api_key, api_secret_key, passphrase, use_server_time=False, flag='1'):
|
10
|
-
"""
|
11
|
-
构造函数,初始化 BrokerAPI 实例。
|
12
|
-
:param api_key: API 密钥
|
13
|
-
:param api_secret_key: API 私钥
|
14
|
-
:param passphrase: 密码
|
15
|
-
:param use_server_time: 是否使用服务器时间,默认为 False
|
16
|
-
:param flag: 区域标志,默认为 '1'
|
17
|
-
"""
|
18
7
|
Client.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag)
|
19
8
|
|
20
9
|
def broker_info(self):
|
21
|
-
"""
|
22
|
-
获取经纪商信息。
|
23
|
-
:return: API 请求结果
|
24
|
-
"""
|
25
10
|
params = {}
|
26
11
|
return self._request_with_params(GET, BROKER_INFO, params)
|
27
12
|
|
28
13
|
def create_subaccount(self, subAcct='', label='', clientIP='',mainAcct=''):
|
29
|
-
"""
|
30
|
-
创建子账户。
|
31
|
-
:param subAcct: 子账户名称
|
32
|
-
:param label: 子账户标签
|
33
|
-
:param clientIP: 客户端 IP
|
34
|
-
:param mainAcct: 主账户名称
|
35
|
-
:return: API 请求结果
|
36
|
-
"""
|
37
14
|
params = {'subAcct': subAcct, 'label': label, 'clientIP':clientIP,'mainAcct':mainAcct}
|
38
15
|
return self._request_with_params(POST, CREATE_SUBACCOUNT, params)
|
39
16
|
|
40
17
|
def delete_subaccount(self, subAcct=''):
|
41
|
-
"""
|
42
|
-
删除子账户。
|
43
|
-
:param subAcct: 子账户名称
|
44
|
-
:return: API 请求结果
|
45
|
-
"""
|
46
18
|
params = {'subAcct': subAcct}
|
47
19
|
return self._request_with_params(POST, DELETE_SUBACCOUNT, params)
|
48
20
|
|
49
21
|
def subaccount_info(self, subAcct='', page='', limit='', uid=''):
|
50
|
-
"""
|
51
|
-
获取子账户信息。
|
52
|
-
:param subAcct: 子账户名称
|
53
|
-
:param page: 页码
|
54
|
-
:param limit: 每页限制数量
|
55
|
-
:param uid: 用户 ID
|
56
|
-
:return: API 请求结果
|
57
|
-
"""
|
58
22
|
params = {'subAcct': subAcct, 'page': page, 'limit': limit, 'uid':uid}
|
59
23
|
return self._request_with_params(GET, SUBACCOUNT_INFO, params)
|
60
24
|
|
61
25
|
def subaccount_trade_fee(self, subAcct='', page='', limit='', uid=''):
|
62
|
-
"""
|
63
|
-
获取子账户交易费率。
|
64
|
-
:param subAcct: 子账户名称
|
65
|
-
:param page: 页码
|
66
|
-
:param limit: 每页限制数量
|
67
|
-
:param uid: 用户 ID
|
68
|
-
:return: API 请求结果
|
69
|
-
"""
|
70
26
|
params = {'subAcct': subAcct, 'page': page, 'limit': limit, 'uid':uid}
|
71
27
|
return self._request_with_params(GET, SUBACCOUNT_TRADE_FEE, params)
|
72
28
|
|
73
29
|
def set_subaccount_level(self, subAcct='', acctLv=''):
|
74
|
-
"""
|
75
|
-
设置子账户等级。
|
76
|
-
:param subAcct: 子账户名称
|
77
|
-
:param acctLv: 账户等级
|
78
|
-
:return: API 请求结果
|
79
|
-
"""
|
80
30
|
params = {'subAcct': subAcct, 'acctLv': acctLv}
|
81
31
|
return self._request_with_params(POST, SET_SUBACCOUNT_LEVEL, params)
|
82
32
|
|
83
33
|
def set_subaccount_fee_rate(self, subAcct='', instType='', chgType='', chgTaker='',
|
84
34
|
chgMaker='', effDate='', mgnType='',quoteCcyType = ''):
|
85
|
-
"""
|
86
|
-
设置子账户费率。
|
87
|
-
:param subAcct: 子账户名称
|
88
|
-
:param instType: 交易产品类型
|
89
|
-
:param chgType: 费用类型
|
90
|
-
:param chgTaker: Taker 费率
|
91
|
-
:param chgMaker: Maker 费率
|
92
|
-
:param effDate: 生效日期
|
93
|
-
:param mgnType: 保证金模式
|
94
|
-
:param quoteCcyType: 报价币种类型
|
95
|
-
:return: API 请求结果
|
96
|
-
"""
|
97
35
|
params = {'subAcct': subAcct, 'instType': instType, 'chgType': chgType, 'chgTaker': chgTaker,
|
98
36
|
'chgMaker':chgMaker, 'effDate':effDate, 'mgnType':mgnType, 'quoteCcyType':quoteCcyType}
|
99
37
|
return self._request_with_params(POST, SET_SUBACCOUNT_FEE_REAT, params)
|
100
38
|
|
101
39
|
def subaccount_deposit_address(self, subAcct='', ccy='', chain='', addrType='', to=''):
|
102
|
-
"""
|
103
|
-
获取子账户充值地址。
|
104
|
-
:param subAcct: 子账户名称
|
105
|
-
:param ccy: 币种
|
106
|
-
:param chain: 链名称
|
107
|
-
:param addrType: 地址类型
|
108
|
-
:param to: 目标
|
109
|
-
:return: API 请求结果
|
110
|
-
"""
|
111
40
|
params = {'subAcct': subAcct, 'ccy': ccy, 'chain': chain, 'addrType': addrType, 'to': to}
|
112
41
|
return self._request_with_params(POST, SUBACCOUNT_DEPOSIT_ADDRESS, params)
|
113
42
|
|
114
43
|
def subaccount_deposit_history(self, subAcct = '', ccy = '', txId = '', state = '', after = '', before = '', limit = ''):
|
115
|
-
"""
|
116
|
-
获取子账户充值历史。
|
117
|
-
:param subAcct: 子账户名称
|
118
|
-
:param ccy: 币种
|
119
|
-
:param txId: 交易 ID
|
120
|
-
:param state: 状态
|
121
|
-
:param after: 查询在指定时间戳之后的数据
|
122
|
-
:param before: 查询在指定时间戳之前的数据
|
123
|
-
:param limit: 限制数量
|
124
|
-
:return: API 请求结果
|
125
|
-
"""
|
126
44
|
params = {'subAcct': subAcct, 'ccy': ccy, 'txId': txId, 'state': state, 'after': after, 'before': before, 'limit':limit}
|
127
45
|
return self._request_with_params(GET, SUBACCOUNT_DEPOSIT_HISTORY, params)
|
128
46
|
|
129
47
|
def rebate_daily(self, subAcct = '', begin = '', end = '', page = '', limit = '',
|
130
48
|
beginTime = '', endTime = ''):
|
131
|
-
"""
|
132
|
-
获取每日返佣数据。
|
133
|
-
:param subAcct: 子账户名称
|
134
|
-
:param begin: 开始日期
|
135
|
-
:param end: 结束日期
|
136
|
-
:param page: 页码
|
137
|
-
:param limit: 每页限制数量
|
138
|
-
:param beginTime: 开始时间
|
139
|
-
:param endTime: 结束时间
|
140
|
-
:return: API 请求结果
|
141
|
-
"""
|
142
49
|
params = {'subAcct': subAcct, 'begin': begin, 'end': end, 'page': page, 'limit': limit,
|
143
50
|
'beginTime':beginTime, 'endTime': endTime}
|
144
51
|
return self._request_with_params(GET, REBATE_DAILY, params)
|
145
52
|
|
146
53
|
def dma_create_apikey(self, subAcct = '', label = '', passphrase = '', ip = '', perm = ''):
|
147
|
-
"""
|
148
|
-
创建 DMA API Key。
|
149
|
-
:param subAcct: 子账户名称
|
150
|
-
:param label: 标签
|
151
|
-
:param passphrase: 密码
|
152
|
-
:param ip: IP 地址
|
153
|
-
:param perm: 权限
|
154
|
-
:return: API 请求结果
|
155
|
-
"""
|
156
54
|
params = {'subAcct': subAcct, 'label': label, 'passphrase': passphrase, 'ip': ip, 'perm': perm}
|
157
55
|
return self._request_with_params(POST, DMA_CREAET_APIKEY, params)
|
158
56
|
|
159
57
|
def dma_select_apikey(self, subAcct = '', apiKey = ''):
|
160
|
-
"""
|
161
|
-
查询 DMA API Key。
|
162
|
-
:param subAcct: 子账户名称
|
163
|
-
:param apiKey: API 密钥
|
164
|
-
:return: API 请求结果
|
165
|
-
"""
|
166
58
|
params = {'subAcct': subAcct, 'apiKey': apiKey}
|
167
59
|
return self._request_with_params(GET, DMA_SELECT_APIKEY, params)
|
168
60
|
|
169
61
|
def dma_modify_apikey(self, subAcct = '', apiKey = '', label = '', perm = '', ip = ''):
|
170
|
-
"""
|
171
|
-
修改 DMA API Key。
|
172
|
-
:param subAcct: 子账户名称
|
173
|
-
:param apiKey: API 密钥
|
174
|
-
:param label: 标签
|
175
|
-
:param perm: 权限
|
176
|
-
:param ip: IP 地址
|
177
|
-
:return: API 请求结果
|
178
|
-
"""
|
179
62
|
params = {'subAcct': subAcct, 'apiKey': apiKey, 'label': label, 'perm': perm, 'ip': ip}
|
180
63
|
return self._request_with_params(POST, DMA_MODIFY_APIKEY, params)
|
181
64
|
|
182
65
|
def dma_delete_apikey(self, subAcct = '', apiKey = ''):
|
183
|
-
"""
|
184
|
-
删除 DMA API Key。
|
185
|
-
:param subAcct: 子账户名称
|
186
|
-
:param apiKey: API 密钥
|
187
|
-
:return: API 请求结果
|
188
|
-
"""
|
189
66
|
params = {'subAcct': subAcct, 'apiKey': apiKey}
|
190
67
|
return self._request_with_params(POST, DMA_DELETE_APIKEY, params)
|
191
68
|
|
192
69
|
def rebate_per_orders(self, begin = '', end = ''):
|
193
|
-
"""
|
194
|
-
获取每笔订单返佣数据 (POST 请求)。
|
195
|
-
:param begin: 开始日期
|
196
|
-
:param end: 结束日期
|
197
|
-
:return: API 请求结果
|
198
|
-
"""
|
199
70
|
params = {'begin': begin, 'end': end}
|
200
71
|
return self._request_with_params(POST, REBATE_PER_ORDERS, params)
|
201
72
|
|
202
73
|
def get_rebate_per_orders(self, type = '', begin = '', end = ''):
|
203
|
-
"""
|
204
|
-
获取每笔订单返佣数据 (GET 请求)。
|
205
|
-
:param type: 类型
|
206
|
-
:param begin: 开始日期
|
207
|
-
:param end: 结束日期
|
208
|
-
:return: API 请求结果
|
209
|
-
"""
|
210
74
|
params = {'type': type, 'begin': begin, 'end': end}
|
211
75
|
return self._request_with_params(GET, GET_REBATE_PER_ORDERS, params)
|
212
76
|
|
213
77
|
def modify_subaccount_deposit_address(self, subAcct = '', ccy = '', chain = '', addr = '', to = ''):
|
214
|
-
"""
|
215
|
-
修改子账户充值地址。
|
216
|
-
:param subAcct: 子账户名称
|
217
|
-
:param ccy: 币种
|
218
|
-
:param chain: 链名称
|
219
|
-
:param addr: 地址
|
220
|
-
:param to: 目标
|
221
|
-
:return: API 请求结果
|
222
|
-
"""
|
223
78
|
params = {'subAcct': subAcct, 'ccy': ccy, 'chain': chain, 'addr': addr, 'to': to}
|
224
79
|
return self._request_with_params(POST, MODIFY_SUBACCOUNT_DEPOSIT_ADDRESS, params)
|
225
80
|
|
226
81
|
def nd_subaccount_withdrawal_history(self, subAcct = '', ccy = '', wdId = '', clientId = '', txId = '', type = '', state = '', after = '', before = '', limit = ''):
|
227
|
-
"""
|
228
|
-
获取 ND 子账户提现历史。
|
229
|
-
:param subAcct: 子账户名称
|
230
|
-
:param ccy: 币种
|
231
|
-
:param wdId: 提现 ID
|
232
|
-
:param clientId: 客户端 ID
|
233
|
-
:param txId: 交易 ID
|
234
|
-
:param type: 类型
|
235
|
-
:param state: 状态
|
236
|
-
:param after: 查询在指定时间戳之后的数据
|
237
|
-
:param before: 查询在指定时间戳之前的数据
|
238
|
-
:param limit: 限制数量
|
239
|
-
:return: API 请求结果
|
240
|
-
"""
|
241
82
|
params = {'subAcct': subAcct, 'ccy': ccy, 'wdId': wdId, 'clientId': clientId, 'txId': txId, 'type': type, 'state': state, 'after': after, 'before': before, 'limit': limit}
|
242
83
|
return self._request_with_params(GET, ND_SUBACCOUNT_WITHDRAWAL_HISTORY, params)
|
243
84
|
|
244
85
|
# POST /api/v5/broker/nd/set-subaccount-assets
|
245
86
|
def set_subaccount_assets(self, subAcct = '', ccy = ''):
|
246
|
-
"""
|
247
|
-
设置子账户资产。
|
248
|
-
:param subAcct: 子账户名称
|
249
|
-
:param ccy: 币种
|
250
|
-
:return: API 请求结果
|
251
|
-
"""
|
252
87
|
params = {'subAcct': subAcct, 'ccy': ccy,}
|
253
88
|
return self._request_with_params(POST, SET_SUBACCOUNT_ASSETS, params)
|
254
89
|
|
255
90
|
# POST /api/v5/broker/nd/set-subaccount-assets
|
256
91
|
def report_subaccount_ip(self, subAcct, clientIP):
|
257
|
-
"""
|
258
|
-
报告子账户 IP。
|
259
|
-
:param subAcct: 子账户名称
|
260
|
-
:param clientIP: 客户端 IP
|
261
|
-
:return: API 请求结果
|
262
|
-
"""
|
263
92
|
params = {'subAcct': subAcct, 'clientIP': clientIP,}
|
264
93
|
return self._request_with_params(POST, R_SACCOUNT_IP, params)
|
265
94
|
|
266
95
|
|
267
96
|
def if_rebate(self, apiKey='',uid='',subAcct='',):
|
268
|
-
"""
|
269
|
-
查询是否有返佣。
|
270
|
-
:param apiKey: API 密钥
|
271
|
-
:param uid: 用户 ID
|
272
|
-
:param subAcct: 子账户名称
|
273
|
-
:return: API 请求结果
|
274
|
-
"""
|
275
97
|
params = {'subAcct': subAcct, 'apiKey': apiKey,'uid': uid,}
|
276
|
-
return self._request_with_params(GET, IF_REBATE, params)
|
98
|
+
return self._request_with_params(GET, IF_REBATE, params)
|
99
|
+
|
okxv5/Convert_api.py
CHANGED
@@ -3,31 +3,25 @@ from .consts import *
|
|
3
3
|
|
4
4
|
|
5
5
|
class ConvertAPI(Client):
|
6
|
-
# 初始化
|
7
6
|
def __init__(self, api_key, api_secret_key, passphrase, use_server_time=False, flag='1'):
|
8
7
|
Client.__init__(self, api_key, api_secret_key, passphrase, use_server_time, flag)
|
9
8
|
|
10
|
-
# 获取所有币种
|
11
9
|
def get_currencies(self):
|
12
10
|
params = {}
|
13
11
|
return self._request_with_params(GET, GET_CURRENCIES, params)
|
14
12
|
|
15
|
-
# 获取指定币对信息
|
16
13
|
def get_currency_pair(self, fromCcy='', toCcy=''):
|
17
14
|
params = {"fromCcy": fromCcy, 'toCcy': toCcy}
|
18
15
|
return self._request_with_params(GET, GET_CURRENCY_PAIR, params)
|
19
16
|
|
20
|
-
# 估算兑换报价
|
21
17
|
def estimate_quote(self, baseCcy = '', quoteCcy = '', side = '', rfqSz = '', rfqSzCcy = '', clQReqId = '',tag=''):
|
22
18
|
params = {'baseCcy': baseCcy, 'quoteCcy': quoteCcy, 'side':side, 'rfqSz':rfqSz, 'rfqSzCcy':rfqSzCcy, 'clQReqId':clQReqId,'tag':tag}
|
23
19
|
return self._request_with_params(POST, ESTIMATE_QUOTE, params)
|
24
20
|
|
25
|
-
# 执行兑换交易
|
26
21
|
def convert_trade(self, quoteId = '', baseCcy = '', quoteCcy = '', side = '', sz = '', szCcy = '', clTReqId = '',tag=''):
|
27
22
|
params = {'quoteId': quoteId, 'baseCcy': baseCcy, 'quoteCcy':quoteCcy, 'side':side, 'sz':sz, 'szCcy':szCcy, 'clTReqId':clTReqId,'tag':tag}
|
28
23
|
return self._request_with_params(POST, CONVERT_TRADE, params)
|
29
24
|
|
30
|
-
# 获取兑换历史记录
|
31
25
|
def get_convert_history(self, after = '', before = '', limit = '',tag=''):
|
32
26
|
params = {'after': after, 'before': before, 'limit':limit,'tag':tag}
|
33
|
-
return self._request_with_params(GET, CONVERT_HISTORY, params)
|
27
|
+
return self._request_with_params(GET, CONVERT_HISTORY, params)
|