ccxt 4.5.14 → 4.5.16
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 +20 -5
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +1 -0
- package/dist/cjs/src/backpack.js +7 -2
- package/dist/cjs/src/base/Exchange.js +46 -0
- package/dist/cjs/src/binance.js +3 -0
- package/dist/cjs/src/bingx.js +73 -46
- package/dist/cjs/src/bitget.js +19 -6
- package/dist/cjs/src/blofin.js +7 -6
- package/dist/cjs/src/bybit.js +16 -6
- package/dist/cjs/src/delta.js +98 -3
- package/dist/cjs/src/gate.js +152 -151
- package/dist/cjs/src/htx.js +1 -0
- package/dist/cjs/src/kraken.js +99 -4
- package/dist/cjs/src/kucoin.js +1 -0
- package/dist/cjs/src/mexc.js +1 -0
- package/dist/cjs/src/okx.js +10 -0
- package/dist/cjs/src/phemex.js +6 -3
- package/dist/cjs/src/poloniex.js +3 -0
- package/dist/cjs/src/pro/binance.js +1 -1
- package/dist/cjs/src/pro/kraken.js +1 -1
- package/dist/cjs/src/pro/upbit.js +25 -1
- package/dist/cjs/src/woo.js +41 -20
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +17 -0
- package/js/src/abstract/bybit.d.ts +1 -0
- package/js/src/abstract/delta.d.ts +5 -1
- package/js/src/abstract/woo.d.ts +0 -3
- package/js/src/ascendex.js +1 -0
- package/js/src/backpack.d.ts +1 -1
- package/js/src/backpack.js +7 -2
- package/js/src/base/Exchange.d.ts +31 -0
- package/js/src/base/Exchange.js +47 -1
- package/js/src/base/types.d.ts +2 -0
- package/js/src/binance.js +3 -0
- package/js/src/bingx.d.ts +2 -2
- package/js/src/bingx.js +73 -46
- package/js/src/bitget.js +19 -6
- package/js/src/blofin.js +7 -6
- package/js/src/bybit.d.ts +1 -1
- package/js/src/bybit.js +16 -6
- package/js/src/delta.d.ts +13 -0
- package/js/src/delta.js +98 -3
- package/js/src/derive.js +1 -1
- package/js/src/gate.d.ts +140 -140
- package/js/src/gate.js +152 -151
- package/js/src/htx.js +1 -0
- package/js/src/kraken.d.ts +11 -1
- package/js/src/kraken.js +99 -4
- package/js/src/kucoin.js +1 -0
- package/js/src/mexc.js +1 -0
- package/js/src/okx.js +10 -0
- package/js/src/phemex.js +6 -3
- package/js/src/poloniex.js +3 -0
- package/js/src/pro/binance.js +1 -1
- package/js/src/pro/gate.js +1 -1
- package/js/src/pro/gemini.js +1 -1
- package/js/src/pro/kraken.d.ts +1 -1
- package/js/src/pro/kraken.js +1 -1
- package/js/src/pro/onetrading.js +1 -1
- package/js/src/pro/upbit.js +25 -1
- package/js/src/woo.d.ts +1 -1
- package/js/src/woo.js +41 -20
- package/package.json +1 -1
package/dist/cjs/ccxt.js
CHANGED
|
@@ -213,7 +213,7 @@ SOFTWARE.
|
|
|
213
213
|
*/
|
|
214
214
|
//-----------------------------------------------------------------------------
|
|
215
215
|
// this is updated by vss.js when building
|
|
216
|
-
const version = '4.5.
|
|
216
|
+
const version = '4.5.16';
|
|
217
217
|
Exchange["default"].ccxtVersion = version;
|
|
218
218
|
const exchanges = {
|
|
219
219
|
'alpaca': alpaca["default"],
|
package/dist/cjs/src/ascendex.js
CHANGED
package/dist/cjs/src/backpack.js
CHANGED
|
@@ -61,6 +61,7 @@ class backpack extends backpack$1["default"] {
|
|
|
61
61
|
'createTrailingPercentOrder': false,
|
|
62
62
|
'createTriggerOrder': true,
|
|
63
63
|
'fetchAccounts': false,
|
|
64
|
+
'fetchAllGreeks': false,
|
|
64
65
|
'fetchBalance': true,
|
|
65
66
|
'fetchCanceledAndClosedOrders': false,
|
|
66
67
|
'fetchCanceledOrders': false,
|
|
@@ -79,6 +80,7 @@ class backpack extends backpack$1["default"] {
|
|
|
79
80
|
'fetchFundingRate': true,
|
|
80
81
|
'fetchFundingRateHistory': true,
|
|
81
82
|
'fetchFundingRates': false,
|
|
83
|
+
'fetchGreeks': false,
|
|
82
84
|
'fetchIndexOHLCV': true,
|
|
83
85
|
'fetchLedger': false,
|
|
84
86
|
'fetchLeverage': false,
|
|
@@ -93,6 +95,8 @@ class backpack extends backpack$1["default"] {
|
|
|
93
95
|
'fetchOpenInterestHistory': true,
|
|
94
96
|
'fetchOpenOrder': true,
|
|
95
97
|
'fetchOpenOrders': true,
|
|
98
|
+
'fetchOption': false,
|
|
99
|
+
'fetchOptionChain': false,
|
|
96
100
|
'fetchOrder': false,
|
|
97
101
|
'fetchOrderBook': true,
|
|
98
102
|
'fetchOrders': true,
|
|
@@ -113,6 +117,7 @@ class backpack extends backpack$1["default"] {
|
|
|
113
117
|
'fetchTradingFees': false,
|
|
114
118
|
'fetchTransactions': false,
|
|
115
119
|
'fetchTransfers': false,
|
|
120
|
+
'fetchVolatilityHistory': false,
|
|
116
121
|
'fetchWithdrawals': true,
|
|
117
122
|
'reduceMargin': false,
|
|
118
123
|
'sandbox': false,
|
|
@@ -1436,7 +1441,7 @@ class backpack extends backpack$1["default"] {
|
|
|
1436
1441
|
* @param {string} address the address to withdraw to
|
|
1437
1442
|
* @param {string} tag
|
|
1438
1443
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1439
|
-
* @param {string}
|
|
1444
|
+
* @param {string} params.network the network to withdraw on (mandatory)
|
|
1440
1445
|
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
1441
1446
|
*/
|
|
1442
1447
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
@@ -1444,7 +1449,7 @@ class backpack extends backpack$1["default"] {
|
|
|
1444
1449
|
const currency = this.currency(code);
|
|
1445
1450
|
const request = {
|
|
1446
1451
|
'symbol': currency['id'],
|
|
1447
|
-
'
|
|
1452
|
+
'quantity': this.numberToString(amount),
|
|
1448
1453
|
'address': address,
|
|
1449
1454
|
};
|
|
1450
1455
|
if (tag !== undefined) {
|
|
@@ -1455,8 +1455,10 @@ class Exchange {
|
|
|
1455
1455
|
'cancelAllOrders': undefined,
|
|
1456
1456
|
'cancelAllOrdersWs': undefined,
|
|
1457
1457
|
'cancelOrder': true,
|
|
1458
|
+
'cancelOrderWithClientOrderId': undefined,
|
|
1458
1459
|
'cancelOrderWs': undefined,
|
|
1459
1460
|
'cancelOrders': undefined,
|
|
1461
|
+
'cancelOrdersWithClientOrderId': undefined,
|
|
1460
1462
|
'cancelOrdersWs': undefined,
|
|
1461
1463
|
'closeAllPositions': undefined,
|
|
1462
1464
|
'closePosition': undefined,
|
|
@@ -1506,6 +1508,7 @@ class Exchange {
|
|
|
1506
1508
|
'createTriggerOrderWs': undefined,
|
|
1507
1509
|
'deposit': undefined,
|
|
1508
1510
|
'editOrder': 'emulated',
|
|
1511
|
+
'editOrderWithClientOrderId': undefined,
|
|
1509
1512
|
'editOrders': undefined,
|
|
1510
1513
|
'editOrderWs': undefined,
|
|
1511
1514
|
'fetchAccounts': undefined,
|
|
@@ -1584,6 +1587,7 @@ class Exchange {
|
|
|
1584
1587
|
'fetchOption': undefined,
|
|
1585
1588
|
'fetchOptionChain': undefined,
|
|
1586
1589
|
'fetchOrder': undefined,
|
|
1590
|
+
'fetchOrderWithClientOrderId': undefined,
|
|
1587
1591
|
'fetchOrderBook': true,
|
|
1588
1592
|
'fetchOrderBooks': undefined,
|
|
1589
1593
|
'fetchOrderBookWs': undefined,
|
|
@@ -4767,6 +4771,9 @@ class Exchange {
|
|
|
4767
4771
|
await this.cancelOrder(id, symbol);
|
|
4768
4772
|
return await this.createOrder(symbol, type, side, amount, price, params);
|
|
4769
4773
|
}
|
|
4774
|
+
async editOrderWithClientOrderId(clientOrderId, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
4775
|
+
return await this.editOrder('', symbol, type, side, amount, price, this.extend({ 'clientOrderId': clientOrderId }, params));
|
|
4776
|
+
}
|
|
4770
4777
|
async editOrderWs(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
4771
4778
|
await this.cancelOrderWs(id, symbol);
|
|
4772
4779
|
return await this.createOrderWs(symbol, type, side, amount, price, params);
|
|
@@ -5257,6 +5264,19 @@ class Exchange {
|
|
|
5257
5264
|
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
5258
5265
|
throw new errors.NotSupported(this.id + ' fetchOrder() is not supported yet');
|
|
5259
5266
|
}
|
|
5267
|
+
/**
|
|
5268
|
+
* @method
|
|
5269
|
+
* @name fetchOrderWithClientOrderId
|
|
5270
|
+
* @description create a market order by providing the symbol, side and cost
|
|
5271
|
+
* @param {string} clientOrderId client order Id
|
|
5272
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
5273
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5274
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5275
|
+
*/
|
|
5276
|
+
async fetchOrderWithClientOrderId(clientOrderId, symbol = undefined, params = {}) {
|
|
5277
|
+
const extendedParams = this.extend(params, { 'clientOrderId': clientOrderId });
|
|
5278
|
+
return await this.fetchOrder('', symbol, extendedParams);
|
|
5279
|
+
}
|
|
5260
5280
|
async fetchOrderWs(id, symbol = undefined, params = {}) {
|
|
5261
5281
|
throw new errors.NotSupported(this.id + ' fetchOrderWs() is not supported yet');
|
|
5262
5282
|
}
|
|
@@ -5711,12 +5731,38 @@ class Exchange {
|
|
|
5711
5731
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
5712
5732
|
throw new errors.NotSupported(this.id + ' cancelOrder() is not supported yet');
|
|
5713
5733
|
}
|
|
5734
|
+
/**
|
|
5735
|
+
* @method
|
|
5736
|
+
* @name cancelOrderWithClientOrderId
|
|
5737
|
+
* @description create a market order by providing the symbol, side and cost
|
|
5738
|
+
* @param {string} clientOrderId client order Id
|
|
5739
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
5740
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5741
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5742
|
+
*/
|
|
5743
|
+
async cancelOrderWithClientOrderId(clientOrderId, symbol = undefined, params = {}) {
|
|
5744
|
+
const extendedParams = this.extend(params, { 'clientOrderId': clientOrderId });
|
|
5745
|
+
return await this.cancelOrder('', symbol, extendedParams);
|
|
5746
|
+
}
|
|
5714
5747
|
async cancelOrderWs(id, symbol = undefined, params = {}) {
|
|
5715
5748
|
throw new errors.NotSupported(this.id + ' cancelOrderWs() is not supported yet');
|
|
5716
5749
|
}
|
|
5717
5750
|
async cancelOrders(ids, symbol = undefined, params = {}) {
|
|
5718
5751
|
throw new errors.NotSupported(this.id + ' cancelOrders() is not supported yet');
|
|
5719
5752
|
}
|
|
5753
|
+
/**
|
|
5754
|
+
* @method
|
|
5755
|
+
* @name cancelOrdersWithClientOrderIds
|
|
5756
|
+
* @description create a market order by providing the symbol, side and cost
|
|
5757
|
+
* @param {string[]} clientOrderIds client order Ids
|
|
5758
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
5759
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5760
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5761
|
+
*/
|
|
5762
|
+
async cancelOrdersWithClientOrderIds(clientOrderIds, symbol = undefined, params = {}) {
|
|
5763
|
+
const extendedParams = this.extend(params, { 'clientOrderIds': clientOrderIds });
|
|
5764
|
+
return await this.cancelOrders([], symbol, extendedParams);
|
|
5765
|
+
}
|
|
5720
5766
|
async cancelOrdersWs(ids, symbol = undefined, params = {}) {
|
|
5721
5767
|
throw new errors.NotSupported(this.id + ' cancelOrdersWs() is not supported yet');
|
|
5722
5768
|
}
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -12132,6 +12132,9 @@ class binance extends binance$1["default"] {
|
|
|
12132
12132
|
const orderidlist = this.safeList(extendedParams, 'orderidlist', []);
|
|
12133
12133
|
const origclientorderidlist = this.safeList2(extendedParams, 'origclientorderidlist', 'origClientOrderIdList', []);
|
|
12134
12134
|
extendedParams = this.omit(extendedParams, ['orderidlist', 'origclientorderidlist', 'origClientOrderIdList']);
|
|
12135
|
+
if ('symbol' in extendedParams) {
|
|
12136
|
+
extendedParams['symbol'] = this.encodeURIComponent(extendedParams['symbol']);
|
|
12137
|
+
}
|
|
12135
12138
|
query = this.rawencode(extendedParams);
|
|
12136
12139
|
const orderidlistLength = orderidlist.length;
|
|
12137
12140
|
const origclientorderidlistLength = origclientorderidlist.length;
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -173,6 +173,9 @@ class bingx extends bingx$1["default"] {
|
|
|
173
173
|
'trade/myTrades': 2,
|
|
174
174
|
'user/commissionRate': 5,
|
|
175
175
|
'account/balance': 2,
|
|
176
|
+
'oco/orderList': 5,
|
|
177
|
+
'oco/openOrderList': 5,
|
|
178
|
+
'oco/historyOrderList': 5,
|
|
176
179
|
},
|
|
177
180
|
'post': {
|
|
178
181
|
'trade/order': 2,
|
|
@@ -182,6 +185,8 @@ class bingx extends bingx$1["default"] {
|
|
|
182
185
|
'trade/cancelOrders': 5,
|
|
183
186
|
'trade/cancelOpenOrders': 5,
|
|
184
187
|
'trade/cancelAllAfter': 5,
|
|
188
|
+
'oco/order': 5,
|
|
189
|
+
'oco/cancel': 5,
|
|
185
190
|
},
|
|
186
191
|
},
|
|
187
192
|
},
|
|
@@ -215,6 +220,7 @@ class bingx extends bingx$1["default"] {
|
|
|
215
220
|
'market/historicalTrades': 1,
|
|
216
221
|
'market/markPriceKlines': 1,
|
|
217
222
|
'trade/multiAssetsRules': 1,
|
|
223
|
+
'tradingRules': 1,
|
|
218
224
|
},
|
|
219
225
|
},
|
|
220
226
|
'private': {
|
|
@@ -240,6 +246,8 @@ class bingx extends bingx$1["default"] {
|
|
|
240
246
|
'twap/order': 5,
|
|
241
247
|
'twap/cancelOrder': 5,
|
|
242
248
|
'trade/assetMode': 5,
|
|
249
|
+
'trade/reverse': 5,
|
|
250
|
+
'trade/autoAddMargin': 5,
|
|
243
251
|
},
|
|
244
252
|
},
|
|
245
253
|
},
|
|
@@ -300,6 +308,11 @@ class bingx extends bingx$1["default"] {
|
|
|
300
308
|
'quote/klines': 1,
|
|
301
309
|
},
|
|
302
310
|
},
|
|
311
|
+
'private': {
|
|
312
|
+
'get': {
|
|
313
|
+
'user/balance': 2,
|
|
314
|
+
},
|
|
315
|
+
},
|
|
303
316
|
},
|
|
304
317
|
},
|
|
305
318
|
'cswap': {
|
|
@@ -478,6 +491,22 @@ class bingx extends bingx$1["default"] {
|
|
|
478
491
|
},
|
|
479
492
|
},
|
|
480
493
|
},
|
|
494
|
+
'agent': {
|
|
495
|
+
'v1': {
|
|
496
|
+
'private': {
|
|
497
|
+
'get': {
|
|
498
|
+
'account/inviteAccountList': 5,
|
|
499
|
+
'reward/commissionDataList': 5,
|
|
500
|
+
'account/inviteRelationCheck': 5,
|
|
501
|
+
'asset/depositDetailList': 5,
|
|
502
|
+
'reward/third/commissionDataList': 5,
|
|
503
|
+
'asset/partnerData': 5,
|
|
504
|
+
'commissionDataList/referralCode': 5,
|
|
505
|
+
'account/superiorCheck': 5,
|
|
506
|
+
},
|
|
507
|
+
},
|
|
508
|
+
},
|
|
509
|
+
},
|
|
481
510
|
},
|
|
482
511
|
'timeframes': {
|
|
483
512
|
'1m': '1m',
|
|
@@ -2200,7 +2229,7 @@ class bingx extends bingx$1["default"] {
|
|
|
2200
2229
|
* @name bingx#fetchBalance
|
|
2201
2230
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
2202
2231
|
* @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%20Assets
|
|
2203
|
-
* @see https://bingx-api.github.io/docs/#/swapV2/account-api.html#
|
|
2232
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/account-api.html#Query%20account%20data
|
|
2204
2233
|
* @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Query%20standard%20contract%20balance
|
|
2205
2234
|
* @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Account%20Assets
|
|
2206
2235
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -2296,27 +2325,26 @@ class bingx extends bingx$1["default"] {
|
|
|
2296
2325
|
//
|
|
2297
2326
|
}
|
|
2298
2327
|
else {
|
|
2299
|
-
response = await this.
|
|
2328
|
+
response = await this.swapV3PrivateGetUserBalance(marketTypeQuery);
|
|
2300
2329
|
//
|
|
2301
2330
|
// {
|
|
2302
2331
|
// "code": 0,
|
|
2303
2332
|
// "msg": "",
|
|
2304
|
-
// "data":
|
|
2305
|
-
//
|
|
2306
|
-
// "userId": "
|
|
2333
|
+
// "data": [
|
|
2334
|
+
// {
|
|
2335
|
+
// "userId": "116***295",
|
|
2307
2336
|
// "asset": "USDT",
|
|
2308
|
-
// "balance": "
|
|
2309
|
-
// "equity": "
|
|
2310
|
-
// "unrealizedProfit": "
|
|
2311
|
-
// "realisedProfit": "-
|
|
2312
|
-
// "availableMargin": "
|
|
2313
|
-
// "usedMargin": "1.
|
|
2337
|
+
// "balance": "194.8212",
|
|
2338
|
+
// "equity": "196.7431",
|
|
2339
|
+
// "unrealizedProfit": "1.9219",
|
|
2340
|
+
// "realisedProfit": "-109.2504",
|
|
2341
|
+
// "availableMargin": "193.7609",
|
|
2342
|
+
// "usedMargin": "1.0602",
|
|
2314
2343
|
// "freezedMargin": "0.0000",
|
|
2315
2344
|
// "shortUid": "12851936"
|
|
2316
2345
|
// }
|
|
2317
|
-
//
|
|
2346
|
+
// ]
|
|
2318
2347
|
// }
|
|
2319
|
-
//
|
|
2320
2348
|
}
|
|
2321
2349
|
}
|
|
2322
2350
|
return this.parseBalance(response);
|
|
@@ -2384,34 +2412,35 @@ class bingx extends bingx$1["default"] {
|
|
|
2384
2412
|
// {
|
|
2385
2413
|
// "code": 0,
|
|
2386
2414
|
// "msg": "",
|
|
2387
|
-
// "data":
|
|
2388
|
-
//
|
|
2389
|
-
// "userId": "
|
|
2415
|
+
// "data": [
|
|
2416
|
+
// {
|
|
2417
|
+
// "userId": "116***295",
|
|
2390
2418
|
// "asset": "USDT",
|
|
2391
|
-
// "balance": "
|
|
2392
|
-
// "equity": "
|
|
2393
|
-
// "unrealizedProfit": "
|
|
2394
|
-
// "realisedProfit": "-
|
|
2395
|
-
// "availableMargin": "
|
|
2396
|
-
// "usedMargin": "1.
|
|
2419
|
+
// "balance": "194.8212",
|
|
2420
|
+
// "equity": "196.7431",
|
|
2421
|
+
// "unrealizedProfit": "1.9219",
|
|
2422
|
+
// "realisedProfit": "-109.2504",
|
|
2423
|
+
// "availableMargin": "193.7609",
|
|
2424
|
+
// "usedMargin": "1.0602",
|
|
2397
2425
|
// "freezedMargin": "0.0000",
|
|
2398
2426
|
// "shortUid": "12851936"
|
|
2399
2427
|
// }
|
|
2400
|
-
//
|
|
2428
|
+
// ]
|
|
2401
2429
|
// }
|
|
2402
2430
|
//
|
|
2403
2431
|
const result = { 'info': response };
|
|
2404
|
-
const
|
|
2405
|
-
const
|
|
2406
|
-
const
|
|
2432
|
+
const contractBalances = this.safeList(response, 'data');
|
|
2433
|
+
const firstContractBalances = this.safeDict(contractBalances, 0);
|
|
2434
|
+
const isContract = firstContractBalances !== undefined;
|
|
2407
2435
|
const spotData = this.safeDict(response, 'data', {});
|
|
2408
2436
|
const spotBalances = this.safeList2(spotData, 'balances', 'assets', []);
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
for (let i = 0; i < standardAndInverseBalances.length; i++) {
|
|
2413
|
-
const balance = standardAndInverseBalances[i];
|
|
2437
|
+
if (isContract) {
|
|
2438
|
+
for (let i = 0; i < contractBalances.length; i++) {
|
|
2439
|
+
const balance = contractBalances[i];
|
|
2414
2440
|
const currencyId = this.safeString(balance, 'asset');
|
|
2441
|
+
if (currencyId === undefined) { // linear v3 returns empty asset
|
|
2442
|
+
break;
|
|
2443
|
+
}
|
|
2415
2444
|
const code = this.safeCurrencyCode(currencyId);
|
|
2416
2445
|
const account = this.account();
|
|
2417
2446
|
account['free'] = this.safeString2(balance, 'availableMargin', 'availableBalance');
|
|
@@ -2420,7 +2449,7 @@ class bingx extends bingx$1["default"] {
|
|
|
2420
2449
|
result[code] = account;
|
|
2421
2450
|
}
|
|
2422
2451
|
}
|
|
2423
|
-
else
|
|
2452
|
+
else {
|
|
2424
2453
|
for (let i = 0; i < spotBalances.length; i++) {
|
|
2425
2454
|
const balance = spotBalances[i];
|
|
2426
2455
|
const currencyId = this.safeString(balance, 'asset');
|
|
@@ -2431,18 +2460,6 @@ class bingx extends bingx$1["default"] {
|
|
|
2431
2460
|
result[code] = account;
|
|
2432
2461
|
}
|
|
2433
2462
|
}
|
|
2434
|
-
else {
|
|
2435
|
-
const linearSwapData = this.safeDict(response, 'data', {});
|
|
2436
|
-
const linearSwapBalance = this.safeDict(linearSwapData, 'balance');
|
|
2437
|
-
if (linearSwapBalance) {
|
|
2438
|
-
const currencyId = this.safeString(linearSwapBalance, 'asset');
|
|
2439
|
-
const code = this.safeCurrencyCode(currencyId);
|
|
2440
|
-
const account = this.account();
|
|
2441
|
-
account['free'] = this.safeString(linearSwapBalance, 'availableMargin');
|
|
2442
|
-
account['used'] = this.safeString(linearSwapBalance, 'usedMargin');
|
|
2443
|
-
result[code] = account;
|
|
2444
|
-
}
|
|
2445
|
-
}
|
|
2446
2463
|
return this.safeBalance(result);
|
|
2447
2464
|
}
|
|
2448
2465
|
/**
|
|
@@ -5883,7 +5900,7 @@ class bingx extends bingx$1["default"] {
|
|
|
5883
5900
|
* @param {string} address the address to withdraw to
|
|
5884
5901
|
* @param {string} [tag]
|
|
5885
5902
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5886
|
-
* @param {int} [params.walletType] 1 fund account, 2 standard account, 3 perpetual account, 15 spot account
|
|
5903
|
+
* @param {int} [params.walletType] 1 fund (funding) account, 2 standard account, 3 perpetual account, 15 spot account
|
|
5887
5904
|
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
5888
5905
|
*/
|
|
5889
5906
|
async withdraw(code, amount, address, tag = undefined, params = {}) {
|
|
@@ -5891,7 +5908,17 @@ class bingx extends bingx$1["default"] {
|
|
|
5891
5908
|
this.checkAddress(address);
|
|
5892
5909
|
await this.loadMarkets();
|
|
5893
5910
|
const currency = this.currency(code);
|
|
5894
|
-
const
|
|
5911
|
+
const defaultWalletType = 15; // spot
|
|
5912
|
+
let walletType = undefined;
|
|
5913
|
+
[walletType, params] = this.handleOptionAndParams2(params, 'withdraw', 'type', 'walletType', defaultWalletType);
|
|
5914
|
+
const walletTypes = {
|
|
5915
|
+
'funding': 1,
|
|
5916
|
+
'fund': 1,
|
|
5917
|
+
'standard': 2,
|
|
5918
|
+
'perpetual': 3,
|
|
5919
|
+
'spot': 15,
|
|
5920
|
+
};
|
|
5921
|
+
walletType = this.safeInteger(walletTypes, walletType, defaultWalletType);
|
|
5895
5922
|
const request = {
|
|
5896
5923
|
'coin': currency['id'],
|
|
5897
5924
|
'address': address,
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -1400,6 +1400,7 @@ class bitget extends bitget$1["default"] {
|
|
|
1400
1400
|
'commonCurrencies': {
|
|
1401
1401
|
'APX': 'AstroPepeX',
|
|
1402
1402
|
'DEGEN': 'DegenReborn',
|
|
1403
|
+
'EVA': 'Evadore',
|
|
1403
1404
|
'JADE': 'Jade Protocol',
|
|
1404
1405
|
'OMNI': 'omni',
|
|
1405
1406
|
'TONCOIN': 'TON',
|
|
@@ -2460,11 +2461,22 @@ class bitget extends bitget$1["default"] {
|
|
|
2460
2461
|
const code = this.safeCurrencyCode(id);
|
|
2461
2462
|
const chains = this.safeValue(entry, 'chains', []);
|
|
2462
2463
|
const networks = {};
|
|
2463
|
-
|
|
2464
|
+
let withdraw = undefined;
|
|
2465
|
+
let deposit = undefined;
|
|
2466
|
+
const chainsLength = chains.length;
|
|
2467
|
+
if (chainsLength === 0) {
|
|
2468
|
+
withdraw = false;
|
|
2469
|
+
deposit = false;
|
|
2470
|
+
}
|
|
2471
|
+
for (let j = 0; j < chainsLength; j++) {
|
|
2464
2472
|
const chain = chains[j];
|
|
2465
2473
|
const networkId = this.safeString(chain, 'chain');
|
|
2466
2474
|
let network = this.networkIdToCode(networkId, code);
|
|
2467
2475
|
network = network.toUpperCase();
|
|
2476
|
+
const withdrawable = (this.safeString(chain, 'withdrawable') === 'true');
|
|
2477
|
+
const rechargeable = (this.safeString(chain, 'rechargeable') === 'true');
|
|
2478
|
+
withdraw = (withdraw === undefined) ? withdrawable : (withdraw || withdrawable);
|
|
2479
|
+
deposit = (deposit === undefined) ? rechargeable : (deposit || rechargeable);
|
|
2468
2480
|
networks[network] = {
|
|
2469
2481
|
'info': chain,
|
|
2470
2482
|
'id': networkId,
|
|
@@ -2480,12 +2492,13 @@ class bitget extends bitget$1["default"] {
|
|
|
2480
2492
|
},
|
|
2481
2493
|
},
|
|
2482
2494
|
'active': undefined,
|
|
2483
|
-
'withdraw':
|
|
2484
|
-
'deposit':
|
|
2495
|
+
'withdraw': withdrawable,
|
|
2496
|
+
'deposit': rechargeable,
|
|
2485
2497
|
'fee': this.safeNumber(chain, 'withdrawFee'),
|
|
2486
2498
|
'precision': this.parseNumber(this.parsePrecision(this.safeString(chain, 'withdrawMinScale'))),
|
|
2487
2499
|
};
|
|
2488
2500
|
}
|
|
2501
|
+
const active = withdraw && deposit;
|
|
2489
2502
|
const isFiat = this.inArray(code, fiatCurrencies);
|
|
2490
2503
|
result[code] = this.safeCurrencyStructure({
|
|
2491
2504
|
'info': entry,
|
|
@@ -2494,9 +2507,9 @@ class bitget extends bitget$1["default"] {
|
|
|
2494
2507
|
'networks': networks,
|
|
2495
2508
|
'type': isFiat ? 'fiat' : 'crypto',
|
|
2496
2509
|
'name': undefined,
|
|
2497
|
-
'active':
|
|
2498
|
-
'deposit':
|
|
2499
|
-
'withdraw':
|
|
2510
|
+
'active': active,
|
|
2511
|
+
'deposit': deposit,
|
|
2512
|
+
'withdraw': withdraw,
|
|
2500
2513
|
'fee': undefined,
|
|
2501
2514
|
'precision': undefined,
|
|
2502
2515
|
'limits': {
|
package/dist/cjs/src/blofin.js
CHANGED
|
@@ -1388,18 +1388,20 @@ class blofin extends blofin$1["default"] {
|
|
|
1388
1388
|
[method, params] = this.handleOptionAndParams(params, 'createOrder', 'method', 'privatePostTradeOrder');
|
|
1389
1389
|
const isStopLossPriceDefined = this.safeString(params, 'stopLossPrice') !== undefined;
|
|
1390
1390
|
const isTakeProfitPriceDefined = this.safeString(params, 'takeProfitPrice') !== undefined;
|
|
1391
|
-
const
|
|
1391
|
+
const hasTriggerPrice = this.safeString(params, 'triggerPrice') !== undefined;
|
|
1392
1392
|
const isType2Order = (isStopLossPriceDefined || isTakeProfitPriceDefined);
|
|
1393
1393
|
let response = undefined;
|
|
1394
1394
|
const reduceOnly = this.safeBool(params, 'reduceOnly');
|
|
1395
1395
|
if (reduceOnly !== undefined) {
|
|
1396
1396
|
params['reduceOnly'] = reduceOnly ? 'true' : 'false';
|
|
1397
1397
|
}
|
|
1398
|
-
|
|
1398
|
+
const isTpslOrder = tpsl || (method === 'privatePostTradeOrderTpsl') || isType2Order;
|
|
1399
|
+
const isTriggerOrder = hasTriggerPrice || (method === 'privatePostTradeOrderAlgo');
|
|
1400
|
+
if (isTpslOrder) {
|
|
1399
1401
|
const tpslRequest = this.createTpslOrderRequest(symbol, type, side, amount, price, params);
|
|
1400
1402
|
response = await this.privatePostTradeOrderTpsl(tpslRequest);
|
|
1401
1403
|
}
|
|
1402
|
-
else if (isTriggerOrder
|
|
1404
|
+
else if (isTriggerOrder) {
|
|
1403
1405
|
const triggerRequest = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
1404
1406
|
response = await this.privatePostTradeOrderAlgo(triggerRequest);
|
|
1405
1407
|
}
|
|
@@ -1407,10 +1409,9 @@ class blofin extends blofin$1["default"] {
|
|
|
1407
1409
|
const request = this.createOrderRequest(symbol, type, side, amount, price, params);
|
|
1408
1410
|
response = await this.privatePostTradeOrder(request);
|
|
1409
1411
|
}
|
|
1410
|
-
if (
|
|
1412
|
+
if (isTpslOrder || isTriggerOrder) {
|
|
1411
1413
|
const dataDict = this.safeDict(response, 'data', {});
|
|
1412
|
-
|
|
1413
|
-
return triggerOrder;
|
|
1414
|
+
return this.parseOrder(dataDict, market);
|
|
1414
1415
|
}
|
|
1415
1416
|
const data = this.safeList(response, 'data', []);
|
|
1416
1417
|
const first = this.safeDict(data, 0);
|
package/dist/cjs/src/bybit.js
CHANGED
|
@@ -514,6 +514,7 @@ class bybit extends bybit$1["default"] {
|
|
|
514
514
|
'v5/account/mmp-reset': 5,
|
|
515
515
|
'v5/account/borrow': 5,
|
|
516
516
|
'v5/account/repay': 5,
|
|
517
|
+
'v5/account/no-convert-repay': 5,
|
|
517
518
|
// asset
|
|
518
519
|
'v5/asset/exchange/quote-apply': 1,
|
|
519
520
|
'v5/asset/exchange/convert-execute': 1,
|
|
@@ -3948,7 +3949,7 @@ class bybit extends bybit$1["default"] {
|
|
|
3948
3949
|
* @param {string} [params.positionIdx] *contracts only* 0 for one-way mode, 1 buy side of hedged mode, 2 sell side of hedged mode
|
|
3949
3950
|
* @param {bool} [params.hedged] *contracts only* true for hedged mode, false for one way mode, default is false
|
|
3950
3951
|
* @param {int} [params.isLeverage] *unified spot only* false then spot trading true then margin trading
|
|
3951
|
-
* @param {string} [params.tpslMode] *contract only* '
|
|
3952
|
+
* @param {string} [params.tpslMode] *contract only* 'Full' or 'Partial'
|
|
3952
3953
|
* @param {string} [params.mmp] *option only* market maker protection
|
|
3953
3954
|
* @param {string} [params.triggerDirection] *contract only* the direction for trigger orders, 'ascending' or 'descending'
|
|
3954
3955
|
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
@@ -4072,22 +4073,31 @@ class bybit extends bybit$1["default"] {
|
|
|
4072
4073
|
throw new errors.InvalidOrder(this.id + ' the API endpoint used only supports contract trailingAmount, stopLossPrice and takeProfitPrice orders');
|
|
4073
4074
|
}
|
|
4074
4075
|
if (isStopLossTriggerOrder || isTakeProfitTriggerOrder) {
|
|
4076
|
+
const tpslMode = this.safeString(params, 'tpslMode', 'Partial');
|
|
4077
|
+
const isFullTpsl = tpslMode === 'Full';
|
|
4078
|
+
const isPartialTpsl = tpslMode === 'Partial';
|
|
4079
|
+
if (isLimit && isFullTpsl) {
|
|
4080
|
+
throw new errors.InvalidOrder(this.id + ' tpsl orders with "full" tpslMode only support "market" type');
|
|
4081
|
+
}
|
|
4082
|
+
request['tpslMode'] = tpslMode;
|
|
4075
4083
|
if (isStopLossTriggerOrder) {
|
|
4076
4084
|
request['stopLoss'] = this.getPrice(symbol, stopLossTriggerPrice);
|
|
4085
|
+
if (isPartialTpsl) {
|
|
4086
|
+
request['slSize'] = amountString;
|
|
4087
|
+
}
|
|
4077
4088
|
if (isLimit) {
|
|
4078
|
-
request['tpslMode'] = 'Partial';
|
|
4079
4089
|
request['slOrderType'] = 'Limit';
|
|
4080
4090
|
request['slLimitPrice'] = priceString;
|
|
4081
|
-
request['slSize'] = amountString;
|
|
4082
4091
|
}
|
|
4083
4092
|
}
|
|
4084
4093
|
else if (isTakeProfitTriggerOrder) {
|
|
4085
4094
|
request['takeProfit'] = this.getPrice(symbol, takeProfitTriggerPrice);
|
|
4095
|
+
if (isPartialTpsl) {
|
|
4096
|
+
request['tpSize'] = amountString;
|
|
4097
|
+
}
|
|
4086
4098
|
if (isLimit) {
|
|
4087
|
-
request['tpslMode'] = 'Partial';
|
|
4088
4099
|
request['tpOrderType'] = 'Limit';
|
|
4089
4100
|
request['tpLimitPrice'] = priceString;
|
|
4090
|
-
request['tpSize'] = amountString;
|
|
4091
4101
|
}
|
|
4092
4102
|
}
|
|
4093
4103
|
}
|
|
@@ -4273,7 +4283,7 @@ class bybit extends bybit$1["default"] {
|
|
|
4273
4283
|
}
|
|
4274
4284
|
request['positionIdx'] = (side === 'buy') ? 1 : 2;
|
|
4275
4285
|
}
|
|
4276
|
-
params = this.omit(params, ['stopPrice', 'timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'clientOrderId', 'triggerPrice', 'stopLoss', 'takeProfit', 'trailingAmount', 'trailingTriggerPrice', 'hedged']);
|
|
4286
|
+
params = this.omit(params, ['stopPrice', 'timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'clientOrderId', 'triggerPrice', 'stopLoss', 'takeProfit', 'trailingAmount', 'trailingTriggerPrice', 'hedged', 'tpslMode']);
|
|
4277
4287
|
return this.extend(request, params);
|
|
4278
4288
|
}
|
|
4279
4289
|
/**
|