ccxt 4.3.27__py2.py3-none-any.whl → 4.3.29__py2.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.
Potentially problematic release.
This version of ccxt might be problematic. Click here for more details.
- ccxt/__init__.py +1 -1
- ccxt/abstract/bingx.py +88 -81
- ccxt/abstract/bitget.py +1 -0
- ccxt/abstract/bitmart.py +3 -1
- ccxt/ascendex.py +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ascendex.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/base/ws/order_book_side.py +3 -0
- ccxt/async_support/bingx.py +137 -90
- ccxt/async_support/bitget.py +1 -0
- ccxt/async_support/bitmart.py +122 -3
- ccxt/async_support/bybit.py +2 -2
- ccxt/async_support/coinbase.py +1 -1
- ccxt/async_support/krakenfutures.py +1 -1
- ccxt/async_support/kucoin.py +1 -0
- ccxt/async_support/whitebit.py +1 -1
- ccxt/base/exchange.py +3 -2
- ccxt/bingx.py +137 -90
- ccxt/bitget.py +1 -0
- ccxt/bitmart.py +122 -3
- ccxt/bybit.py +2 -2
- ccxt/coinbase.py +1 -1
- ccxt/krakenfutures.py +1 -1
- ccxt/kucoin.py +1 -0
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitfinex.py +4 -4
- ccxt/pro/bitfinex2.py +2 -2
- ccxt/pro/bitmex.py +3 -3
- ccxt/pro/blockchaincom.py +2 -2
- ccxt/pro/coinbase.py +5 -1
- ccxt/pro/cryptocom.py +4 -4
- ccxt/pro/deribit.py +9 -9
- ccxt/pro/idex.py +1 -1
- ccxt/pro/luno.py +4 -5
- ccxt/pro/mexc.py +2 -2
- ccxt/whitebit.py +1 -1
- {ccxt-4.3.27.dist-info → ccxt-4.3.29.dist-info}/METADATA +4 -4
- {ccxt-4.3.27.dist-info → ccxt-4.3.29.dist-info}/RECORD +41 -41
- {ccxt-4.3.27.dist-info → ccxt-4.3.29.dist-info}/WHEEL +0 -0
- {ccxt-4.3.27.dist-info → ccxt-4.3.29.dist-info}/top_level.txt +0 -0
ccxt/bingx.py
CHANGED
@@ -32,8 +32,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
32
32
|
'id': 'bingx',
|
33
33
|
'name': 'BingX',
|
34
34
|
'countries': ['US'], # North America, Canada, the EU, Hong Kong and Taiwan
|
35
|
-
|
36
|
-
'rateLimit': 1000,
|
35
|
+
'rateLimit': 100,
|
37
36
|
'version': 'v1',
|
38
37
|
'certified': True,
|
39
38
|
'pro': True,
|
@@ -146,44 +145,54 @@ class bingx(Exchange, ImplicitAPI):
|
|
146
145
|
'v1': {
|
147
146
|
'public': {
|
148
147
|
'get': {
|
149
|
-
'server/time':
|
150
|
-
'common/symbols':
|
151
|
-
'market/trades':
|
152
|
-
'market/depth':
|
153
|
-
'market/kline':
|
148
|
+
'server/time': 1,
|
149
|
+
'common/symbols': 1,
|
150
|
+
'market/trades': 1,
|
151
|
+
'market/depth': 1,
|
152
|
+
'market/kline': 1,
|
154
153
|
'ticker/24hr': 1,
|
154
|
+
'ticker/price': 1,
|
155
|
+
'ticker/bookTicker': 1,
|
155
156
|
},
|
156
157
|
},
|
157
158
|
'private': {
|
158
159
|
'get': {
|
159
|
-
'trade/query':
|
160
|
-
'trade/openOrders':
|
161
|
-
'trade/historyOrders':
|
162
|
-
'trade/myTrades':
|
163
|
-
'user/commissionRate':
|
164
|
-
'account/balance':
|
160
|
+
'trade/query': 1,
|
161
|
+
'trade/openOrders': 1,
|
162
|
+
'trade/historyOrders': 1,
|
163
|
+
'trade/myTrades': 2,
|
164
|
+
'user/commissionRate': 5,
|
165
|
+
'account/balance': 2,
|
165
166
|
},
|
166
167
|
'post': {
|
167
|
-
'trade/order':
|
168
|
-
'trade/cancel':
|
169
|
-
'trade/batchOrders':
|
170
|
-
'trade/order/cancelReplace':
|
171
|
-
'trade/cancelOrders':
|
172
|
-
'trade/cancelOpenOrders':
|
173
|
-
'trade/cancelAllAfter':
|
168
|
+
'trade/order': 2,
|
169
|
+
'trade/cancel': 2,
|
170
|
+
'trade/batchOrders': 5,
|
171
|
+
'trade/order/cancelReplace': 5,
|
172
|
+
'trade/cancelOrders': 5,
|
173
|
+
'trade/cancelOpenOrders': 5,
|
174
|
+
'trade/cancelAllAfter': 5,
|
175
|
+
},
|
176
|
+
},
|
177
|
+
},
|
178
|
+
'v2': {
|
179
|
+
'public': {
|
180
|
+
'get': {
|
181
|
+
'market/depth': 1,
|
182
|
+
'market/kline': 1,
|
174
183
|
},
|
175
184
|
},
|
176
185
|
},
|
177
186
|
'v3': {
|
178
187
|
'private': {
|
179
188
|
'get': {
|
180
|
-
'get/asset/transfer':
|
181
|
-
'asset/transfer':
|
182
|
-
'capital/deposit/hisrec':
|
183
|
-
'capital/withdraw/history':
|
189
|
+
'get/asset/transfer': 1,
|
190
|
+
'asset/transfer': 1,
|
191
|
+
'capital/deposit/hisrec': 1,
|
192
|
+
'capital/withdraw/history': 1,
|
184
193
|
},
|
185
194
|
'post': {
|
186
|
-
'post/asset/transfer':
|
195
|
+
'post/asset/transfer': 5,
|
187
196
|
},
|
188
197
|
},
|
189
198
|
},
|
@@ -193,26 +202,27 @@ class bingx(Exchange, ImplicitAPI):
|
|
193
202
|
'public': {
|
194
203
|
'get': {
|
195
204
|
'ticker/price': 1,
|
205
|
+
'market/historicalTrades': 1,
|
196
206
|
},
|
197
207
|
},
|
198
208
|
'private': {
|
199
209
|
'get': {
|
200
|
-
'positionSide/dual':
|
210
|
+
'positionSide/dual': 5,
|
201
211
|
'market/markPriceKlines': 1,
|
202
|
-
'trade/batchCancelReplace':
|
203
|
-
'trade/fullOrder':
|
212
|
+
'trade/batchCancelReplace': 5,
|
213
|
+
'trade/fullOrder': 2,
|
204
214
|
},
|
205
215
|
'post': {
|
206
|
-
'trade/cancelReplace':
|
207
|
-
'positionSide/dual':
|
208
|
-
'trade/closePosition':
|
216
|
+
'trade/cancelReplace': 2,
|
217
|
+
'positionSide/dual': 5,
|
218
|
+
'trade/closePosition': 2,
|
209
219
|
},
|
210
220
|
},
|
211
221
|
},
|
212
222
|
'v2': {
|
213
223
|
'public': {
|
214
224
|
'get': {
|
215
|
-
'server/time':
|
225
|
+
'server/time': 1,
|
216
226
|
'quote/contracts': 1,
|
217
227
|
'quote/price': 1,
|
218
228
|
'quote/depth': 1,
|
@@ -227,35 +237,35 @@ class bingx(Exchange, ImplicitAPI):
|
|
227
237
|
},
|
228
238
|
'private': {
|
229
239
|
'get': {
|
230
|
-
'user/balance':
|
231
|
-
'user/positions':
|
232
|
-
'user/income':
|
233
|
-
'trade/openOrders':
|
234
|
-
'trade/openOrder':
|
235
|
-
'trade/order':
|
236
|
-
'trade/marginType':
|
237
|
-
'trade/leverage':
|
238
|
-
'trade/forceOrders':
|
239
|
-
'trade/allOrders':
|
240
|
-
'trade/allFillOrders':
|
241
|
-
'user/income/export':
|
242
|
-
'user/commissionRate':
|
243
|
-
'quote/bookTicker':
|
240
|
+
'user/balance': 2,
|
241
|
+
'user/positions': 2,
|
242
|
+
'user/income': 2,
|
243
|
+
'trade/openOrders': 2,
|
244
|
+
'trade/openOrder': 2,
|
245
|
+
'trade/order': 2,
|
246
|
+
'trade/marginType': 5,
|
247
|
+
'trade/leverage': 2,
|
248
|
+
'trade/forceOrders': 1,
|
249
|
+
'trade/allOrders': 2,
|
250
|
+
'trade/allFillOrders': 2,
|
251
|
+
'user/income/export': 2,
|
252
|
+
'user/commissionRate': 2,
|
253
|
+
'quote/bookTicker': 1,
|
244
254
|
},
|
245
255
|
'post': {
|
246
|
-
'trade/order':
|
247
|
-
'trade/batchOrders':
|
248
|
-
'trade/closeAllPositions':
|
249
|
-
'trade/cancelAllAfter':
|
250
|
-
'trade/marginType':
|
251
|
-
'trade/leverage':
|
252
|
-
'trade/positionMargin':
|
253
|
-
'trade/order/test':
|
256
|
+
'trade/order': 2,
|
257
|
+
'trade/batchOrders': 2,
|
258
|
+
'trade/closeAllPositions': 2,
|
259
|
+
'trade/cancelAllAfter': 5,
|
260
|
+
'trade/marginType': 5,
|
261
|
+
'trade/leverage': 5,
|
262
|
+
'trade/positionMargin': 5,
|
263
|
+
'trade/order/test': 2,
|
254
264
|
},
|
255
265
|
'delete': {
|
256
|
-
'trade/order':
|
257
|
-
'trade/batchOrders':
|
258
|
-
'trade/allOpenOrders':
|
266
|
+
'trade/order': 2,
|
267
|
+
'trade/batchOrders': 2,
|
268
|
+
'trade/allOpenOrders': 2,
|
259
269
|
},
|
260
270
|
},
|
261
271
|
},
|
@@ -271,9 +281,9 @@ class bingx(Exchange, ImplicitAPI):
|
|
271
281
|
'v1': {
|
272
282
|
'private': {
|
273
283
|
'get': {
|
274
|
-
'allPosition':
|
275
|
-
'allOrders':
|
276
|
-
'balance':
|
284
|
+
'allPosition': 2,
|
285
|
+
'allOrders': 2,
|
286
|
+
'balance': 2,
|
277
287
|
},
|
278
288
|
},
|
279
289
|
},
|
@@ -282,18 +292,19 @@ class bingx(Exchange, ImplicitAPI):
|
|
282
292
|
'v1': {
|
283
293
|
'private': {
|
284
294
|
'get': {
|
285
|
-
'capital/config/getall':
|
286
|
-
'capital/deposit/address':
|
295
|
+
'capital/config/getall': 5,
|
296
|
+
'capital/deposit/address': 5,
|
287
297
|
'capital/innerTransfer/records': 1,
|
288
|
-
'capital/subAccount/deposit/address':
|
289
|
-
'capital/deposit/subHisrec':
|
298
|
+
'capital/subAccount/deposit/address': 5,
|
299
|
+
'capital/deposit/subHisrec': 2,
|
290
300
|
'capital/subAccount/innerTransfer/records': 1,
|
301
|
+
'capital/deposit/riskRecords': 5,
|
291
302
|
},
|
292
303
|
'post': {
|
293
|
-
'capital/withdraw/apply':
|
294
|
-
'capital/innerTransfer/apply':
|
295
|
-
'capital/subAccountInnerTransfer/apply':
|
296
|
-
'capital/deposit/createSubAddress':
|
304
|
+
'capital/withdraw/apply': 5,
|
305
|
+
'capital/innerTransfer/apply': 5,
|
306
|
+
'capital/subAccountInnerTransfer/apply': 2,
|
307
|
+
'capital/deposit/createSubAddress': 2,
|
297
308
|
},
|
298
309
|
},
|
299
310
|
},
|
@@ -302,15 +313,15 @@ class bingx(Exchange, ImplicitAPI):
|
|
302
313
|
'v1': {
|
303
314
|
'private': {
|
304
315
|
'get': {
|
305
|
-
'list':
|
306
|
-
'assets':
|
316
|
+
'list': 10,
|
317
|
+
'assets': 2,
|
307
318
|
},
|
308
319
|
'post': {
|
309
|
-
'create':
|
310
|
-
'apiKey/create':
|
311
|
-
'apiKey/edit':
|
312
|
-
'apiKey/del':
|
313
|
-
'updateStatus':
|
320
|
+
'create': 10,
|
321
|
+
'apiKey/create': 2,
|
322
|
+
'apiKey/edit': 2,
|
323
|
+
'apiKey/del': 2,
|
324
|
+
'updateStatus': 10,
|
314
325
|
},
|
315
326
|
},
|
316
327
|
},
|
@@ -320,10 +331,10 @@ class bingx(Exchange, ImplicitAPI):
|
|
320
331
|
'private': {
|
321
332
|
'get': {
|
322
333
|
'uid': 1,
|
323
|
-
'apiKey/query':
|
334
|
+
'apiKey/query': 2,
|
324
335
|
},
|
325
336
|
'post': {
|
326
|
-
'innerTransfer/authorizeSubAccount':
|
337
|
+
'innerTransfer/authorizeSubAccount': 1,
|
327
338
|
},
|
328
339
|
},
|
329
340
|
},
|
@@ -332,10 +343,13 @@ class bingx(Exchange, ImplicitAPI):
|
|
332
343
|
'auth': {
|
333
344
|
'private': {
|
334
345
|
'post': {
|
335
|
-
'userDataStream':
|
346
|
+
'userDataStream': 2,
|
336
347
|
},
|
337
348
|
'put': {
|
338
|
-
'userDataStream':
|
349
|
+
'userDataStream': 2,
|
350
|
+
},
|
351
|
+
'delete': {
|
352
|
+
'userDataStream': 2,
|
339
353
|
},
|
340
354
|
},
|
341
355
|
},
|
@@ -344,12 +358,12 @@ class bingx(Exchange, ImplicitAPI):
|
|
344
358
|
'v1': {
|
345
359
|
'private': {
|
346
360
|
'get': {
|
347
|
-
'swap/trace/currentTrack':
|
361
|
+
'swap/trace/currentTrack': 2,
|
348
362
|
},
|
349
363
|
'post': {
|
350
|
-
'swap/trace/closeTrackOrder':
|
351
|
-
'swap/trace/setTPSL':
|
352
|
-
'spot/trader/sellOrder':
|
364
|
+
'swap/trace/closeTrackOrder': 2,
|
365
|
+
'swap/trace/setTPSL': 2,
|
366
|
+
'spot/trader/sellOrder': 10,
|
353
367
|
},
|
354
368
|
},
|
355
369
|
},
|
@@ -2078,6 +2092,10 @@ class bingx(Exchange, ImplicitAPI):
|
|
2078
2092
|
types = {
|
2079
2093
|
'trigger_market': 'market',
|
2080
2094
|
'trigger_limit': 'limit',
|
2095
|
+
'stop_limit': 'limit',
|
2096
|
+
'stop_market': 'market',
|
2097
|
+
'take_profit_market': 'market',
|
2098
|
+
'stop': 'limit',
|
2081
2099
|
}
|
2082
2100
|
return self.safe_string(types, type, type)
|
2083
2101
|
|
@@ -2281,6 +2299,25 @@ class bingx(Exchange, ImplicitAPI):
|
|
2281
2299
|
# side: 'SELL'
|
2282
2300
|
# }
|
2283
2301
|
# }
|
2302
|
+
# stop loss order
|
2303
|
+
# {
|
2304
|
+
# "symbol": "ETH-USDT",
|
2305
|
+
# "orderId": "1792461744476422144",
|
2306
|
+
# "price": "2775.65",
|
2307
|
+
# "StopPrice": "2778.42",
|
2308
|
+
# "origQty": "0.032359",
|
2309
|
+
# "executedQty": "0",
|
2310
|
+
# "cummulativeQuoteQty": "0",
|
2311
|
+
# "status": "NEW",
|
2312
|
+
# "type": "TAKE_STOP_LIMIT",
|
2313
|
+
# "side": "SELL",
|
2314
|
+
# "time": "1716191156868",
|
2315
|
+
# "updateTime": "1716191156868",
|
2316
|
+
# "origQuoteOrderQty": "0",
|
2317
|
+
# "fee": "0",
|
2318
|
+
# "feeAsset": "USDT",
|
2319
|
+
# "clientOrderID": ""
|
2320
|
+
# }
|
2284
2321
|
#
|
2285
2322
|
info = order
|
2286
2323
|
newOrder = self.safe_dict_2(order, 'newOrderResponse', 'orderOpenResponse')
|
@@ -2308,21 +2345,31 @@ class bingx(Exchange, ImplicitAPI):
|
|
2308
2345
|
stopLoss = self.safe_value(order, 'stopLoss')
|
2309
2346
|
stopLossPrice = None
|
2310
2347
|
if (stopLoss is not None) and (stopLoss != ''):
|
2311
|
-
stopLossPrice = self.
|
2348
|
+
stopLossPrice = self.omit_zero(self.safe_string(stopLoss, 'stopLoss'))
|
2312
2349
|
if (stopLoss is not None) and ((not isinstance(stopLoss, numbers.Real))) and (stopLoss != ''):
|
2313
2350
|
# stopLoss: '{"stopPrice":50,"workingType":"MARK_PRICE","type":"STOP_MARKET","quantity":1}',
|
2314
2351
|
if isinstance(stopLoss, str):
|
2315
2352
|
stopLoss = self.parse_json(stopLoss)
|
2316
|
-
stopLossPrice = self.
|
2353
|
+
stopLossPrice = self.omit_zero(self.safe_string(stopLoss, 'stopPrice'))
|
2317
2354
|
takeProfit = self.safe_value(order, 'takeProfit')
|
2318
2355
|
takeProfitPrice = None
|
2319
2356
|
if takeProfit is not None and (takeProfit != ''):
|
2320
|
-
takeProfitPrice = self.
|
2357
|
+
takeProfitPrice = self.omit_zero(self.safe_string(takeProfit, 'takeProfit'))
|
2321
2358
|
if (takeProfit is not None) and ((not isinstance(takeProfit, numbers.Real))) and (takeProfit != ''):
|
2322
2359
|
# takeProfit: '{"stopPrice":150,"workingType":"MARK_PRICE","type":"TAKE_PROFIT_MARKET","quantity":1}',
|
2323
2360
|
if isinstance(takeProfit, str):
|
2324
2361
|
takeProfit = self.parse_json(takeProfit)
|
2325
|
-
takeProfitPrice = self.
|
2362
|
+
takeProfitPrice = self.omit_zero(self.safe_string(takeProfit, 'stopPrice'))
|
2363
|
+
rawType = self.safe_string_lower_2(order, 'type', 'o')
|
2364
|
+
stopPrice = self.omit_zero(self.safe_string_2(order, 'StopPrice', 'stopPrice'))
|
2365
|
+
triggerPrice = stopPrice
|
2366
|
+
if stopPrice is not None:
|
2367
|
+
if (rawType.find('stop') > -1) and (stopLossPrice is None):
|
2368
|
+
stopLossPrice = stopPrice
|
2369
|
+
triggerPrice = None
|
2370
|
+
if (rawType.find('take') > -1) and (takeProfitPrice is None):
|
2371
|
+
takeProfitPrice = stopPrice
|
2372
|
+
triggerPrice = None
|
2326
2373
|
return self.safe_order({
|
2327
2374
|
'info': info,
|
2328
2375
|
'id': self.safe_string_2(order, 'orderId', 'i'),
|
@@ -2332,13 +2379,13 @@ class bingx(Exchange, ImplicitAPI):
|
|
2332
2379
|
'datetime': self.iso8601(timestamp),
|
2333
2380
|
'lastTradeTimestamp': lastTradeTimestamp,
|
2334
2381
|
'lastUpdateTimestamp': self.safe_integer(order, 'updateTime'),
|
2335
|
-
'type': self.parse_order_type(
|
2382
|
+
'type': self.parse_order_type(rawType),
|
2336
2383
|
'timeInForce': self.safe_string(order, 'timeInForce'),
|
2337
2384
|
'postOnly': None,
|
2338
2385
|
'side': self.parse_order_side(side),
|
2339
2386
|
'price': self.safe_string_2(order, 'price', 'p'),
|
2340
|
-
'stopPrice':
|
2341
|
-
'triggerPrice':
|
2387
|
+
'stopPrice': triggerPrice,
|
2388
|
+
'triggerPrice': triggerPrice,
|
2342
2389
|
'stopLossPrice': stopLossPrice,
|
2343
2390
|
'takeProfitPrice': takeProfitPrice,
|
2344
2391
|
'average': self.safe_string_2(order, 'avgPrice', 'ap'),
|
ccxt/bitget.py
CHANGED
ccxt/bitmart.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.bitmart import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currencies, Currency, Int, IsolatedBorrowRate, IsolatedBorrowRates, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry, TransferEntries
|
9
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, IsolatedBorrowRate, IsolatedBorrowRates, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry, TransferEntries
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -54,11 +54,12 @@ class bitmart(Exchange, ImplicitAPI):
|
|
54
54
|
'borrowIsolatedMargin': True,
|
55
55
|
'cancelAllOrders': True,
|
56
56
|
'cancelOrder': True,
|
57
|
-
'cancelOrders':
|
57
|
+
'cancelOrders': True,
|
58
58
|
'createMarketBuyOrderWithCost': True,
|
59
59
|
'createMarketOrderWithCost': False,
|
60
60
|
'createMarketSellOrderWithCost': False,
|
61
61
|
'createOrder': True,
|
62
|
+
'createOrders': True,
|
62
63
|
'createPostOnlyOrder': True,
|
63
64
|
'createStopLimitOrder': False,
|
64
65
|
'createStopMarketOrder': False,
|
@@ -198,7 +199,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
198
199
|
'spot/v2/orders': 5,
|
199
200
|
'spot/v1/trades': 5,
|
200
201
|
# newer order endpoint
|
201
|
-
'spot/v2/trades':
|
202
|
+
'spot/v2/trades': 4,
|
202
203
|
'spot/v3/orders': 5,
|
203
204
|
'spot/v2/order_detail': 1,
|
204
205
|
# margin
|
@@ -242,6 +243,8 @@ class bitmart(Exchange, ImplicitAPI):
|
|
242
243
|
'spot/v4/query/history-orders': 5, # 12 times/2 sec = 6/s => 30/6 = 5
|
243
244
|
'spot/v4/query/trades': 5, # 12 times/2 sec = 6/s => 30/6 = 5
|
244
245
|
'spot/v4/query/order-trades': 5, # 12 times/2 sec = 6/s => 30/6 = 5
|
246
|
+
'spot/v4/cancel_orders': 3,
|
247
|
+
'spot/v4/batch_orders': 3,
|
245
248
|
# newer endpoint
|
246
249
|
'spot/v3/cancel_order': 1,
|
247
250
|
'spot/v2/batch_orders': 1,
|
@@ -2291,6 +2294,68 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2291
2294
|
order['price'] = price
|
2292
2295
|
return order
|
2293
2296
|
|
2297
|
+
def create_orders(self, orders: List[OrderRequest], params={}):
|
2298
|
+
"""
|
2299
|
+
create a list of trade orders
|
2300
|
+
:see: https://developer-pro.bitmart.com/en/spot/#new-batch-order-v4-signed
|
2301
|
+
:param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
2302
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2303
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2304
|
+
"""
|
2305
|
+
self.load_markets()
|
2306
|
+
ordersRequests = []
|
2307
|
+
symbol = None
|
2308
|
+
market = None
|
2309
|
+
for i in range(0, len(orders)):
|
2310
|
+
rawOrder = orders[i]
|
2311
|
+
marketId = self.safe_string(rawOrder, 'symbol')
|
2312
|
+
market = self.market(marketId)
|
2313
|
+
if not market['spot']:
|
2314
|
+
raise NotSupported(self.id + ' createOrders() supports spot orders only')
|
2315
|
+
if symbol is None:
|
2316
|
+
symbol = marketId
|
2317
|
+
else:
|
2318
|
+
if symbol != marketId:
|
2319
|
+
raise BadRequest(self.id + ' createOrders() requires all orders to have the same symbol')
|
2320
|
+
type = self.safe_string(rawOrder, 'type')
|
2321
|
+
side = self.safe_string(rawOrder, 'side')
|
2322
|
+
amount = self.safe_value(rawOrder, 'amount')
|
2323
|
+
price = self.safe_value(rawOrder, 'price')
|
2324
|
+
orderParams = self.safe_dict(rawOrder, 'params', {})
|
2325
|
+
orderRequest = self.create_spot_order_request(marketId, type, side, amount, price, orderParams)
|
2326
|
+
orderRequest = self.omit(orderRequest, ['symbol']) # not needed because it goes in the outter object
|
2327
|
+
ordersRequests.append(orderRequest)
|
2328
|
+
request = {
|
2329
|
+
'symbol': market['id'],
|
2330
|
+
'orderParams': ordersRequests,
|
2331
|
+
}
|
2332
|
+
response = self.privatePostSpotV4BatchOrders(request)
|
2333
|
+
#
|
2334
|
+
# {
|
2335
|
+
# "message": "OK",
|
2336
|
+
# "code": 1000,
|
2337
|
+
# "trace": "5fc697fb817a4b5396284786a9b2609a.263.17022620476480263",
|
2338
|
+
# "data": {
|
2339
|
+
# "code": 0,
|
2340
|
+
# "msg": "success",
|
2341
|
+
# "data": {
|
2342
|
+
# "orderIds": [
|
2343
|
+
# "212751308355553320"
|
2344
|
+
# ]
|
2345
|
+
# }
|
2346
|
+
# }
|
2347
|
+
# }
|
2348
|
+
#
|
2349
|
+
data = self.safe_dict(response, 'data', {})
|
2350
|
+
innderData = self.safe_dict(data, 'data', {})
|
2351
|
+
orderIds = self.safe_list(innderData, 'orderIds', [])
|
2352
|
+
parsedOrders = []
|
2353
|
+
for i in range(0, len(orderIds)):
|
2354
|
+
orderId = orderIds[i]
|
2355
|
+
order = self.safe_order({'id': orderId}, market)
|
2356
|
+
parsedOrders.append(order)
|
2357
|
+
return parsedOrders
|
2358
|
+
|
2294
2359
|
def create_swap_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
2295
2360
|
"""
|
2296
2361
|
* @ignore
|
@@ -2523,6 +2588,60 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2523
2588
|
order = self.parse_order(id, market)
|
2524
2589
|
return self.extend(order, {'id': id})
|
2525
2590
|
|
2591
|
+
def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
|
2592
|
+
"""
|
2593
|
+
cancel multiple orders
|
2594
|
+
:see: https://developer-pro.bitmart.com/en/spot/#cancel-batch-order-v4-signed
|
2595
|
+
:param str[] ids: order ids
|
2596
|
+
:param str symbol: unified symbol of the market the order was made in
|
2597
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2598
|
+
:param str[] [params.clientOrderIds]: client order ids
|
2599
|
+
:returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
2600
|
+
"""
|
2601
|
+
if symbol is None:
|
2602
|
+
raise ArgumentsRequired(self.id + ' cancelOrders() requires a symbol argument')
|
2603
|
+
self.load_markets()
|
2604
|
+
market = self.market(symbol)
|
2605
|
+
if not market['spot']:
|
2606
|
+
raise NotSupported(self.id + ' cancelOrders() does not support ' + market['type'] + ' orders, only spot orders are accepted')
|
2607
|
+
clientOrderIds = self.safe_list(params, 'clientOrderIds')
|
2608
|
+
params = self.omit(params, ['clientOrderIds'])
|
2609
|
+
request = {
|
2610
|
+
'symbol': market['id'],
|
2611
|
+
}
|
2612
|
+
if clientOrderIds is not None:
|
2613
|
+
request['clientOrderIds'] = clientOrderIds
|
2614
|
+
else:
|
2615
|
+
request['orderIds'] = ids
|
2616
|
+
response = self.privatePostSpotV4CancelOrders(self.extend(request, params))
|
2617
|
+
#
|
2618
|
+
# {
|
2619
|
+
# "message": "OK",
|
2620
|
+
# "code": 1000,
|
2621
|
+
# "trace": "c4edbce860164203954f7c3c81d60fc6.309.17022669632770001",
|
2622
|
+
# "data": {
|
2623
|
+
# "successIds": [
|
2624
|
+
# "213055379155243012"
|
2625
|
+
# ],
|
2626
|
+
# "failIds": [],
|
2627
|
+
# "totalCount": 1,
|
2628
|
+
# "successCount": 1,
|
2629
|
+
# "failedCount": 0
|
2630
|
+
# }
|
2631
|
+
# }
|
2632
|
+
#
|
2633
|
+
data = self.safe_dict(response, 'data', {})
|
2634
|
+
allOrders = []
|
2635
|
+
successIds = self.safe_list(data, 'successIds', [])
|
2636
|
+
for i in range(0, len(successIds)):
|
2637
|
+
id = successIds[i]
|
2638
|
+
allOrders.append(self.safe_order({'id': id, 'status': 'canceled'}, market))
|
2639
|
+
failIds = self.safe_list(data, 'failIds', [])
|
2640
|
+
for i in range(0, len(failIds)):
|
2641
|
+
id = failIds[i]
|
2642
|
+
allOrders.append(self.safe_order({'id': id, 'status': 'failed'}, market))
|
2643
|
+
return allOrders
|
2644
|
+
|
2526
2645
|
def cancel_all_orders(self, symbol: Str = None, params={}):
|
2527
2646
|
"""
|
2528
2647
|
cancel all open orders in a market
|
ccxt/bybit.py
CHANGED
@@ -2400,12 +2400,12 @@ class bybit(Exchange, ImplicitAPI):
|
|
2400
2400
|
if symbol is None:
|
2401
2401
|
raise ArgumentsRequired(self.id + ' fetchFundingRateHistory() requires a symbol argument')
|
2402
2402
|
self.load_markets()
|
2403
|
-
if limit is None:
|
2404
|
-
limit = 200
|
2405
2403
|
paginate = False
|
2406
2404
|
paginate, params = self.handle_option_and_params(params, 'fetchFundingRateHistory', 'paginate')
|
2407
2405
|
if paginate:
|
2408
2406
|
return self.fetch_paginated_call_deterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params, 200)
|
2407
|
+
if limit is None:
|
2408
|
+
limit = 200
|
2409
2409
|
request = {
|
2410
2410
|
# 'category': '', # Product type. linear,inverse
|
2411
2411
|
# 'symbol': '', # Symbol name
|
ccxt/coinbase.py
CHANGED
@@ -2844,7 +2844,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2844
2844
|
marketId = self.safe_string(order, 'product_id')
|
2845
2845
|
symbol = self.safe_symbol(marketId, market, '-')
|
2846
2846
|
if symbol is not None:
|
2847
|
-
market = self.
|
2847
|
+
market = self.safe_market(symbol, market)
|
2848
2848
|
orderConfiguration = self.safe_dict(order, 'order_configuration', {})
|
2849
2849
|
limitGTC = self.safe_dict(orderConfiguration, 'limit_limit_gtc')
|
2850
2850
|
limitGTD = self.safe_dict(orderConfiguration, 'limit_limit_gtd')
|
ccxt/krakenfutures.py
CHANGED
@@ -2099,7 +2099,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2099
2099
|
|
2100
2100
|
def fetch_positions(self, symbols: Strings = None, params={}):
|
2101
2101
|
"""
|
2102
|
-
:see: https://docs.futures.kraken.com/#
|
2102
|
+
:see: https://docs.futures.kraken.com/#http-api-trading-v3-api-account-information-get-open-positions
|
2103
2103
|
Fetches current contract trading positions
|
2104
2104
|
:param str[] symbols: List of unified symbols
|
2105
2105
|
:param dict [params]: Not used by krakenfutures
|
ccxt/kucoin.py
CHANGED
@@ -446,6 +446,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
446
446
|
'The withdrawal amount is below the minimum requirement.': ExchangeError, # {"code":"400100","msg":"The withdrawal amount is below the minimum requirement."}
|
447
447
|
'Unsuccessful! Exceeded the max. funds out-transfer limit': InsufficientFunds, # {"code":"200000","msg":"Unsuccessful! Exceeded the max. funds out-transfer limit"}
|
448
448
|
'The amount increment is invalid.': BadRequest,
|
449
|
+
'The quantity is below the minimum requirement.': InvalidOrder, # {"msg":"The quantity is below the minimum requirement.","code":"400100"}
|
449
450
|
'400': BadRequest,
|
450
451
|
'401': AuthenticationError,
|
451
452
|
'403': NotSupported,
|