ccxt 4.5.45 → 4.5.47
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.
- package/README.md +5 -6
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -6
- package/dist/cjs/src/aftermath.js +1 -1
- package/dist/cjs/src/backpack.js +1 -1
- package/dist/cjs/src/base/Exchange.js +27 -0
- package/dist/cjs/src/binance.js +23 -17
- package/dist/cjs/src/bitfinex.js +6 -11
- package/dist/cjs/src/bitget.js +9 -4
- package/dist/cjs/src/bitmart.js +144 -21
- package/dist/cjs/src/bitmex.js +46 -0
- package/dist/cjs/src/bitstamp.js +14 -1
- package/dist/cjs/src/bittrade.js +1 -1
- package/dist/cjs/src/blofin.js +137 -29
- package/dist/cjs/src/bybit.js +58 -56
- package/dist/cjs/src/bydfi.js +102 -100
- package/dist/cjs/src/gate.js +37 -2
- package/dist/cjs/src/hollaex.js +1 -1
- package/dist/cjs/src/kraken.js +39 -29
- package/dist/cjs/src/kucoin.js +2161 -462
- package/dist/cjs/src/lighter.js +2 -2
- package/dist/cjs/src/okx.js +75 -58
- package/dist/cjs/src/paradex.js +2 -6
- package/dist/cjs/src/pro/bittrade.js +4 -0
- package/dist/cjs/src/pro/bydfi.js +19 -19
- package/dist/cjs/src/pro/gate.js +79 -54
- package/dist/cjs/src/pro/grvt.js +6 -4
- package/dist/cjs/src/pro/htx.js +4 -4
- package/dist/cjs/src/pro/lighter.js +1 -1
- package/dist/cjs/src/pro/okx.js +1 -1
- package/dist/cjs/src/whitebit.js +21 -2
- package/index.d.cts +2 -0
- package/js/ccxt.d.ts +2 -8
- package/js/ccxt.js +2 -6
- package/js/src/abstract/bitmart.d.ts +7 -0
- package/js/src/abstract/blofin.d.ts +28 -12
- package/js/src/abstract/bydfi.d.ts +29 -29
- package/js/src/abstract/kraken.d.ts +36 -29
- package/js/src/abstract/kucoin.d.ts +2 -0
- package/js/src/abstract/kucoinfutures.d.ts +2 -0
- package/js/src/aftermath.js +1 -1
- package/js/src/backpack.js +1 -1
- package/js/src/base/Exchange.d.ts +2 -0
- package/js/src/base/Exchange.js +27 -0
- package/js/src/binance.js +23 -17
- package/js/src/bitfinex.js +6 -11
- package/js/src/bitget.d.ts +1 -1
- package/js/src/bitget.js +9 -4
- package/js/src/bitmart.d.ts +18 -4
- package/js/src/bitmart.js +144 -21
- package/js/src/bitmex.d.ts +12 -0
- package/js/src/bitmex.js +46 -0
- package/js/src/bitstamp.js +14 -1
- package/js/src/bittrade.js +1 -1
- package/js/src/blofin.d.ts +2 -0
- package/js/src/blofin.js +137 -29
- package/js/src/bybit.d.ts +1 -0
- package/js/src/bybit.js +58 -56
- package/js/src/bydfi.d.ts +31 -31
- package/js/src/bydfi.js +102 -100
- package/js/src/gate.js +37 -2
- package/js/src/hollaex.js +1 -1
- package/js/src/kraken.js +39 -29
- package/js/src/kucoin.d.ts +249 -8
- package/js/src/kucoin.js +2161 -462
- package/js/src/lighter.js +2 -2
- package/js/src/okx.d.ts +1 -0
- package/js/src/okx.js +75 -58
- package/js/src/paradex.d.ts +0 -1
- package/js/src/paradex.js +2 -6
- package/js/src/pro/bittrade.js +4 -0
- package/js/src/pro/bydfi.d.ts +18 -18
- package/js/src/pro/bydfi.js +19 -19
- package/js/src/pro/gate.d.ts +2 -2
- package/js/src/pro/gate.js +79 -54
- package/js/src/pro/grvt.js +6 -4
- package/js/src/pro/htx.js +4 -4
- package/js/src/pro/lighter.js +1 -1
- package/js/src/pro/okx.js +1 -1
- package/js/src/whitebit.d.ts +1 -1
- package/js/src/whitebit.js +21 -2
- package/package.json +2 -2
- package/dist/cjs/src/abstract/coincatch.js +0 -11
- package/dist/cjs/src/coincatch.js +0 -5495
- package/dist/cjs/src/pro/coincatch.js +0 -1563
- package/js/src/abstract/coincatch.d.ts +0 -97
- package/js/src/abstract/coincatch.js +0 -5
- package/js/src/coincatch.d.ts +0 -788
- package/js/src/coincatch.js +0 -5488
- package/js/src/pro/coincatch.d.ts +0 -207
- package/js/src/pro/coincatch.js +0 -1556
package/dist/cjs/ccxt.js
CHANGED
|
@@ -51,7 +51,6 @@ var coinbase = require('./src/coinbase.js');
|
|
|
51
51
|
var coinbaseadvanced = require('./src/coinbaseadvanced.js');
|
|
52
52
|
var coinbaseexchange = require('./src/coinbaseexchange.js');
|
|
53
53
|
var coinbaseinternational = require('./src/coinbaseinternational.js');
|
|
54
|
-
var coincatch = require('./src/coincatch.js');
|
|
55
54
|
var coincheck = require('./src/coincheck.js');
|
|
56
55
|
var coinex = require('./src/coinex.js');
|
|
57
56
|
var coinmate = require('./src/coinmate.js');
|
|
@@ -151,7 +150,6 @@ var coinbase$1 = require('./src/pro/coinbase.js');
|
|
|
151
150
|
var coinbaseadvanced$1 = require('./src/pro/coinbaseadvanced.js');
|
|
152
151
|
var coinbaseexchange$1 = require('./src/pro/coinbaseexchange.js');
|
|
153
152
|
var coinbaseinternational$1 = require('./src/pro/coinbaseinternational.js');
|
|
154
|
-
var coincatch$1 = require('./src/pro/coincatch.js');
|
|
155
153
|
var coincheck$1 = require('./src/pro/coincheck.js');
|
|
156
154
|
var coinex$1 = require('./src/pro/coinex.js');
|
|
157
155
|
var coinone$1 = require('./src/pro/coinone.js');
|
|
@@ -200,7 +198,7 @@ var xt$1 = require('./src/pro/xt.js');
|
|
|
200
198
|
|
|
201
199
|
//-----------------------------------------------------------------------------
|
|
202
200
|
// this is updated by vss.js when building
|
|
203
|
-
const version = '4.5.
|
|
201
|
+
const version = '4.5.47';
|
|
204
202
|
Exchange["default"].ccxtVersion = version;
|
|
205
203
|
const exchanges = {
|
|
206
204
|
'aftermath': aftermath["default"],
|
|
@@ -246,7 +244,6 @@ const exchanges = {
|
|
|
246
244
|
'coinbaseadvanced': coinbaseadvanced["default"],
|
|
247
245
|
'coinbaseexchange': coinbaseexchange["default"],
|
|
248
246
|
'coinbaseinternational': coinbaseinternational["default"],
|
|
249
|
-
'coincatch': coincatch["default"],
|
|
250
247
|
'coincheck': coincheck["default"],
|
|
251
248
|
'coinex': coinex["default"],
|
|
252
249
|
'coinmate': coinmate["default"],
|
|
@@ -348,7 +345,6 @@ const pro = {
|
|
|
348
345
|
'coinbaseadvanced': coinbaseadvanced$1["default"],
|
|
349
346
|
'coinbaseexchange': coinbaseexchange$1["default"],
|
|
350
347
|
'coinbaseinternational': coinbaseinternational$1["default"],
|
|
351
|
-
'coincatch': coincatch$1["default"],
|
|
352
348
|
'coincheck': coincheck$1["default"],
|
|
353
349
|
'coinex': coinex$1["default"],
|
|
354
350
|
'coinone': coinone$1["default"],
|
|
@@ -489,7 +485,6 @@ exports.coinbase = coinbase["default"];
|
|
|
489
485
|
exports.coinbaseadvanced = coinbaseadvanced["default"];
|
|
490
486
|
exports.coinbaseexchange = coinbaseexchange["default"];
|
|
491
487
|
exports.coinbaseinternational = coinbaseinternational["default"];
|
|
492
|
-
exports.coincatch = coincatch["default"];
|
|
493
488
|
exports.coincheck = coincheck["default"];
|
|
494
489
|
exports.coinex = coinex["default"];
|
|
495
490
|
exports.coinmate = coinmate["default"];
|
|
@@ -655,7 +655,7 @@ class aftermath extends aftermath$1["default"] {
|
|
|
655
655
|
//
|
|
656
656
|
// [
|
|
657
657
|
// {
|
|
658
|
-
// "id": "
|
|
658
|
+
// "id": "0x22c5e3d2f5bcfd4351a62cd70874878b7923b56d79d04225ed96370a7ac844c4",
|
|
659
659
|
// "type": "primary",
|
|
660
660
|
// "code": "USDC",
|
|
661
661
|
// "accountNumber": 14822
|
package/dist/cjs/src/backpack.js
CHANGED
|
@@ -469,7 +469,7 @@ class backpack extends backpack$1["default"] {
|
|
|
469
469
|
'INSUFFICIENT_SUPPLY': errors.InsufficientFunds,
|
|
470
470
|
'INVALID_ASSET': errors.BadRequest,
|
|
471
471
|
'INVALID_MARKET': errors.BadSymbol,
|
|
472
|
-
'INVALID_PRICE': errors.
|
|
472
|
+
'INVALID_PRICE': errors.InvalidOrder,
|
|
473
473
|
'INVALID_POSITION_ID': errors.BadRequest,
|
|
474
474
|
'INVALID_QUANTITY': errors.BadRequest,
|
|
475
475
|
'INVALID_RANGE': errors.BadRequest,
|
|
@@ -4073,6 +4073,9 @@ class Exchange {
|
|
|
4073
4073
|
}
|
|
4074
4074
|
return reversed;
|
|
4075
4075
|
}
|
|
4076
|
+
stringToBase16(str) {
|
|
4077
|
+
return '0x' + this.binaryToBase16(this.base64ToBinary(this.stringToBase64(str)));
|
|
4078
|
+
}
|
|
4076
4079
|
reduceFeesByCurrency(fees) {
|
|
4077
4080
|
//
|
|
4078
4081
|
// this function takes a list of fee structures having the following format
|
|
@@ -5020,6 +5023,30 @@ class Exchange {
|
|
|
5020
5023
|
}
|
|
5021
5024
|
return results;
|
|
5022
5025
|
}
|
|
5026
|
+
filterOutByArray(objects, key, values = undefined, indexed = true) {
|
|
5027
|
+
objects = this.toArray(objects);
|
|
5028
|
+
// return all of them if no values were passed
|
|
5029
|
+
if (values === undefined || !values) {
|
|
5030
|
+
// return indexed ? this.indexBy (objects, key) : objects;
|
|
5031
|
+
if (indexed) {
|
|
5032
|
+
return this.indexBy(objects, key);
|
|
5033
|
+
}
|
|
5034
|
+
else {
|
|
5035
|
+
return objects;
|
|
5036
|
+
}
|
|
5037
|
+
}
|
|
5038
|
+
const results = [];
|
|
5039
|
+
for (let i = 0; i < objects.length; i++) {
|
|
5040
|
+
if (!this.inArray(objects[i][key], values)) {
|
|
5041
|
+
results.push(objects[i]);
|
|
5042
|
+
}
|
|
5043
|
+
}
|
|
5044
|
+
// return indexed ? this.indexBy (results, key) : results;
|
|
5045
|
+
if (indexed) {
|
|
5046
|
+
return this.indexBy(results, key);
|
|
5047
|
+
}
|
|
5048
|
+
return results;
|
|
5049
|
+
}
|
|
5023
5050
|
async fetch2(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined, config = {}) {
|
|
5024
5051
|
if (this.enableRateLimit) {
|
|
5025
5052
|
const cost = this.calculateRateLimiterCost(api, method, path, params, config);
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -1384,8 +1384,11 @@ class binance extends binance$1["default"] {
|
|
|
1384
1384
|
},
|
|
1385
1385
|
'networks': {
|
|
1386
1386
|
'ERC20': 'ETH',
|
|
1387
|
+
'ETH': 'ETH',
|
|
1387
1388
|
'TRC20': 'TRX',
|
|
1389
|
+
'TRX': 'TRX',
|
|
1388
1390
|
'BEP2': 'BNB',
|
|
1391
|
+
'BSC': 'BSC',
|
|
1389
1392
|
'BEP20': 'BSC',
|
|
1390
1393
|
'EOS': 'EOS',
|
|
1391
1394
|
'SPL': 'SOL',
|
|
@@ -1398,6 +1401,7 @@ class binance extends binance$1["default"] {
|
|
|
1398
1401
|
'MATIC': 'MATIC',
|
|
1399
1402
|
'BASE': 'BASE',
|
|
1400
1403
|
'SUI': 'SUI',
|
|
1404
|
+
'OP': 'OPTIMISM',
|
|
1401
1405
|
'OPTIMISM': 'OPTIMISM',
|
|
1402
1406
|
'NEAR': 'NEAR',
|
|
1403
1407
|
'APT': 'APT',
|
|
@@ -1443,7 +1447,11 @@ class binance extends binance$1["default"] {
|
|
|
1443
1447
|
'ONT': 'ONT', // ontology
|
|
1444
1448
|
},
|
|
1445
1449
|
'networksById': {
|
|
1446
|
-
'
|
|
1450
|
+
'TRX': 'TRC20',
|
|
1451
|
+
'BSC': 'BEP20',
|
|
1452
|
+
'ETH': 'ERC20',
|
|
1453
|
+
'SOL': 'SOL',
|
|
1454
|
+
'OPTIMISM': 'OP',
|
|
1447
1455
|
},
|
|
1448
1456
|
'impliedNetworks': {
|
|
1449
1457
|
'ETH': { 'ERC20': 'ETH' },
|
|
@@ -3068,7 +3076,7 @@ class binance extends binance$1["default"] {
|
|
|
3068
3076
|
for (let j = 0; j < networkList.length; j++) {
|
|
3069
3077
|
const networkItem = networkList[j];
|
|
3070
3078
|
const network = this.safeString(networkItem, 'network');
|
|
3071
|
-
const networkCode = this.networkIdToCode(network);
|
|
3079
|
+
const networkCode = this.networkIdToCode(network, code);
|
|
3072
3080
|
const isETF = (network === 'ETF'); // e.g. BTCUP, ETHDOWN
|
|
3073
3081
|
// const name = this.safeString (networkItem, 'name');
|
|
3074
3082
|
const withdrawFee = this.safeNumber(networkItem, 'withdrawFee');
|
|
@@ -8964,7 +8972,8 @@ class binance extends binance$1["default"] {
|
|
|
8964
8972
|
if (internalInteger !== undefined) {
|
|
8965
8973
|
internal = (internalInteger !== 0) ? true : false;
|
|
8966
8974
|
}
|
|
8967
|
-
const
|
|
8975
|
+
const networkId = this.safeString(transaction, 'network');
|
|
8976
|
+
const network = this.networkIdToCode(networkId, code);
|
|
8968
8977
|
return {
|
|
8969
8978
|
'info': transaction,
|
|
8970
8979
|
'id': id,
|
|
@@ -9391,12 +9400,10 @@ class binance extends binance$1["default"] {
|
|
|
9391
9400
|
'coin': currency['id'],
|
|
9392
9401
|
// 'network': 'ETH', // 'BSC', 'XMR', you can get network and isDefault in networkList in the response of sapiGetCapitalConfigDetail
|
|
9393
9402
|
};
|
|
9394
|
-
|
|
9395
|
-
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
request['network'] = network;
|
|
9399
|
-
params = this.omit(params, 'network');
|
|
9403
|
+
let networkCode = undefined;
|
|
9404
|
+
[networkCode, params] = this.handleNetworkCodeAndParams(params);
|
|
9405
|
+
if (networkCode !== undefined) {
|
|
9406
|
+
request['network'] = this.networkCodeToId(networkCode, currency['code']);
|
|
9400
9407
|
}
|
|
9401
9408
|
// has support for the 'network' parameter
|
|
9402
9409
|
const response = await this.sapiGetCapitalDepositAddress(this.extend(request, params));
|
|
@@ -9656,12 +9663,13 @@ class binance extends binance$1["default"] {
|
|
|
9656
9663
|
// ]
|
|
9657
9664
|
// }
|
|
9658
9665
|
//
|
|
9666
|
+
const code = this.safeString(currency, 'code');
|
|
9659
9667
|
const networkList = this.safeList(fee, 'networkList', []);
|
|
9660
9668
|
const result = this.depositWithdrawFee(fee);
|
|
9661
9669
|
for (let j = 0; j < networkList.length; j++) {
|
|
9662
9670
|
const networkEntry = networkList[j];
|
|
9663
9671
|
const networkId = this.safeString(networkEntry, 'network');
|
|
9664
|
-
const networkCode = this.networkIdToCode(networkId);
|
|
9672
|
+
const networkCode = this.networkIdToCode(networkId, code);
|
|
9665
9673
|
const withdrawFee = this.safeNumber(networkEntry, 'withdrawFee');
|
|
9666
9674
|
const isDefault = this.safeBool(networkEntry, 'isDefault');
|
|
9667
9675
|
if (isDefault === true) {
|
|
@@ -9709,14 +9717,12 @@ class binance extends binance$1["default"] {
|
|
|
9709
9717
|
if (tag !== undefined) {
|
|
9710
9718
|
request['addressTag'] = tag;
|
|
9711
9719
|
}
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
request['network'] = network;
|
|
9717
|
-
params = this.omit(params, 'network');
|
|
9720
|
+
let networkCode = undefined;
|
|
9721
|
+
[networkCode, params] = this.handleNetworkCodeAndParams(params);
|
|
9722
|
+
if (networkCode !== undefined) {
|
|
9723
|
+
request['network'] = this.networkCodeToId(networkCode, currency['code']);
|
|
9718
9724
|
}
|
|
9719
|
-
request['amount'] = this.currencyToPrecision(code, amount,
|
|
9725
|
+
request['amount'] = this.currencyToPrecision(currency['code'], amount, networkCode);
|
|
9720
9726
|
const response = await this.sapiPostCapitalWithdrawApply(this.extend(request, params));
|
|
9721
9727
|
// { id: '9a67628b16ba4988ae20d329333f16bc' }
|
|
9722
9728
|
return this.parseTransaction(response, currency);
|
package/dist/cjs/src/bitfinex.js
CHANGED
|
@@ -870,30 +870,25 @@ class bitfinex extends bitfinex$1["default"] {
|
|
|
870
870
|
const pool = this.safeList(indexed['pool'], id, []);
|
|
871
871
|
const rawType = this.safeString(pool, 1);
|
|
872
872
|
const isCryptoCoin = (rawType !== undefined) || (id in indexed['explorer']); // "hacky" solution
|
|
873
|
-
|
|
874
|
-
if (isCryptoCoin) {
|
|
875
|
-
type = 'crypto';
|
|
876
|
-
}
|
|
873
|
+
const type = isCryptoCoin ? 'crypto' : undefined;
|
|
877
874
|
const feeValues = this.safeList(indexed['fees'], id, []);
|
|
878
875
|
const fees = this.safeList(feeValues, 1, []);
|
|
879
876
|
const fee = this.safeNumber(fees, 1);
|
|
880
877
|
const undl = this.safeList(indexed['undl'], id, []);
|
|
881
878
|
const precision = '8'; // default precision, todo: fix "magic constants"
|
|
882
|
-
const dwStatuses = this.safeList(indexed['statuses'], id, []);
|
|
883
|
-
const depositEnabled = this.safeInteger(dwStatuses, 1) === 1;
|
|
884
|
-
const withdrawEnabled = this.safeInteger(dwStatuses, 2) === 1;
|
|
885
879
|
const networks = {};
|
|
886
880
|
const netwokIds = this.safeList(indexedNetworks, id, []);
|
|
887
881
|
for (let j = 0; j < netwokIds.length; j++) {
|
|
888
882
|
const networkId = netwokIds[j];
|
|
889
883
|
const network = this.networkIdToCode(networkId);
|
|
884
|
+
const dwStatuses = this.safeList(indexed['statuses'], networkId, []);
|
|
890
885
|
networks[network] = {
|
|
891
886
|
'info': networkId,
|
|
892
887
|
'id': networkId.toLowerCase(),
|
|
893
888
|
'network': networkId,
|
|
894
889
|
'active': undefined,
|
|
895
|
-
'deposit':
|
|
896
|
-
'withdraw':
|
|
890
|
+
'deposit': this.safeInteger(dwStatuses, 1) === 1,
|
|
891
|
+
'withdraw': this.safeInteger(dwStatuses, 2) === 1,
|
|
897
892
|
'fee': undefined,
|
|
898
893
|
'precision': undefined,
|
|
899
894
|
'limits': {
|
|
@@ -911,8 +906,8 @@ class bitfinex extends bitfinex$1["default"] {
|
|
|
911
906
|
'type': type,
|
|
912
907
|
'name': name,
|
|
913
908
|
'active': true,
|
|
914
|
-
'deposit':
|
|
915
|
-
'withdraw':
|
|
909
|
+
'deposit': undefined,
|
|
910
|
+
'withdraw': undefined,
|
|
916
911
|
'fee': fee,
|
|
917
912
|
'precision': parseInt(precision),
|
|
918
913
|
'limits': {
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -1457,7 +1457,9 @@ class bitget extends bitget$1["default"] {
|
|
|
1457
1457
|
'20003': errors.ExchangeError,
|
|
1458
1458
|
'01001': errors.ExchangeError,
|
|
1459
1459
|
'40024': errors.RestrictedLocation,
|
|
1460
|
-
'
|
|
1460
|
+
'41117': errors.InvalidOrder,
|
|
1461
|
+
'43111': errors.PermissionDenied,
|
|
1462
|
+
'45113': errors.InvalidOrder, // {"code":"45113","msg":"Maximum order value limit triggered","requestTime":1774884278712,"data":null}
|
|
1461
1463
|
},
|
|
1462
1464
|
'broad': {
|
|
1463
1465
|
'invalid size, valid range': errors.ExchangeError,
|
|
@@ -5107,7 +5109,7 @@ class bitget extends bitget$1["default"] {
|
|
|
5107
5109
|
* @param {string} type 'market' or 'limit'
|
|
5108
5110
|
* @param {string} side 'buy' or 'sell'
|
|
5109
5111
|
* @param {float} amount how much you want to trade in units of the base currency
|
|
5110
|
-
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
5112
|
+
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders, and used as the execution price for contract stop-loss / take-profit orders
|
|
5111
5113
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5112
5114
|
* @param {float} [params.cost] *spot only* how much you want to trade in units of the quote currency, for market buy orders only
|
|
5113
5115
|
* @param {float} [params.triggerPrice] *swap only* The price at which a trigger order is triggered at
|
|
@@ -5438,8 +5440,11 @@ class bitget extends bitget$1["default"] {
|
|
|
5438
5440
|
}
|
|
5439
5441
|
}
|
|
5440
5442
|
else if (isStopLossOrTakeProfitTrigger) {
|
|
5441
|
-
if (
|
|
5442
|
-
|
|
5443
|
+
if (price !== undefined) {
|
|
5444
|
+
request['executePrice'] = this.priceToPrecision(symbol, price);
|
|
5445
|
+
if ('price' in request) {
|
|
5446
|
+
delete request['price'];
|
|
5447
|
+
}
|
|
5443
5448
|
}
|
|
5444
5449
|
if (hedged) {
|
|
5445
5450
|
request['holdSide'] = (side === 'sell') ? 'long' : 'short';
|
package/dist/cjs/src/bitmart.js
CHANGED
|
@@ -244,6 +244,13 @@ class bitmart extends bitmart$1["default"] {
|
|
|
244
244
|
'spot/v4/cancel_orders': 3,
|
|
245
245
|
'spot/v4/cancel_all': 90,
|
|
246
246
|
'spot/v4/batch_orders': 3,
|
|
247
|
+
'spot/v4/algo/submit_order': 6,
|
|
248
|
+
'spot/v4/algo/cancel_order': 6,
|
|
249
|
+
'spot/v4/algo/cancel_all': 12,
|
|
250
|
+
'spot/v4/query/algo/order': 1.5,
|
|
251
|
+
'spot/v4/query/algo/client-order': 1.5,
|
|
252
|
+
'spot/v4/query/algo/open-orders': 3,
|
|
253
|
+
'spot/v4/query/algo/history-orders': 3,
|
|
247
254
|
// newer endpoint
|
|
248
255
|
'spot/v3/cancel_order': 1,
|
|
249
256
|
'spot/v2/batch_orders': 1,
|
|
@@ -931,7 +938,7 @@ class bitmart extends bitmart$1["default"] {
|
|
|
931
938
|
if (type === 'swap') {
|
|
932
939
|
type = 'contract';
|
|
933
940
|
}
|
|
934
|
-
const service = this.
|
|
941
|
+
const service = this.safeDict(servicesByType, type);
|
|
935
942
|
let status = undefined;
|
|
936
943
|
let eta = undefined;
|
|
937
944
|
if (service !== undefined) {
|
|
@@ -2769,6 +2776,7 @@ class bitmart extends bitmart$1["default"] {
|
|
|
2769
2776
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#submit-plan-order-signed
|
|
2770
2777
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#submit-tp-sl-order-signed
|
|
2771
2778
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#submit-trail-order-signed
|
|
2779
|
+
* @see https://developer-pro.bitmart.com/en/spot/#new-algo-order-v4-signed
|
|
2772
2780
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
2773
2781
|
* @param {string} type 'market', 'limit' or 'trailing' for swap markets only
|
|
2774
2782
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -2806,7 +2814,10 @@ class bitmart extends bitmart$1["default"] {
|
|
|
2806
2814
|
let response = undefined;
|
|
2807
2815
|
if (market['spot']) {
|
|
2808
2816
|
const spotRequest = this.createSpotOrderRequest(symbol, type, side, amount, price, params);
|
|
2809
|
-
if (
|
|
2817
|
+
if (isStopLoss || isTakeProfit || isTriggerOrder) {
|
|
2818
|
+
response = await this.privatePostSpotV4AlgoSubmitOrder(spotRequest);
|
|
2819
|
+
}
|
|
2820
|
+
else if (marginMode === 'isolated') {
|
|
2810
2821
|
response = await this.privatePostSpotV1MarginSubmitOrder(spotRequest);
|
|
2811
2822
|
}
|
|
2812
2823
|
else {
|
|
@@ -3086,6 +3097,7 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3086
3097
|
* @description create a spot order request
|
|
3087
3098
|
* @see https://developer-pro.bitmart.com/en/spot/#new-order-v2-signed
|
|
3088
3099
|
* @see https://developer-pro.bitmart.com/en/spot/#new-margin-order-v1-signed
|
|
3100
|
+
* @see https://developer-pro.bitmart.com/en/spot/#new-algo-order-v4-signed
|
|
3089
3101
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
3090
3102
|
* @param {string} type 'market' or 'limit'
|
|
3091
3103
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -3093,13 +3105,23 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3093
3105
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
|
3094
3106
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3095
3107
|
* @param {string} [params.marginMode] 'cross' or 'isolated'
|
|
3108
|
+
* @param {string} [params.clientOrderId] client order id of the order
|
|
3109
|
+
* @param {string} [params.triggerPrice] the price to trigger a stop order
|
|
3110
|
+
* @param {string} [params.stopLossPrice] the price to trigger a stop-loss order
|
|
3111
|
+
* @param {string} [params.takeProfitPrice] the price to trigger a take-profit order
|
|
3096
3112
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/?id=order-structure}
|
|
3097
3113
|
*/
|
|
3098
3114
|
const market = this.market(symbol);
|
|
3115
|
+
const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'trigger_price']);
|
|
3116
|
+
const stopLossPrice = this.safeString(params, 'stopLossPrice');
|
|
3117
|
+
const takeProfitPrice = this.safeString(params, 'takeProfitPrice');
|
|
3118
|
+
const isStopLoss = stopLossPrice !== undefined;
|
|
3119
|
+
const isTakeProfit = takeProfitPrice !== undefined;
|
|
3120
|
+
const isTriggerOrder = triggerPrice !== undefined;
|
|
3121
|
+
const isAlgoOrder = isStopLoss || isTakeProfit || isTriggerOrder;
|
|
3099
3122
|
const request = {
|
|
3100
3123
|
'symbol': market['id'],
|
|
3101
3124
|
'side': side,
|
|
3102
|
-
'type': type,
|
|
3103
3125
|
};
|
|
3104
3126
|
const timeInForce = this.safeString(params, 'timeInForce');
|
|
3105
3127
|
if (timeInForce === 'FOK') {
|
|
@@ -3113,7 +3135,32 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3113
3135
|
params = this.omit(params, ['timeInForce', 'postOnly']);
|
|
3114
3136
|
const ioc = ((timeInForce === 'IOC') || (type === 'ioc'));
|
|
3115
3137
|
const isLimitOrder = (type === 'limit') || postOnly || ioc;
|
|
3116
|
-
|
|
3138
|
+
if (isAlgoOrder) {
|
|
3139
|
+
if (isTriggerOrder) {
|
|
3140
|
+
request['type'] = 'trigger';
|
|
3141
|
+
}
|
|
3142
|
+
else {
|
|
3143
|
+
request['type'] = 'tp/sl';
|
|
3144
|
+
}
|
|
3145
|
+
if (isLimitOrder) {
|
|
3146
|
+
request['trigger_type'] = 'limit';
|
|
3147
|
+
}
|
|
3148
|
+
else {
|
|
3149
|
+
request['trigger_type'] = 'market';
|
|
3150
|
+
}
|
|
3151
|
+
if (isStopLoss) {
|
|
3152
|
+
request['trigger_price'] = this.priceToPrecision(symbol, stopLossPrice);
|
|
3153
|
+
}
|
|
3154
|
+
else if (isTakeProfit) {
|
|
3155
|
+
request['trigger_price'] = this.priceToPrecision(symbol, takeProfitPrice);
|
|
3156
|
+
}
|
|
3157
|
+
else if (isTriggerOrder) {
|
|
3158
|
+
request['trigger_price'] = this.priceToPrecision(symbol, triggerPrice);
|
|
3159
|
+
}
|
|
3160
|
+
}
|
|
3161
|
+
else {
|
|
3162
|
+
request['type'] = type;
|
|
3163
|
+
}
|
|
3117
3164
|
if (isLimitOrder) {
|
|
3118
3165
|
request['size'] = this.amountToPrecision(symbol, amount);
|
|
3119
3166
|
request['price'] = this.priceToPrecision(symbol, price);
|
|
@@ -3166,12 +3213,14 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3166
3213
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-plan-order-signed
|
|
3167
3214
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-order-signed
|
|
3168
3215
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-trail-order-signed
|
|
3216
|
+
* @see https://developer-pro.bitmart.com/en/spot/#cancel-algo-order-v4-signed
|
|
3169
3217
|
* @param {string} id order id
|
|
3170
3218
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
3171
3219
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3172
3220
|
* @param {string} [params.clientOrderId] *spot only* the client order id of the order to cancel
|
|
3173
|
-
* @param {boolean} [params.trigger] *swap only* whether the order is a trigger order
|
|
3174
3221
|
* @param {boolean} [params.trailing] *swap only* whether the order is a stop order
|
|
3222
|
+
* @param {boolean} [params.trigger] whether the order is a trigger order
|
|
3223
|
+
* @param {boolean} [params.stopLossTakeProfit] whether the order is a stopLossPrice or takeProfitPrice order
|
|
3175
3224
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/?id=order-structure}
|
|
3176
3225
|
*/
|
|
3177
3226
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
@@ -3190,15 +3239,26 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3190
3239
|
else {
|
|
3191
3240
|
request['order_id'] = id.toString();
|
|
3192
3241
|
}
|
|
3193
|
-
|
|
3242
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
3243
|
+
const stopLossTakeProfit = this.safeBool(params, 'stopLossTakeProfit');
|
|
3244
|
+
const trailing = this.safeBool(params, 'trailing');
|
|
3245
|
+
params = this.omit(params, ['clientOrderId', 'stop', 'trigger', 'trailing', 'stopLossTakeProfit']);
|
|
3194
3246
|
let response = undefined;
|
|
3195
3247
|
if (market['spot']) {
|
|
3196
|
-
|
|
3248
|
+
if (trigger || stopLossTakeProfit) {
|
|
3249
|
+
if (stopLossTakeProfit) {
|
|
3250
|
+
request['type'] = 'tp/sl';
|
|
3251
|
+
}
|
|
3252
|
+
else if (trigger) {
|
|
3253
|
+
request['type'] = 'trigger';
|
|
3254
|
+
}
|
|
3255
|
+
response = await this.privatePostSpotV4AlgoCancelOrder(this.extend(request, params));
|
|
3256
|
+
}
|
|
3257
|
+
else {
|
|
3258
|
+
response = await this.privatePostSpotV3CancelOrder(this.extend(request, params));
|
|
3259
|
+
}
|
|
3197
3260
|
}
|
|
3198
3261
|
else {
|
|
3199
|
-
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
3200
|
-
const trailing = this.safeBool(params, 'trailing');
|
|
3201
|
-
params = this.omit(params, ['stop', 'trigger']);
|
|
3202
3262
|
if (trigger) {
|
|
3203
3263
|
response = await this.privatePostContractPrivateCancelPlanOrder(this.extend(request, params));
|
|
3204
3264
|
}
|
|
@@ -3323,9 +3383,12 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3323
3383
|
* @description cancel all open orders in a market
|
|
3324
3384
|
* @see https://developer-pro.bitmart.com/en/spot/#cancel-all-order-v4-signed
|
|
3325
3385
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#cancel-all-orders-signed
|
|
3386
|
+
* @see https://developer-pro.bitmart.com/en/spot/#cancel-all-algo-order-v4-signed
|
|
3326
3387
|
* @param {string} symbol unified market symbol of the market to cancel orders in
|
|
3327
3388
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3328
3389
|
* @param {string} [params.side] *spot only* 'buy' or 'sell'
|
|
3390
|
+
* @param {boolean} [params.trigger] whether the orders are trigger orders
|
|
3391
|
+
* @param {boolean} [params.stopLossTakeProfit] whether the orders are stopLossPrice or takeProfitPrice orders
|
|
3329
3392
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
|
|
3330
3393
|
*/
|
|
3331
3394
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
@@ -3340,7 +3403,21 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3340
3403
|
let type = undefined;
|
|
3341
3404
|
[type, params] = this.handleMarketTypeAndParams('cancelAllOrders', market, params);
|
|
3342
3405
|
if (type === 'spot') {
|
|
3343
|
-
|
|
3406
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
3407
|
+
const stopLossTakeProfit = this.safeBool(params, 'stopLossTakeProfit');
|
|
3408
|
+
params = this.omit(params, ['stop', 'trigger', 'stopLossTakeProfit']);
|
|
3409
|
+
if (trigger || stopLossTakeProfit) {
|
|
3410
|
+
if (stopLossTakeProfit) {
|
|
3411
|
+
request['type'] = 'tp/sl';
|
|
3412
|
+
}
|
|
3413
|
+
else if (trigger) {
|
|
3414
|
+
request['type'] = 'trigger';
|
|
3415
|
+
}
|
|
3416
|
+
response = await this.privatePostSpotV4AlgoCancelAll(this.extend(request, params));
|
|
3417
|
+
}
|
|
3418
|
+
else {
|
|
3419
|
+
response = await this.privatePostSpotV4CancelAll(this.extend(request, params));
|
|
3420
|
+
}
|
|
3344
3421
|
}
|
|
3345
3422
|
else if (type === 'swap') {
|
|
3346
3423
|
if (symbol === undefined) {
|
|
@@ -3430,10 +3507,11 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3430
3507
|
/**
|
|
3431
3508
|
* @method
|
|
3432
3509
|
* @name bitmart#fetchOpenOrders
|
|
3510
|
+
* @description fetch all unfilled currently open orders
|
|
3433
3511
|
* @see https://developer-pro.bitmart.com/en/spot/#current-open-orders-v4-signed
|
|
3434
3512
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-all-open-orders-keyed
|
|
3435
3513
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-all-current-plan-orders-keyed
|
|
3436
|
-
* @
|
|
3514
|
+
* @see https://developer-pro.bitmart.com/en/spot/#current-algo-open-orders-v4-signed
|
|
3437
3515
|
* @param {string} symbol unified market symbol
|
|
3438
3516
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
3439
3517
|
* @param {int} [limit] the maximum number of open order structures to retrieve
|
|
@@ -3444,7 +3522,8 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3444
3522
|
* @param {string} [params.order_state] *swap* the order state, 'all' or 'partially_filled', default is 'all'
|
|
3445
3523
|
* @param {string} [params.orderType] *swap only* 'limit', 'market', or 'trailing'
|
|
3446
3524
|
* @param {boolean} [params.trailing] *swap only* set to true if you want to fetch trailing orders
|
|
3447
|
-
* @param {boolean} [params.trigger]
|
|
3525
|
+
* @param {boolean} [params.trigger] set to true if you want to fetch trigger orders
|
|
3526
|
+
* @param {boolean} [params.stopLossTakeProfit] set to true if you want to fetch stopLossPrice or takeProfitPrice orders
|
|
3448
3527
|
* @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
|
|
3449
3528
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
|
|
3450
3529
|
*/
|
|
@@ -3459,6 +3538,9 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3459
3538
|
let type = undefined;
|
|
3460
3539
|
let response = undefined;
|
|
3461
3540
|
[type, params] = this.handleMarketTypeAndParams('fetchOpenOrders', market, params);
|
|
3541
|
+
const isTrigger = this.safeBool2(params, 'stop', 'trigger');
|
|
3542
|
+
const stopLossTakeProfit = this.safeBool(params, 'stopLossTakeProfit');
|
|
3543
|
+
params = this.omit(params, ['stop', 'trigger', 'stopLossTakeProfit']);
|
|
3462
3544
|
if (type === 'spot') {
|
|
3463
3545
|
if (limit !== undefined) {
|
|
3464
3546
|
request['limit'] = Math.min(limit, 200);
|
|
@@ -3476,14 +3558,23 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3476
3558
|
params = this.omit(params, ['endTime']);
|
|
3477
3559
|
request['endTime'] = until;
|
|
3478
3560
|
}
|
|
3479
|
-
|
|
3561
|
+
if (isTrigger || stopLossTakeProfit) {
|
|
3562
|
+
if (isTrigger) {
|
|
3563
|
+
request['orderMode'] = 'trigger';
|
|
3564
|
+
}
|
|
3565
|
+
else if (stopLossTakeProfit) {
|
|
3566
|
+
request['orderMode'] = 'tp/sl';
|
|
3567
|
+
}
|
|
3568
|
+
response = await this.privatePostSpotV4QueryAlgoOpenOrders(this.extend(request, params));
|
|
3569
|
+
}
|
|
3570
|
+
else {
|
|
3571
|
+
response = await this.privatePostSpotV4QueryOpenOrders(this.extend(request, params));
|
|
3572
|
+
}
|
|
3480
3573
|
}
|
|
3481
3574
|
else if (type === 'swap') {
|
|
3482
3575
|
if (limit !== undefined) {
|
|
3483
3576
|
request['limit'] = Math.min(limit, 100);
|
|
3484
3577
|
}
|
|
3485
|
-
const isTrigger = this.safeBool2(params, 'stop', 'trigger');
|
|
3486
|
-
params = this.omit(params, ['stop', 'trigger']);
|
|
3487
3578
|
if (isTrigger) {
|
|
3488
3579
|
response = await this.privateGetContractPrivateCurrentPlanOrder(this.extend(request, params));
|
|
3489
3580
|
}
|
|
@@ -3563,9 +3654,10 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3563
3654
|
/**
|
|
3564
3655
|
* @method
|
|
3565
3656
|
* @name bitmart#fetchClosedOrders
|
|
3657
|
+
* @description fetches information on multiple closed orders made by the user
|
|
3566
3658
|
* @see https://developer-pro.bitmart.com/en/spot/#account-orders-v4-signed
|
|
3567
3659
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-history-keyed
|
|
3568
|
-
* @
|
|
3660
|
+
* @see https://developer-pro.bitmart.com/en/spot/#account-algo-orders-v4-signed
|
|
3569
3661
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
3570
3662
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
3571
3663
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -3573,6 +3665,8 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3573
3665
|
* @param {int} [params.until] timestamp in ms of the latest entry
|
|
3574
3666
|
* @param {string} [params.marginMode] *spot only* 'cross' or 'isolated', for margin trading
|
|
3575
3667
|
* @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
|
|
3668
|
+
* @param {boolean} [params.trigger] set to true if you want to fetch trigger orders
|
|
3669
|
+
* @param {boolean} [params.stopLossTakeProfit] set to true if you want to fetch stopLossPrice or takeProfitPrice orders
|
|
3576
3670
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/?id=order-structure}
|
|
3577
3671
|
*/
|
|
3578
3672
|
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -3600,6 +3694,9 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3600
3694
|
params = this.omit(params, ['until']);
|
|
3601
3695
|
request[endTimeKey] = until;
|
|
3602
3696
|
}
|
|
3697
|
+
const isTrigger = this.safeBool2(params, 'stop', 'trigger');
|
|
3698
|
+
const stopLossTakeProfit = this.safeBool(params, 'stopLossTakeProfit');
|
|
3699
|
+
params = this.omit(params, ['stop', 'trigger', 'stopLossTakeProfit']);
|
|
3603
3700
|
let response = undefined;
|
|
3604
3701
|
if (type === 'spot') {
|
|
3605
3702
|
let marginMode = undefined;
|
|
@@ -3607,7 +3704,18 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3607
3704
|
if (marginMode === 'isolated') {
|
|
3608
3705
|
request['orderMode'] = 'iso_margin';
|
|
3609
3706
|
}
|
|
3610
|
-
|
|
3707
|
+
if (isTrigger || stopLossTakeProfit) {
|
|
3708
|
+
if (isTrigger) {
|
|
3709
|
+
request['orderMode'] = 'trigger';
|
|
3710
|
+
}
|
|
3711
|
+
else if (stopLossTakeProfit) {
|
|
3712
|
+
request['orderMode'] = 'tp/sl';
|
|
3713
|
+
}
|
|
3714
|
+
response = await this.privatePostSpotV4QueryAlgoHistoryOrders(this.extend(request, params));
|
|
3715
|
+
}
|
|
3716
|
+
else {
|
|
3717
|
+
response = await this.privatePostSpotV4QueryHistoryOrders(this.extend(request, params));
|
|
3718
|
+
}
|
|
3611
3719
|
}
|
|
3612
3720
|
else {
|
|
3613
3721
|
response = await this.privateGetContractPrivateOrderHistory(this.extend(request, params));
|
|
@@ -3635,6 +3743,8 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3635
3743
|
* @see https://developer-pro.bitmart.com/en/spot/#query-order-by-id-v4-signed
|
|
3636
3744
|
* @see https://developer-pro.bitmart.com/en/spot/#query-order-by-clientorderid-v4-signed
|
|
3637
3745
|
* @see https://developer-pro.bitmart.com/en/futuresv2/#get-order-detail-keyed
|
|
3746
|
+
* @see https://developer-pro.bitmart.com/en/spot/#query-algo-order-by-id-v4-signed
|
|
3747
|
+
* @see https://developer-pro.bitmart.com/en/spot/#query-algo-order-by-clientorderid-v4-signed
|
|
3638
3748
|
* @param {string} id the id of the order
|
|
3639
3749
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
3640
3750
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -3642,6 +3752,7 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3642
3752
|
* @param {string} [params.orderType] *swap only* 'limit', 'market', 'liquidate', 'bankruptcy', 'adl' or 'trailing'
|
|
3643
3753
|
* @param {boolean} [params.trailing] *swap only* set to true if you want to fetch a trailing order
|
|
3644
3754
|
* @param {string} [params.stpMode] self-trade prevention only for spot, defaults to none, ['none', 'cancel_maker', 'cancel_taker', 'cancel_both']
|
|
3755
|
+
* @param {boolean} [params.trigger] whether the orders is a trigger, stopLossPrice or takeProfitPrice order
|
|
3645
3756
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/?id=order-structure}
|
|
3646
3757
|
*/
|
|
3647
3758
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
@@ -3656,14 +3767,26 @@ class bitmart extends bitmart$1["default"] {
|
|
|
3656
3767
|
[type, params] = this.handleMarketTypeAndParams('fetchOrder', market, params);
|
|
3657
3768
|
if (type === 'spot') {
|
|
3658
3769
|
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
3770
|
+
const trigger = this.safeBool2(params, 'stop', 'trigger');
|
|
3771
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
3659
3772
|
if (!clientOrderId) {
|
|
3660
3773
|
request['orderId'] = id;
|
|
3661
3774
|
}
|
|
3662
|
-
if (
|
|
3663
|
-
|
|
3775
|
+
if (trigger) {
|
|
3776
|
+
if (clientOrderId !== undefined) {
|
|
3777
|
+
response = await this.privatePostSpotV4QueryAlgoClientOrder(this.extend(request, params));
|
|
3778
|
+
}
|
|
3779
|
+
else {
|
|
3780
|
+
response = await this.privatePostSpotV4QueryAlgoOrder(this.extend(request, params));
|
|
3781
|
+
}
|
|
3664
3782
|
}
|
|
3665
3783
|
else {
|
|
3666
|
-
|
|
3784
|
+
if (clientOrderId !== undefined) {
|
|
3785
|
+
response = await this.privatePostSpotV4QueryClientOrder(this.extend(request, params));
|
|
3786
|
+
}
|
|
3787
|
+
else {
|
|
3788
|
+
response = await this.privatePostSpotV4QueryOrder(this.extend(request, params));
|
|
3789
|
+
}
|
|
3667
3790
|
}
|
|
3668
3791
|
}
|
|
3669
3792
|
else if (type === 'swap') {
|