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/async_support/bingx.py
CHANGED
@@ -33,8 +33,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
33
33
|
'id': 'bingx',
|
34
34
|
'name': 'BingX',
|
35
35
|
'countries': ['US'], # North America, Canada, the EU, Hong Kong and Taiwan
|
36
|
-
|
37
|
-
'rateLimit': 1000,
|
36
|
+
'rateLimit': 100,
|
38
37
|
'version': 'v1',
|
39
38
|
'certified': True,
|
40
39
|
'pro': True,
|
@@ -147,44 +146,54 @@ class bingx(Exchange, ImplicitAPI):
|
|
147
146
|
'v1': {
|
148
147
|
'public': {
|
149
148
|
'get': {
|
150
|
-
'server/time':
|
151
|
-
'common/symbols':
|
152
|
-
'market/trades':
|
153
|
-
'market/depth':
|
154
|
-
'market/kline':
|
149
|
+
'server/time': 1,
|
150
|
+
'common/symbols': 1,
|
151
|
+
'market/trades': 1,
|
152
|
+
'market/depth': 1,
|
153
|
+
'market/kline': 1,
|
155
154
|
'ticker/24hr': 1,
|
155
|
+
'ticker/price': 1,
|
156
|
+
'ticker/bookTicker': 1,
|
156
157
|
},
|
157
158
|
},
|
158
159
|
'private': {
|
159
160
|
'get': {
|
160
|
-
'trade/query':
|
161
|
-
'trade/openOrders':
|
162
|
-
'trade/historyOrders':
|
163
|
-
'trade/myTrades':
|
164
|
-
'user/commissionRate':
|
165
|
-
'account/balance':
|
161
|
+
'trade/query': 1,
|
162
|
+
'trade/openOrders': 1,
|
163
|
+
'trade/historyOrders': 1,
|
164
|
+
'trade/myTrades': 2,
|
165
|
+
'user/commissionRate': 5,
|
166
|
+
'account/balance': 2,
|
166
167
|
},
|
167
168
|
'post': {
|
168
|
-
'trade/order':
|
169
|
-
'trade/cancel':
|
170
|
-
'trade/batchOrders':
|
171
|
-
'trade/order/cancelReplace':
|
172
|
-
'trade/cancelOrders':
|
173
|
-
'trade/cancelOpenOrders':
|
174
|
-
'trade/cancelAllAfter':
|
169
|
+
'trade/order': 2,
|
170
|
+
'trade/cancel': 2,
|
171
|
+
'trade/batchOrders': 5,
|
172
|
+
'trade/order/cancelReplace': 5,
|
173
|
+
'trade/cancelOrders': 5,
|
174
|
+
'trade/cancelOpenOrders': 5,
|
175
|
+
'trade/cancelAllAfter': 5,
|
176
|
+
},
|
177
|
+
},
|
178
|
+
},
|
179
|
+
'v2': {
|
180
|
+
'public': {
|
181
|
+
'get': {
|
182
|
+
'market/depth': 1,
|
183
|
+
'market/kline': 1,
|
175
184
|
},
|
176
185
|
},
|
177
186
|
},
|
178
187
|
'v3': {
|
179
188
|
'private': {
|
180
189
|
'get': {
|
181
|
-
'get/asset/transfer':
|
182
|
-
'asset/transfer':
|
183
|
-
'capital/deposit/hisrec':
|
184
|
-
'capital/withdraw/history':
|
190
|
+
'get/asset/transfer': 1,
|
191
|
+
'asset/transfer': 1,
|
192
|
+
'capital/deposit/hisrec': 1,
|
193
|
+
'capital/withdraw/history': 1,
|
185
194
|
},
|
186
195
|
'post': {
|
187
|
-
'post/asset/transfer':
|
196
|
+
'post/asset/transfer': 5,
|
188
197
|
},
|
189
198
|
},
|
190
199
|
},
|
@@ -194,26 +203,27 @@ class bingx(Exchange, ImplicitAPI):
|
|
194
203
|
'public': {
|
195
204
|
'get': {
|
196
205
|
'ticker/price': 1,
|
206
|
+
'market/historicalTrades': 1,
|
197
207
|
},
|
198
208
|
},
|
199
209
|
'private': {
|
200
210
|
'get': {
|
201
|
-
'positionSide/dual':
|
211
|
+
'positionSide/dual': 5,
|
202
212
|
'market/markPriceKlines': 1,
|
203
|
-
'trade/batchCancelReplace':
|
204
|
-
'trade/fullOrder':
|
213
|
+
'trade/batchCancelReplace': 5,
|
214
|
+
'trade/fullOrder': 2,
|
205
215
|
},
|
206
216
|
'post': {
|
207
|
-
'trade/cancelReplace':
|
208
|
-
'positionSide/dual':
|
209
|
-
'trade/closePosition':
|
217
|
+
'trade/cancelReplace': 2,
|
218
|
+
'positionSide/dual': 5,
|
219
|
+
'trade/closePosition': 2,
|
210
220
|
},
|
211
221
|
},
|
212
222
|
},
|
213
223
|
'v2': {
|
214
224
|
'public': {
|
215
225
|
'get': {
|
216
|
-
'server/time':
|
226
|
+
'server/time': 1,
|
217
227
|
'quote/contracts': 1,
|
218
228
|
'quote/price': 1,
|
219
229
|
'quote/depth': 1,
|
@@ -228,35 +238,35 @@ class bingx(Exchange, ImplicitAPI):
|
|
228
238
|
},
|
229
239
|
'private': {
|
230
240
|
'get': {
|
231
|
-
'user/balance':
|
232
|
-
'user/positions':
|
233
|
-
'user/income':
|
234
|
-
'trade/openOrders':
|
235
|
-
'trade/openOrder':
|
236
|
-
'trade/order':
|
237
|
-
'trade/marginType':
|
238
|
-
'trade/leverage':
|
239
|
-
'trade/forceOrders':
|
240
|
-
'trade/allOrders':
|
241
|
-
'trade/allFillOrders':
|
242
|
-
'user/income/export':
|
243
|
-
'user/commissionRate':
|
244
|
-
'quote/bookTicker':
|
241
|
+
'user/balance': 2,
|
242
|
+
'user/positions': 2,
|
243
|
+
'user/income': 2,
|
244
|
+
'trade/openOrders': 2,
|
245
|
+
'trade/openOrder': 2,
|
246
|
+
'trade/order': 2,
|
247
|
+
'trade/marginType': 5,
|
248
|
+
'trade/leverage': 2,
|
249
|
+
'trade/forceOrders': 1,
|
250
|
+
'trade/allOrders': 2,
|
251
|
+
'trade/allFillOrders': 2,
|
252
|
+
'user/income/export': 2,
|
253
|
+
'user/commissionRate': 2,
|
254
|
+
'quote/bookTicker': 1,
|
245
255
|
},
|
246
256
|
'post': {
|
247
|
-
'trade/order':
|
248
|
-
'trade/batchOrders':
|
249
|
-
'trade/closeAllPositions':
|
250
|
-
'trade/cancelAllAfter':
|
251
|
-
'trade/marginType':
|
252
|
-
'trade/leverage':
|
253
|
-
'trade/positionMargin':
|
254
|
-
'trade/order/test':
|
257
|
+
'trade/order': 2,
|
258
|
+
'trade/batchOrders': 2,
|
259
|
+
'trade/closeAllPositions': 2,
|
260
|
+
'trade/cancelAllAfter': 5,
|
261
|
+
'trade/marginType': 5,
|
262
|
+
'trade/leverage': 5,
|
263
|
+
'trade/positionMargin': 5,
|
264
|
+
'trade/order/test': 2,
|
255
265
|
},
|
256
266
|
'delete': {
|
257
|
-
'trade/order':
|
258
|
-
'trade/batchOrders':
|
259
|
-
'trade/allOpenOrders':
|
267
|
+
'trade/order': 2,
|
268
|
+
'trade/batchOrders': 2,
|
269
|
+
'trade/allOpenOrders': 2,
|
260
270
|
},
|
261
271
|
},
|
262
272
|
},
|
@@ -272,9 +282,9 @@ class bingx(Exchange, ImplicitAPI):
|
|
272
282
|
'v1': {
|
273
283
|
'private': {
|
274
284
|
'get': {
|
275
|
-
'allPosition':
|
276
|
-
'allOrders':
|
277
|
-
'balance':
|
285
|
+
'allPosition': 2,
|
286
|
+
'allOrders': 2,
|
287
|
+
'balance': 2,
|
278
288
|
},
|
279
289
|
},
|
280
290
|
},
|
@@ -283,18 +293,19 @@ class bingx(Exchange, ImplicitAPI):
|
|
283
293
|
'v1': {
|
284
294
|
'private': {
|
285
295
|
'get': {
|
286
|
-
'capital/config/getall':
|
287
|
-
'capital/deposit/address':
|
296
|
+
'capital/config/getall': 5,
|
297
|
+
'capital/deposit/address': 5,
|
288
298
|
'capital/innerTransfer/records': 1,
|
289
|
-
'capital/subAccount/deposit/address':
|
290
|
-
'capital/deposit/subHisrec':
|
299
|
+
'capital/subAccount/deposit/address': 5,
|
300
|
+
'capital/deposit/subHisrec': 2,
|
291
301
|
'capital/subAccount/innerTransfer/records': 1,
|
302
|
+
'capital/deposit/riskRecords': 5,
|
292
303
|
},
|
293
304
|
'post': {
|
294
|
-
'capital/withdraw/apply':
|
295
|
-
'capital/innerTransfer/apply':
|
296
|
-
'capital/subAccountInnerTransfer/apply':
|
297
|
-
'capital/deposit/createSubAddress':
|
305
|
+
'capital/withdraw/apply': 5,
|
306
|
+
'capital/innerTransfer/apply': 5,
|
307
|
+
'capital/subAccountInnerTransfer/apply': 2,
|
308
|
+
'capital/deposit/createSubAddress': 2,
|
298
309
|
},
|
299
310
|
},
|
300
311
|
},
|
@@ -303,15 +314,15 @@ class bingx(Exchange, ImplicitAPI):
|
|
303
314
|
'v1': {
|
304
315
|
'private': {
|
305
316
|
'get': {
|
306
|
-
'list':
|
307
|
-
'assets':
|
317
|
+
'list': 10,
|
318
|
+
'assets': 2,
|
308
319
|
},
|
309
320
|
'post': {
|
310
|
-
'create':
|
311
|
-
'apiKey/create':
|
312
|
-
'apiKey/edit':
|
313
|
-
'apiKey/del':
|
314
|
-
'updateStatus':
|
321
|
+
'create': 10,
|
322
|
+
'apiKey/create': 2,
|
323
|
+
'apiKey/edit': 2,
|
324
|
+
'apiKey/del': 2,
|
325
|
+
'updateStatus': 10,
|
315
326
|
},
|
316
327
|
},
|
317
328
|
},
|
@@ -321,10 +332,10 @@ class bingx(Exchange, ImplicitAPI):
|
|
321
332
|
'private': {
|
322
333
|
'get': {
|
323
334
|
'uid': 1,
|
324
|
-
'apiKey/query':
|
335
|
+
'apiKey/query': 2,
|
325
336
|
},
|
326
337
|
'post': {
|
327
|
-
'innerTransfer/authorizeSubAccount':
|
338
|
+
'innerTransfer/authorizeSubAccount': 1,
|
328
339
|
},
|
329
340
|
},
|
330
341
|
},
|
@@ -333,10 +344,13 @@ class bingx(Exchange, ImplicitAPI):
|
|
333
344
|
'auth': {
|
334
345
|
'private': {
|
335
346
|
'post': {
|
336
|
-
'userDataStream':
|
347
|
+
'userDataStream': 2,
|
337
348
|
},
|
338
349
|
'put': {
|
339
|
-
'userDataStream':
|
350
|
+
'userDataStream': 2,
|
351
|
+
},
|
352
|
+
'delete': {
|
353
|
+
'userDataStream': 2,
|
340
354
|
},
|
341
355
|
},
|
342
356
|
},
|
@@ -345,12 +359,12 @@ class bingx(Exchange, ImplicitAPI):
|
|
345
359
|
'v1': {
|
346
360
|
'private': {
|
347
361
|
'get': {
|
348
|
-
'swap/trace/currentTrack':
|
362
|
+
'swap/trace/currentTrack': 2,
|
349
363
|
},
|
350
364
|
'post': {
|
351
|
-
'swap/trace/closeTrackOrder':
|
352
|
-
'swap/trace/setTPSL':
|
353
|
-
'spot/trader/sellOrder':
|
365
|
+
'swap/trace/closeTrackOrder': 2,
|
366
|
+
'swap/trace/setTPSL': 2,
|
367
|
+
'spot/trader/sellOrder': 10,
|
354
368
|
},
|
355
369
|
},
|
356
370
|
},
|
@@ -2079,6 +2093,10 @@ class bingx(Exchange, ImplicitAPI):
|
|
2079
2093
|
types = {
|
2080
2094
|
'trigger_market': 'market',
|
2081
2095
|
'trigger_limit': 'limit',
|
2096
|
+
'stop_limit': 'limit',
|
2097
|
+
'stop_market': 'market',
|
2098
|
+
'take_profit_market': 'market',
|
2099
|
+
'stop': 'limit',
|
2082
2100
|
}
|
2083
2101
|
return self.safe_string(types, type, type)
|
2084
2102
|
|
@@ -2282,6 +2300,25 @@ class bingx(Exchange, ImplicitAPI):
|
|
2282
2300
|
# side: 'SELL'
|
2283
2301
|
# }
|
2284
2302
|
# }
|
2303
|
+
# stop loss order
|
2304
|
+
# {
|
2305
|
+
# "symbol": "ETH-USDT",
|
2306
|
+
# "orderId": "1792461744476422144",
|
2307
|
+
# "price": "2775.65",
|
2308
|
+
# "StopPrice": "2778.42",
|
2309
|
+
# "origQty": "0.032359",
|
2310
|
+
# "executedQty": "0",
|
2311
|
+
# "cummulativeQuoteQty": "0",
|
2312
|
+
# "status": "NEW",
|
2313
|
+
# "type": "TAKE_STOP_LIMIT",
|
2314
|
+
# "side": "SELL",
|
2315
|
+
# "time": "1716191156868",
|
2316
|
+
# "updateTime": "1716191156868",
|
2317
|
+
# "origQuoteOrderQty": "0",
|
2318
|
+
# "fee": "0",
|
2319
|
+
# "feeAsset": "USDT",
|
2320
|
+
# "clientOrderID": ""
|
2321
|
+
# }
|
2285
2322
|
#
|
2286
2323
|
info = order
|
2287
2324
|
newOrder = self.safe_dict_2(order, 'newOrderResponse', 'orderOpenResponse')
|
@@ -2309,21 +2346,31 @@ class bingx(Exchange, ImplicitAPI):
|
|
2309
2346
|
stopLoss = self.safe_value(order, 'stopLoss')
|
2310
2347
|
stopLossPrice = None
|
2311
2348
|
if (stopLoss is not None) and (stopLoss != ''):
|
2312
|
-
stopLossPrice = self.
|
2349
|
+
stopLossPrice = self.omit_zero(self.safe_string(stopLoss, 'stopLoss'))
|
2313
2350
|
if (stopLoss is not None) and ((not isinstance(stopLoss, numbers.Real))) and (stopLoss != ''):
|
2314
2351
|
# stopLoss: '{"stopPrice":50,"workingType":"MARK_PRICE","type":"STOP_MARKET","quantity":1}',
|
2315
2352
|
if isinstance(stopLoss, str):
|
2316
2353
|
stopLoss = self.parse_json(stopLoss)
|
2317
|
-
stopLossPrice = self.
|
2354
|
+
stopLossPrice = self.omit_zero(self.safe_string(stopLoss, 'stopPrice'))
|
2318
2355
|
takeProfit = self.safe_value(order, 'takeProfit')
|
2319
2356
|
takeProfitPrice = None
|
2320
2357
|
if takeProfit is not None and (takeProfit != ''):
|
2321
|
-
takeProfitPrice = self.
|
2358
|
+
takeProfitPrice = self.omit_zero(self.safe_string(takeProfit, 'takeProfit'))
|
2322
2359
|
if (takeProfit is not None) and ((not isinstance(takeProfit, numbers.Real))) and (takeProfit != ''):
|
2323
2360
|
# takeProfit: '{"stopPrice":150,"workingType":"MARK_PRICE","type":"TAKE_PROFIT_MARKET","quantity":1}',
|
2324
2361
|
if isinstance(takeProfit, str):
|
2325
2362
|
takeProfit = self.parse_json(takeProfit)
|
2326
|
-
takeProfitPrice = self.
|
2363
|
+
takeProfitPrice = self.omit_zero(self.safe_string(takeProfit, 'stopPrice'))
|
2364
|
+
rawType = self.safe_string_lower_2(order, 'type', 'o')
|
2365
|
+
stopPrice = self.omit_zero(self.safe_string_2(order, 'StopPrice', 'stopPrice'))
|
2366
|
+
triggerPrice = stopPrice
|
2367
|
+
if stopPrice is not None:
|
2368
|
+
if (rawType.find('stop') > -1) and (stopLossPrice is None):
|
2369
|
+
stopLossPrice = stopPrice
|
2370
|
+
triggerPrice = None
|
2371
|
+
if (rawType.find('take') > -1) and (takeProfitPrice is None):
|
2372
|
+
takeProfitPrice = stopPrice
|
2373
|
+
triggerPrice = None
|
2327
2374
|
return self.safe_order({
|
2328
2375
|
'info': info,
|
2329
2376
|
'id': self.safe_string_2(order, 'orderId', 'i'),
|
@@ -2333,13 +2380,13 @@ class bingx(Exchange, ImplicitAPI):
|
|
2333
2380
|
'datetime': self.iso8601(timestamp),
|
2334
2381
|
'lastTradeTimestamp': lastTradeTimestamp,
|
2335
2382
|
'lastUpdateTimestamp': self.safe_integer(order, 'updateTime'),
|
2336
|
-
'type': self.parse_order_type(
|
2383
|
+
'type': self.parse_order_type(rawType),
|
2337
2384
|
'timeInForce': self.safe_string(order, 'timeInForce'),
|
2338
2385
|
'postOnly': None,
|
2339
2386
|
'side': self.parse_order_side(side),
|
2340
2387
|
'price': self.safe_string_2(order, 'price', 'p'),
|
2341
|
-
'stopPrice':
|
2342
|
-
'triggerPrice':
|
2388
|
+
'stopPrice': triggerPrice,
|
2389
|
+
'triggerPrice': triggerPrice,
|
2343
2390
|
'stopLossPrice': stopLossPrice,
|
2344
2391
|
'takeProfitPrice': takeProfitPrice,
|
2345
2392
|
'average': self.safe_string_2(order, 'avgPrice', 'ap'),
|
ccxt/async_support/bitget.py
CHANGED
ccxt/async_support/bitmart.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.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
|
+
async 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
|
+
await 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 = await 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
|
+
async 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
|
+
await 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 = await 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
|
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
2527
2646
|
"""
|
2528
2647
|
cancel all open orders in a market
|
ccxt/async_support/bybit.py
CHANGED
@@ -2401,12 +2401,12 @@ class bybit(Exchange, ImplicitAPI):
|
|
2401
2401
|
if symbol is None:
|
2402
2402
|
raise ArgumentsRequired(self.id + ' fetchFundingRateHistory() requires a symbol argument')
|
2403
2403
|
await self.load_markets()
|
2404
|
-
if limit is None:
|
2405
|
-
limit = 200
|
2406
2404
|
paginate = False
|
2407
2405
|
paginate, params = self.handle_option_and_params(params, 'fetchFundingRateHistory', 'paginate')
|
2408
2406
|
if paginate:
|
2409
2407
|
return await self.fetch_paginated_call_deterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params, 200)
|
2408
|
+
if limit is None:
|
2409
|
+
limit = 200
|
2410
2410
|
request = {
|
2411
2411
|
# 'category': '', # Product type. linear,inverse
|
2412
2412
|
# 'symbol': '', # Symbol name
|
ccxt/async_support/coinbase.py
CHANGED
@@ -2845,7 +2845,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2845
2845
|
marketId = self.safe_string(order, 'product_id')
|
2846
2846
|
symbol = self.safe_symbol(marketId, market, '-')
|
2847
2847
|
if symbol is not None:
|
2848
|
-
market = self.
|
2848
|
+
market = self.safe_market(symbol, market)
|
2849
2849
|
orderConfiguration = self.safe_dict(order, 'order_configuration', {})
|
2850
2850
|
limitGTC = self.safe_dict(orderConfiguration, 'limit_limit_gtc')
|
2851
2851
|
limitGTD = self.safe_dict(orderConfiguration, 'limit_limit_gtd')
|
@@ -2099,7 +2099,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2099
2099
|
|
2100
2100
|
async 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/async_support/kucoin.py
CHANGED
@@ -447,6 +447,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
447
447
|
'The withdrawal amount is below the minimum requirement.': ExchangeError, # {"code":"400100","msg":"The withdrawal amount is below the minimum requirement."}
|
448
448
|
'Unsuccessful! Exceeded the max. funds out-transfer limit': InsufficientFunds, # {"code":"200000","msg":"Unsuccessful! Exceeded the max. funds out-transfer limit"}
|
449
449
|
'The amount increment is invalid.': BadRequest,
|
450
|
+
'The quantity is below the minimum requirement.': InvalidOrder, # {"msg":"The quantity is below the minimum requirement.","code":"400100"}
|
450
451
|
'400': BadRequest,
|
451
452
|
'401': AuthenticationError,
|
452
453
|
'403': NotSupported,
|
ccxt/async_support/whitebit.py
CHANGED
@@ -1388,7 +1388,7 @@ class whitebit(Exchange, ImplicitAPI):
|
|
1388
1388
|
balance = response[id]
|
1389
1389
|
if isinstance(balance, dict) and balance is not None:
|
1390
1390
|
account = self.account()
|
1391
|
-
account['free'] = self.
|
1391
|
+
account['free'] = self.safe_string_2(balance, 'available', 'main_balance')
|
1392
1392
|
account['used'] = self.safe_string(balance, 'freeze')
|
1393
1393
|
account['total'] = self.safe_string(balance, 'main_balance')
|
1394
1394
|
result[code] = account
|
ccxt/base/exchange.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.3.
|
7
|
+
__version__ = '4.3.29'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -2655,6 +2655,7 @@ class Exchange(object):
|
|
2655
2655
|
shouldParseFees = parseFee or parseFees
|
2656
2656
|
fees = self.safe_list(order, 'fees', [])
|
2657
2657
|
trades = []
|
2658
|
+
isTriggerOrSLTpOrder = ((self.safe_string(order, 'triggerPrice') is not None or (self.safe_string(order, 'stopLossPrice') is not None)) or (self.safe_string(order, 'takeProfitPrice') is not None))
|
2658
2659
|
if parseFilled or parseCost or shouldParseFees:
|
2659
2660
|
rawTrades = self.safe_value(order, 'trades', trades)
|
2660
2661
|
oldNumber = self.number
|
@@ -2805,7 +2806,7 @@ class Exchange(object):
|
|
2805
2806
|
postOnly = self.safe_value(order, 'postOnly')
|
2806
2807
|
# timeInForceHandling
|
2807
2808
|
if timeInForce is None:
|
2808
|
-
if self.safe_string(order, 'type') == 'market':
|
2809
|
+
if not isTriggerOrSLTpOrder and (self.safe_string(order, 'type') == 'market'):
|
2809
2810
|
timeInForce = 'IOC'
|
2810
2811
|
# allow postOnly override
|
2811
2812
|
if postOnly:
|